def process(directory): """ Generate tiff image folders for cine files located in a specified directory INPUT ----- folder : string path of the folder to process OUTPUT ----- """ fileList,n = browse.get_fileList(directory,frmt='cine',root='/PIV_') fileList_ref,n = browse.get_fileList(directory,frmt='cine',root='/Reference_') fileList_bubble,n = browse.get_fileList(directory,frmt='cine',root='/Bubble') fileList_other,n = browse.get_fileList(directory,frmt='cine',root='/') print(fileList_other) # print(fileList) #print(fileList_ref) step=0 while step>=0: if step == 0: ref_movie.make_ref(fileList_ref) ref_movie.make_ref(fileList_bubble) # caller(fileList_ref,step) # step = caller(fileList,step) step = caller(fileList_other,step)
def get_fileList(self, display=False): """ Return the list of PIV data (.txt files) associated to this measure """ fileList, n = browse.get_fileList(self.dataDir + '/', self.frmt, display=display, sort='name') if n == 0: print("NO PIV files found locally at : " + self.dataDir) print("Look for other possible locations") rootDir = file_architecture.get_dir(self.Id.date) dataDir = browse.get_string(self.dataDir, self.Id.date, from_end=True) dataDir = rootDir + dataDir fileList, n = browse.get_fileList(dataDir + '/', self.frmt, display=display, sort='name') if n == 0: print("No PIV files found globally !") else: print("PIV files found at : " + rootDir) # print(n) return fileList, n
def getloc(date, index, mindex): Dir = getDir(date) # print(Dir) if index == []: print('load every Mdata') fileList, n = browse.get_fileList(Dir, 'txt', root='M_') print(fileList) else: if mindex == []: print('load every Mdata associated to ' + date + '_' + str(index)) fileList, n = browse.get_fileList(Dir, 'txt', root='M_' + date + str(index)) else: filename = Dir + "M_" + date + "_" + str(index) + "_" + str(mindex) + ".txt" fileList = [filename] return fileList
def Sdata_gen(cineFile, index): """ Parameters ---------- cineFile : string name of a cine file index : intege index is associated to a specific cine file Returns S : Sdata class object ------- """ failure = None # print(cineFile) base = browse.get_string(os.path.basename(cineFile), '', end='.cine') # find the file where exp. parameters are given fileDir = os.path.dirname(cineFile) + '/' fileList, n = browse.get_fileList(fileDir, 'txt', root='Setup_file_Reference_', display=True, sort='date') file_param = os.path.dirname(cineFile) + '/' + 'Setup_file_Ref.txt' print '----Setup txt file(s)---' print fileList print '------------------------' for f in fileList: s = browse.get_string(f, 'Setup_file_Reference_', end='.txt') # print(base) # print('extract :'+s) if browse.contain(base, s): file_param = f print 'file_param: ' + file_param # input() # file = os.path.dirname(cineFile)+'/References/Ref_'+base+'.txt' # file = os.path.dirname(cineFile)+'/'+'Setup_file_Ref.txt' #/Volumes/labshared/Stephane_lab1/25015_09_22/References/Ref_PIV_sv_vp_zoom_Polymer_200ppm_X25mm_fps5000_n18000_beta500mu_H1180mm_S300mm.txt' # print(file) # try: print '----Cine file being processed:----' print cineFile print '----------------------------' S = Sdata(fileCine=cineFile, index=index, fileParam=file_param) print '----------------------------' print 'Sdata class object S is created!' print 'Attributes of S are...' print dir(S) print 'Attributes of S.param are...' print dir(S.param) print '----------------------------' S.write() return S
def process_pivstacks(directory, cinelist): """ Generate tiff image folders for cine files located in a specified directory INPUT ----- folder : string path of the folder where cines live OUTPUT ----- """ fileList, n = browse.get_fileList(directory, frmt='cine', root='/PIV_') fileList_ref, n = browse.get_fileList(directory, frmt='cine', root='/Reference_') fileList_bubble, n = browse.get_fileList(directory, frmt='cine', root='/Bubble') fileList_all, n = browse.get_fileList(directory, frmt='cine', root='/') offset = args.offset if args.stacks==True: fileList_stacks, n = cinelist, len(cinelist) print (fileList_stacks, n) # print (fileList_all) # print(fileList) # print(fileList_ref) step = 0 while step >= 0: if step == 0: ref_movie.make_ref(fileList_ref) ref_movie.make_ref(fileList_bubble) # caller(fileList_ref,step) # step = caller(fileList,step) if args.stacks == True: step = caller(fileList_stacks, step) else: step = caller(fileList_all, step)
def load_Sdata_day(date): # load all the data of the day, in a given Slist Dir = getDir(date) # print(Dir) fileList, n = browse.get_fileList(Dir, 'hdf5', display=True) if n > 0: Slist = [] for filename in fileList: S = load_Sdata_file(filename) if S is not None: Slist.append(S) return Slist else: print("No hdf5 files found at " + Dir)
def Sdata_gen_day(date): # find the location of the data for a given date fileDir = file_architecture.get_dir(date) + '/' print 'Name of Directory Being Processed: ' + fileDir # print(fileDir) cineList, n = browse.get_fileList(fileDir, 'cine', display=True) print(cineList) failure = [] for name in cineList: # print(name) output = Sdata_gen(name, cineList.index(name)) if not output is None: failure.append(output) n = len(cineList) dict_day = {'Names': cineList, 'Index': range(n)} print(dict_day) filename = fileDir + 'Sdata_' + date + '/Cine_index_' + date + '.txt' rw_data.write_a_dict(filename, dict_day) return
def get_fileList(self, display=False): fileList, n = browse.get_fileList(self.dataDir + '/', self.frmt, display) if n == 0: print("No PIV files found ! at " + self.dataDir) return fileList, n