def testReturnsDataWithFloatingPointForce(self): params = dict( construct='SJF4', slide=1, mol=3, pull=3, force=10.5, min='2') finfo = fio.parseFilename( self.filenameFromParams(**params)) self.checkReturnData(params, finfo)
def testReturnsFilenameData(self): params = dict( construct='SJF4', slide=1, mol=3, pull=3, force=0, min='2') finfo = fio.parseFilename( self.filenameFromParams(**params)) self.checkReturnData(params, finfo)
def testReturnsDataWithFloatingPointForce(self): params = dict(construct='SJF4', slide=1, mol=3, pull=3, force=10.5, min='2') finfo = fio.parseFilename(self.filenameFromParams(**params)) self.checkReturnData(params, finfo)
def testReturnsFilenameData(self): params = dict(construct='SJF4', slide=1, mol=3, pull=3, force=0, min='2') finfo = fio.parseFilename(self.filenameFromParams(**params)) self.checkReturnData(params, finfo)
def byMolecule(directory='./', exp_type=experiment.Pulling, fromMatch=('',), **metadata): """Return a generator (iterator) which yields experiment.List for all molecules in given directory.""" assert issubclass(exp_type, experiment.Base) assert isinstance(fromMatch, (tuple, list)) assert isinstance(directory, str) with ChangeDirectory(directory): flist = filter(exp_type.filenameMatchesType, experiment.filelist(*fromMatch)) filelist = groupby(flist, lambda f: fileIO.parseFilename(f)[:4]) for mol, group in filelist: with ChangeDirectory(directory): dirname = path.basename(directory) date_ = dir_to_date(dirname) metadata.setdefault('date', date_) yield experiment.List( map(lambda f: exp_type.fromFile(f, **metadata), group))
def byMolecule(directory='./', exp_type=experiment.Pulling, fromMatch=('', ), **metadata): """Return a generator (iterator) which yields experiment.List for all molecules in given directory.""" assert issubclass(exp_type, experiment.Base) assert isinstance(fromMatch, (tuple, list)) assert isinstance(directory, str) with ChangeDirectory(directory): flist = filter(exp_type.filenameMatchesType, experiment.filelist(*fromMatch)) filelist = groupby(flist, lambda f: fileIO.parseFilename(f)[:4]) for mol, group in filelist: with ChangeDirectory(directory): dirname = path.basename(directory) date_ = dir_to_date(dirname) metadata.setdefault('date', date_) yield experiment.List( map(lambda f: exp_type.fromFile(f, **metadata), group))
def testReturnsNoneWithBadFilename(self): fail = 'SJF4_0.5nM_s1m3_2hours.fret' finfo = fio.parseFilename(fail) self.assertEquals(finfo, None)