コード例 #1
0
ファイル: tests.py プロジェクト: chexenia/whisk
 def save( self, filename ):
   from ui.whiskerdata import save_trajectories
   save_trajectories( filename, self.compile() )
コード例 #2
0
ファイル: classify.py プロジェクト: chexenia/whisk
import traj
from ui.whiskerdata import save_trajectories
warnings.simplefilter("default",UserWarning)

if __name__ == '__main__':
  parser = optparse.OptionParser( usage = "Usage: %prog source destination" )
  options,args = parser.parse_args()
  if len(args) != 2:
    parser.error( "Expected source and destination file names but recieved %d arguments."%len(args) ) 
  src, dst = args

  if not os.path.exists(os.path.split(dst)[0]): # check path, do this before doing long calculation
    raise IOError, "Could not find destination file %s"%dst

  #
  # Get data from source
  #
  ext = os.path.splitext(src)[1]
  if ext == '.whiskers':
    w = trace.Load_Whiskers(src)
    data = array(list( summary.features(w) ))
  elif ext == '.measurements':
    data = traj.MeasurementsTable(src).asarray()
  else:
    raise IOError, "Source file extension not recognized.  Got: %s"%ext

  traj = summary._simpletraj(data)

  save_trajectories(dst, traj)

コード例 #3
0
ファイル: tests.py プロジェクト: jp3477/whisk
 def save(self, filename):
     from ui.whiskerdata import save_trajectories
     save_trajectories(filename, self.compile())
コード例 #4
0
warnings.simplefilter("default", UserWarning)

if __name__ == '__main__':
    parser = optparse.OptionParser(usage="Usage: %prog source destination")
    options, args = parser.parse_args()
    if len(args) != 2:
        parser.error(
            "Expected source and destination file names but recieved %d arguments."
            % len(args))
    src, dst = args

    if not os.path.exists(os.path.split(
            dst)[0]):  # check path, do this before doing long calculation
        raise IOError, "Could not find destination file %s" % dst

    #
    # Get data from source
    #
    ext = os.path.splitext(src)[1]
    if ext == '.whiskers':
        w = trace.Load_Whiskers(src)
        data = array(list(summary.features(w)))
    elif ext == '.measurements':
        data = traj.MeasurementsTable(src).asarray()
    else:
        raise IOError, "Source file extension not recognized.  Got: %s" % ext

    traj = summary._simpletraj(data)

    save_trajectories(dst, traj)