code cleanup

This commit is contained in:
Marco Cammarata 2017-02-09 17:17:34 +01:00
parent 35ba41f86b
commit f62f26e0fa
1 changed files with 4 additions and 5 deletions

View File

@ -1,6 +1,6 @@
from __future__ import print_function,division from __future__ import print_function,division
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
import numpy as np import numpy as np
@ -122,7 +122,7 @@ def averageScanPoints(scan,data,errAbs=None,isRef=None,lpower=None,useRatio=Fals
noise = np.nanstd(diff_for_scan, axis = 0) noise = np.nanstd(diff_for_scan, axis = 0)
# if it is the reference take only every second ... # if it is the reference take only every second ...
if np.all( shot_idx == isRef ): if np.all( shot_idx == isRef ):
diff_for_scan = diff_for_scan[::2] diff_for_scan = diff_for_scan[::2]
diffsInScanPoint.append( diff_for_scan ) diffsInScanPoint.append( diff_for_scan )
@ -216,9 +216,9 @@ def saveTxt(folder,data,delayToStr=True,basename='auto',info="",**kw):
fname = "%s/%sdiff_av_%s.txt" % (folder,basename,scan) fname = "%s/%sdiff_av_%s.txt" % (folder,basename,scan)
if 'mask' in data: if 'mask' in data:
tosave = np.vstack( (data.data[iscan],data.err[iscan], tosave = np.vstack( (data.data[iscan],data.err[iscan],
data.dataUnmasked[iscan],data.errUnmasked[iscan] ) ) data.dataUnmasked[iscan],data.errUnmasked[iscan] ) )
columns = 'q diffmask errmask diffnomask errnomask'.split() columns = 'q diffmask errmask diffnomask errnomask'.split()
else: else:
tosave = np.vstack( (data.data[iscan],data.err[iscan] ) ) tosave = np.vstack( (data.data[iscan],data.err[iscan] ) )
columns = 'q diff err'.split() columns = 'q diff err'.split()
utils.saveTxt(fname,q,tosave,info=info_delay,columns=columns) utils.saveTxt(fname,q,tosave,info=info_delay,columns=columns)
@ -259,4 +259,3 @@ def read_diff_av(folder,plot2D=False,save=None):
tosave = np.vstack( (header,tosave.T) ) tosave = np.vstack( (header,tosave.T) )
np.savetxt(folder + "/all_diffs_av_matrix.txt",tosave) np.savetxt(folder + "/all_diffs_av_matrix.txt",tosave)
return q,it,diffs,t return q,it,diffs,t