本文整理汇总了Python中larch.Group.ifluor_raw方法的典型用法代码示例。如果您正苦于以下问题:Python Group.ifluor_raw方法的具体用法?Python Group.ifluor_raw怎么用?Python Group.ifluor_raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类larch.Group
的用法示例。
在下文中一共展示了Group.ifluor_raw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gsexdi_deadtime_correct
# 需要导入模块: from larch import Group [as 别名]
# 或者: from larch.Group import ifluor_raw [as 别名]
def gsexdi_deadtime_correct(fname, channelname, subdir='DT_Corrected',
bad=None, _larch=None):
"""convert GSE XDI fluorescence XAFS scans to dead time corrected files"""
if not is_GSEXDI(fname):
print("'%s' is not a GSE XDI scan file\n" % fname)
return
out = Group()
out.orig_filename = fname
try:
xdi = read_gsexdi(fname, bad=bad, _larch=_larch)
except:
print('Could not read XDI file ', fname)
return
for attr in ('energy', 'i0', 'i1', 'i2', 'tscaler',
'counttime', 'scan_start_time', 'scan_end_time'):
if hasattr(xdi, attr):
setattr(out, attr, getattr(xdi, attr))
# some scans may not record separate counttime, but TSCALER
# is clock ticks for a 50MHz clock
if not hasattr(out, 'counttime'):
out.counttime = xdi.tscaler * 2.e-8
if hasattr(xdi, 'energy_readback'):
out.energy = xdi.energy_readback
arrname = None
channelname = channelname.lower().replace(' ', '_')
for arr in xdi.array_labels:
if arr.lower().startswith(channelname):
arrname = arr
break
if arrname is None:
print('Cannot find Channel %s in file %s '% (channelname, fname))
return
out.ifluor = getattr(xdi, arrname)
out.ifluor_raw = getattr(xdi, arrname)
arrname_raw = arrname + '_nodtc'
if arrname_raw in xdi.array_labels:
out.ifluor_raw = getattr(xdi, arrname_raw)
out.mufluor = out.ifluor / out.i0
if hasattr(out, 'i1') or hasattr(out, 'itrans'):
i1 = getattr(out, 'i1', None)
if i1 is None:
i1 = getattr(out, 'itrans', None)
if i1 is not None:
i1 = i1 / out.i0
i1[np.where(i1<2.0e-20)] = 2.0e-20
out.mutrans = -np.log(i1)
npts = len(out.energy)
buff = ['# XDI/1.0 GSE/1.0']
header = OrderedDict()
hgroups = ['beamline', 'facility', 'mono', 'undulator', 'detectors',
'scaler', 'detectorstage', 'samplestage', 'scan', 'scanparameters']
hskip = ['scanparameters.end', 'scanparameters.start']
for agroup in hgroups:
attrs = xdi._xdi.attrs.get(agroup, {})
if agroup == 'mono': agroup = 'monochromator'
header[agroup] = OrderedDict()
for sname in sorted(attrs.keys()):
if "%s.%s" %( agroup, sname) not in hskip:
header[agroup][sname] = attrs[sname]
header['facility']['name'] = 'APS'
header['facility']['xray_source'] = '3.6 cm undulator'
header['beamline']['name'] = '13-ID-E, GSECARS'
header['detectors']['i0'] = '20cm ion chamber, He'
header['detectors']['ifluor'] = 'Si SDD Vortex ME-4, 4 elements'
header['detectors']['ifluor_electronics'] = 'Quantum Xspress3 3.1.10'
mono_cut = 'Si(111)'
if xdi.mono_dspacing < 2:
mono_cut = 'Si(311)'
header['monochromator']['name'] = "%s, LN2 cooled" % mono_cut
out_arrays = OrderedDict()
out_arrays['energy'] = ('energy', 'eV')
out_arrays['mufluor'] = ('mufluor', None)
if hasattr(out, 'i1'):
out_arrays['mutrans'] = ('mutrans', None)
out_arrays['ifluor'] = ('ifluor', '# deadtime-corrected')
out_arrays['ifluor_raw'] = ('ifluor_raw', '# not deadtime-corrected')
out_arrays['i0'] = ('i0', None)
if hasattr(out, 'i1'):
out_arrays['itrans'] = ('i1', None)
if hasattr(out, 'i2'):
out_arrays['irefer'] = ('i2', None)
#.........这里部分代码省略.........