Frank Heberling
Email: Frank.Heberling@kit.edu
Shortcut scripts
These are little macros that may speed up your work with CTR and RASD data in PDS. Just copy the script, save it as a 'text_file', modify it for your needs, and run it in PDS with >>>execfile('text_file')
- The first one creates a CTRData instance called "CTR" from several hklscans. It also predefines the correction and some of the background subtraction parameters so you don't need to adjust these in the CTR Data GUI.
##############################################################################
spec_path = 'D:/Data/APS/CTR' #path to spec file
spec = 'caco3_mar10g.spc' # name of spec file
first_scan = 28
last_scan = 32
###############################################################################
spec_file = ana.reader.Reader(spec,spec_path)
nscans = last_scan +1 - first_scan
S = []
for i in range(nscans):
tmp = spec_file.spec_scan(first_scan + i, image = True)
S.append(tmp)
CTR = ana.ctr_data.CtrData(S)
CTR.corr_params[0]['geom'] = 'psic'
CTR.corr_params[0]['beam_slits'] = {'horz': 0.1 , 'vert': 1.0}
CTR.corr_params[0]['sample'] = {'polygon':[], 'angles':{}}
CTR.corr_params[0]['sample']['polygon'] = [[0,-7.69,0],[-6.14,-1.12,0],[0,7.69,0],[6.14,1.12,0]]
CTR.corr_params[0]['sample']['angles'] = {'mu':0, 'chi': -0.339, 'phi': -154, 'eta':285}
for i in range(len(CTR.F)): CTR.corr_params[i] = CTR.corr_params[0]
CTR.scan[0].image.bgrpar[0]['bgrflag']= 3
CTR.scan[0].image.bgrpar[0]['cwidth']= 10
CTR.scan[0].image.bgrpar[0]['cpow']= 2
CTR.scan[0].image.bgrpar[0]['rwidth']= 10
CTR.scan[0].image.bgrpar[0]['rpow']= 2
for j in range(nscans):
for i in range(CTR.scan[j].dims[0]): CTR.scan[j].image.bgrpar[i] = CTR.scan[0].image.bgrpar[0]
- The second one does the same for a raxr scan and a RASDdata instance called "R":
#################################################################
spec_path = 'D:/Data/APS/RASD'
spec = 'se_caco3_mar10d.spc'
first_scan = 1
last_scan = 79
#################################################################
R = ana.rasd_data.rasd_data(spec_path, spec, first_scan, last_scan )
R.corr_params[0]['geom'] = 'psic'
R.corr_params[0]['beam_slits'] = {'horz': 0.1 , 'vert': 1.0}
R.corr_params[0]['sample'] = {'polygon':[], 'angles':{}}
R.corr_params[0]['sample']['polygon'] = [[0,-7.69,0],[-6.14,-1.12,0],[0,7.69,0],[6.14,1.12,0]]
R.corr_params[0]['sample']['angles'] = {'mu':0, 'chi': -0.339, 'phi': -154, 'eta':285}
for i in range(len(R.F)): R.corr_params[i] = R.corr_params[0]
R.scan[0].image.bgrpar[0]['bgrflag']= 1
R.scan[0].image.bgrpar[0]['cwidth']= 5
R.scan[0].image.bgrpar[0]['cpow']= 2
R.scan[0].image.bgrpar[0]['rwidth']= 5
R.scan[0].image.bgrpar[0]['rpow']= 2
for j in range(len(R.scan_index)):
for i in range(R.scan[j].dims[0]): R.scan[j].image.bgrpar[i] = R.scan[0].image.bgrpar[0]- The third one is an example for a macro as you can use it to speed up the start of the rasd_menu()
rasddata = [\
'rasd00_3.793.rsd',\
'rasd00_2.37.rsd',\
'rasd00_2.24.rsd',\
'rasd00_2.59.rsd',\
'rasd01_0.72.rsd',\
'rasd01_1.96.rsd',\
'rasd-20_2.48.rsd',\
'rasd-20_3.42.rsd',\
'rasd20_0.852.rsd',\
]
cell = [8.0942,4.988,6.0701,90,90,90,-0.2405,0]
bulk_file = 'se_caco3.bul'
sur_file = 'se_caco3.sur'
f1f2_file = 'se_exp.f1f2'
menu.rasd(rasddata, cell = cell, bulk_file = bulk_file, sur_file = sur_file, f1f2_file = f1f2_file, E0 = 12658)