本文整理汇总了Python中mantid.simpleapi.Load.getRun方法的典型用法代码示例。如果您正苦于以下问题:Python Load.getRun方法的具体用法?Python Load.getRun怎么用?Python Load.getRun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mantid.simpleapi.Load
的用法示例。
在下文中一共展示了Load.getRun方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _run_number_changed
# 需要导入模块: from mantid.simpleapi import Load [as 别名]
# 或者: from mantid.simpleapi.Load import getRun [as 别名]
def _run_number_changed(self):
""" Handling event if run number is changed... If it is a valid run number,
the load the meta data
"""
# 1. Form the file
newrunnumberstr = self._content.run_number_edit.text()
instrument = self._instrument_name
eventnxsname = "%s_%s_event.nxs" % (instrument, newrunnumberstr)
msg = str("Load event nexus file %s" % (eventnxsname))
self._content.info_text_browser.setText(msg)
# 2. Load file
metawsname = "%s_%s_meta" % (instrument, newrunnumberstr)
try:
metaws = Load(Filename=str(eventnxsname), OutputWorkspace=str(metawsname), MetaDataOnly=True)
except ValueError:
metaws = None
# 3. Update the log name combo box
if metaws is None:
self._content.info_text_browser.setText(
str("Error! Failed to load data file %s. Current working directory is %s. " % (eventnxsname, os.getcwd())))
else:
self._metaws = metaws
# a) Clear
self._content.log_name_combo.clear()
# b) Get properties
wsrun = metaws.getRun()
ps = wsrun.getProperties()
properties = []
for p in ps:
if p.__class__.__name__ == "FloatTimeSeriesProperty":
if p.size() > 1:
properties.append(p.name)
Logger('FilterSetupWidget').information('{}[{}]'.format(p.name, p.size()))
# ENDFOR p
properties = sorted(properties)
# c) Add
for p in properties:
self._content.log_name_combo.addItem(p)
示例2: reduceOneKeepingEvents
# 需要导入模块: from mantid.simpleapi import Load [as 别名]
# 或者: from mantid.simpleapi.Load import getRun [as 别名]
def reduceOneKeepingEvents(nxsfile, angle, eiguess, eaxis, outfile, t0guess=0.):
"""reduce nxs from one angle of a single crystal scan, keeping events
(only do tof->E conversion)
nxsfile: input path
angle: psi in degrees
eiguess: Ei in meV
eaxis: Emin, Emax, dE
outfile: output path
"""
from mantid.simpleapi import DgsReduction, SofQW3, SaveNexus, SaveNXSPE, LoadInstrument, Load, MoveInstrumentComponent, AddSampleLog
outfile = os.path.abspath(outfile)
print "* working on reducing %s to %s" % (nxsfile, outfile)
# load workspace from input nexus file
workspace = Load(nxsfile)
# workspace name have to be unique
unique_name = os.path.dirname(nxsfile).split('/')[-1]
wsname = 'reduced-%s' % unique_name
# Ei
if eiguess == 0.:
# If user does not supply Ei, we try to get it from the samplelog,
# because mcvine-generated SEQUOIA data files are mantid-processed nexus file
# with sample logs of Ei and t0.
# If we don't have them from sample logs, we just set Ei and T0 to None
run = workspace.getRun()
UseIncidentEnergyGuess = False
try:
Ei = run.getLogData('mcvine-Ei').value
UseIncidentEnergyGuess = True
except:
Ei = None
try:
T0 = run.getLogData('mcvine-t0').value
except:
T0 = None
else:
# user specified Ei, just use that
Ei = eiguess
T0 = t0guess
UseIncidentEnergyGuess = True
# keep events (need to then run RebinToWorkspace and ConvertToDistribution)
Emin, Emax, dE = eaxis
eaxis = '%s,%s,%s' % (Emin,dE, Emax)
DgsReduction(
SampleInputWorkspace = workspace,
IncidentEnergyGuess = Ei,
TimeZeroGuess = T0,
UseIncidentEnergyGuess=UseIncidentEnergyGuess,
OutputWorkspace=wsname,
SofPhiEIsDistribution='0',
EnergyTransferRange = eaxis,
)
AddSampleLog(Workspace=wsname,LogName="psi",LogText=str(angle),LogType="Number")
SaveNexus(
InputWorkspace=wsname,
Filename = outfile,
Title = 'reduced',
)
return