Esempio n. 1
0
 def save( self, filename ):
   from ui.whiskerdata import save_trajectories
   save_trajectories( filename, self.compile() )
Esempio n. 2
0
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)