Commit e21eed00 by Alessandro Mirone

### preparing XES non regression test

parent 908fae88
 ... ... @@ -704,12 +704,13 @@ def calculate_recenterings(mydata): h5B = h5B_f[bariB_groupname] offs = {} chiavi = filterRoiList(h5A.keys()) chiavi = filterRoiList(h5A.keys(), prefix="") for c in chiavi: bA = h5A[c]["barix"].value + h5A[c]["cornerpos"][:][1] bB = h5B[c]["barix"].value + h5B[c]["cornerpos"][:][1] bAy = h5A[c]["bariy"].value + h5A[c]["cornerpos"][:][0] bBy = h5B[c]["bariy"].value + h5B[c]["cornerpos"][:][0] bA = h5A[c]["barix"][()] + h5A[c]["cornerpos"][:][1] bB = h5B[c]["barix"][()] + h5B[c]["cornerpos"][:][1] bAy = h5A[c]["bariy"][()] + h5A[c]["cornerpos"][:][0] bBy = h5B[c]["bariy"][()] + h5B[c]["cornerpos"][:][0] offs[c] = [[bBy, bAy ],[bB,bA]] if h5B_f is not h5A_f: ... ... @@ -1033,7 +1034,7 @@ def loadscan_2Dimages(mydata): h5f = h5py.File(recenterings_filename,"r") h5 = h5f[recenterings_groupname] recenterings= {} chiavi = filterRoiList(h5.keys()) chiavi = filterRoiList(h5.keys(), prefix="") for c in chiavi: recenterings[int(c)]= h5[c][:] if recenterings[int(c)].shape == (2,2): ... ... @@ -1103,6 +1104,8 @@ def loadscan_2Dimages(mydata): h5f = h5py.File(recenterings_confirmed_filename,"w") h5 = h5f.require_group(recenterings_confirmed_groupname) for c in chiavi: if c in h5: del h5[c] h5[c] = reader.recenterings[int(c)] h5f.flush() h5f.close() ... ... @@ -1436,6 +1439,10 @@ def extract_spectra(mydata): references = {} h5f = h5py.File(reference_file,"r" ) if reference_groupname not in h5f: raise ValueError("Key %s not present in file %s"%(reference_groupname, reference_file) ) h5 = h5f[reference_groupname] print( " FILTRO ", list(h5.keys()) ) rois_keys = filterRoiList(h5.keys(),prefix="") ... ... @@ -1451,27 +1458,29 @@ def extract_spectra(mydata): for k in rois_keys: if deconvolve: mm = h5[k]["matrix"][:] mm[np.isnan(mm)] = 0.0 else: mm = None print(reference_file, reference_groupname, list(h5[k].keys() ) ) zscale = h5[k]["xscale"].value*1000.0 zscale = h5[k]["xscale"][()]*1000.0 mask = h5rois["ROI%02d"%int(k)]["mask"][:] cummask = np.cumsum(mask,axis=0) mask[cummask<=zmargin]=0 mask[(cummask.max(axis=0) -cummask)
 ... ... @@ -71,7 +71,7 @@ if SHOW_LOADED_FILES : def dump_on_file_list(filename): f = open("list_of_used_files.txt","a") f.write( filename ) f.write( filename+"\n") f.close() ... ... @@ -162,6 +162,9 @@ def PyMcaSpecRead_my(filename,nscan): """ Returns data, counter-names, and EDF-files using PyMCA. """ if SHOW_LOADED_FILES: dump_on_file_list(filename) sf = SpecIO.Specfile(filename) scan = sf.select(str(nscan)) data = scan.data() ... ... @@ -180,6 +183,9 @@ def SilxSpecRead( filename, nscan ): """ Returns data, motors, counter-names, and labels using Silx. """ if SHOW_LOADED_FILES: dump_on_file_list(filename) nscan -= 1 sf = SpecFile( filename ) data = sf.data( nscan ) ... ... @@ -219,6 +225,9 @@ def PyMcaEdfRead(fname): """ Returns the EDF-data using PyMCA. """ if SHOW_LOADED_FILES: dump_on_file_list(fname) data = EdfIO.EdfFile(fname,"r").GetData(0) return data ... ... @@ -226,6 +235,9 @@ def FabioEdfRead(fname): """ Returns the EDF-data using FabIO. """ if SHOW_LOADED_FILES: dump_on_file_list(fname) return fabio.edfimage.EdfImage().read(fname).data def ReadScanFromFile(fname): ... ... @@ -347,7 +359,9 @@ def ReadEdfImages_my(ccdcounter, path, EdfPrefix, EdfName, EdfPostfix): for m in range(len(ccdcounter)): ccdnumber = ccdcounter[m] fname = path + EdfPrefix + EdfName + "%04d" % ccdnumber + EdfPostfix if SHOW_LOADED_FILES : print( " LEGGO ", fname) if SHOW_LOADED_FILES : dump_on_file_list(fname) print( " LEGGO ", fname) edfmats[m,:,:] = myEdfRead(fname) return edfmats ... ... @@ -364,7 +378,10 @@ def ReadEdfImages_PyMca(ccdcounter, path, EdfPrefix, EdfName, EdfPostfix): for m in range(len(ccdcounter)): ccdnumber = ccdcounter[m] fname = path + EdfPrefix + EdfName + "%04d" % ccdnumber + EdfPostfix if SHOW_LOADED_FILES : print( " LEGGO ", fname) if SHOW_LOADED_FILES : dump_on_file_list(fname) print( " LEGGO ", fname) edfmats[m,:,:] = PyMcaEdfRead(fname) return edfmats ... ...
 ... ... @@ -160,6 +160,10 @@ class oneD_imaging(xrs_read.read_id20): print( " ENERGIA adesso " , tmp.sum()) print( " ENERGIA prima " ,edfmats[:,roixinds,roiyinds] .sum()) # # When recentering.shape ==(2,2) it contains the previously measure (bari_Y, bari_X) of the reference scan ( with the reference ROI) in the first column # while the second columns is the previously measured baricenter of the sample scan ( with the sample ROI). # The goal now is to have a shift ( confirmed shift) which brings the sample baricenter ( with the reference ROI) over the scan baricenter if self.recenterings[ii].shape ==(2,2): dimz,dimy,dimx = tmp.shape ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!