def CreateScanDataFileList(wdname,sf,scannumber): """ Create the list of localized file from specfile scan number specified @param wdname: main working path directory containing DATA/, PROCESS/ and REPORT/ folders afterward @type wdname: string @param sf: specfile informations @type sf: specfile object @param scannumber: number of the scan data to find out @type scannumber: string """ # Original ESRF directory name of files odname = SpecTools.get_ScanValueInSpecHeaderComment(sf,scannumber,'#C qq.adet.dname') # Equivalent directory name in the path edname = odname.split('/') # Set the last directory specified in wdname as the key to set the equivalency keydname = wdname.split('/')[-2] # Position of experiment directory name (edname) in the original directory name (odname) field : try: poskey = int([pos for pos in range(len(odname.split('/'))) if odname.split('/')[pos] == keydname][0]) except IndexError:# Case of keydname is not identical between original directory and actual directory poskey = int([pos for pos in range(len(odname.split('/'))) if odname.split('/')[pos] == 'DATA'][0]) - 1 fdname = wdname + '/'.join(odname.split('/')[poskey+1::]) + '/'#Directory of the files nbmeas = sf.select(str(scannumber)).data().shape[1]#Number of measurements recorded (can be different from expected in the command if user stop the scan) fprefix = SpecTools.get_ScanValueInSpecHeaderComment(sf,scannumber,'#C qq.adet.prefix') filelist = [fdname + fprefix + str(val).zfill(4) + '.edf' for val in range(0,nbmeas)] return filelist
def CreateScanDataFileList(wdname, sf, scannumber): """ Create the list of localized file from specfile scan number specified @param wdname: main working path directory containing DATA/, PROCESS/ and REPORT/ folders afterward @type wdname: string @param sf: specfile informations @type sf: specfile object @param scannumber: number of the scan data to find out @type scannumber: string """ # Original ESRF directory name of files odname = SpecTools.get_ScanValueInSpecHeaderComment( sf, scannumber, '#C qq.adet.dname') # Equivalent directory name in the path edname = odname.split('/') # Set the last directory specified in wdname as the key to set the equivalency keydname = wdname.split('/')[-2] # Position of edname in the odname field poskey = int([ pos for pos in range(len(odname.split('/'))) if odname.split('/')[pos] == keydname ][0]) fdname = wdname + '/'.join( odname.split('/')[poskey + 1::]) + '/' #Directory of the files nbmeas = sf.select(str(scannumber)).data().shape[ 1] #Number of measurements recorded (can be different from expected in the command if user stop the scan) fprefix = SpecTools.get_ScanValueInSpecHeaderComment( sf, scannumber, '#C qq.adet.prefix') filelist = [ fdname + fprefix + str(val).zfill(4) + '.edf' for val in range(0, nbmeas) ] return filelist