def GetLaneTrialsMatchingName(DataDirBase, FilePattern, ext=".xls"): FileNames = pGenUtil.getAllFiles(DataDirBase, ext) Copies = [] for f in FileNames: if (re.match(FilePattern, f) is not None): print("si") Copies.append(f) assert len(Copies) > 0, "Couldn't find any files to load" # now get the lanes from the files Lanes = [ReadFileToOverhangObj(f) for f in Copies] # now convert the lanes to a single object, with the means and standard # deviations return OverhangTrialObject(Lanes)
def GetImageJData(DataDirBase, ext=".xls"): """ Given a base data directory, finds all files with ext in each subdirectory Args: DataDirBase: base data directory. Each subdirectory has files with extension 'ext' ext: file extension Returns: ordered dictionary of <subdir:fullpaths> """ Voltages = OrderedDict() for f in sorted(os.listdir(DataDirBase)): PossibleSubDir = DataDirBase + f + "/" if (os.path.isdir(PossibleSubDir)): Files = pGenUtil.getAllFiles(PossibleSubDir, ".xls") Voltages[f] = Files return Voltages