本文整理汇总了Python中mantid.logger.notice函数的典型用法代码示例。如果您正苦于以下问题:Python notice函数的具体用法?Python notice怎么用?Python notice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: PyExec
def PyExec(self):
in_ws = mtd[self.getPropertyValue('InputWorkspace')]
out_ws_name = self.getPropertyValue('OutputWorkspace')
out_ws = ms.CreateEmptyTableWorkspace(OutputWorkspace=out_ws_name)
out_ws.addColumn('str', 'statistic')
stats = {
'standard_deviation': dict(),
'maximum': dict(),
'minimum': dict(),
'mean': dict(),
'median': dict(),
}
for name in in_ws.getColumnNames():
try:
col_stats = _stats_to_dict(Stats.getStatistics(np.array([float(v) for v in in_ws.column(name)])))
for statname in stats:
stats[statname][name] = col_stats[statname]
out_ws.addColumn('float', name)
except ValueError:
logger.notice('Column \'%s\' is not numerical, skipping' % name)
for name, stat in iteritems(stats):
stat1 = dict(stat)
stat1['statistic'] = name
out_ws.addRow(stat1)
self.setProperty('OutputWorkspace', out_ws)
开发者ID:rosswhitfield,项目名称:mantid,代码行数:31,代码来源:StatisticsOfTableWorkspace.py
示例2: get_vanadium
def get_vanadium(self, detector_mask, m1, colltrans, exp, indir):
"""
This function returns either (vanadium_count, vanadium_monitor, None) or
(None, None, vcorr) depending what type of file is provided by getProperty("Vanadium")
"""
if not self.getProperty("Normalise").value:
return None, None, np.ones(44)[detector_mask]
vanadium_filename = self.getProperty("Vanadium").value
if vanadium_filename:
if vanadium_filename.split('.')[-1] == 'dat':
vanadium = np.genfromtxt(vanadium_filename)
vanadium_count = vanadium[:, 5:49].sum(axis=0)[detector_mask]
vanadium_monitor = vanadium[:, 3].sum()
logger.notice("Using vanadium data file: {}".format(vanadium_filename))
return vanadium_count, vanadium_monitor, None
else:
vcorr_filename = vanadium_filename
else: # Find adjacent vcorr file
# m1 is the monochromator angle
# m1 = 0 -> Ge 115, 1.54A
# m1 = 9.45 -> Ge 113, 2.41A
# colltrans is the collimator position, whether in or out of the beam
# colltrans = 0 -> IN
# colltrans = +/-80 -> OUT
vcorr_filename = 'HB2A_{}__Ge_{}_{}_vcorr.txt'.format(exp,
115 if np.isclose(m1, 0, atol=0.1) else 113,
"IN" if np.isclose(colltrans, 0, atol=0.1) else "OUT")
vcorr_filename = os.path.join(indir, vcorr_filename)
logger.notice("Using vcorr file: {}".format(vcorr_filename))
if not os.path.isfile(vcorr_filename):
raise RuntimeError("Vanadium file {} does not exist".format(vcorr_filename))
return None, None, np.genfromtxt(vcorr_filename)[detector_mask]
开发者ID:mantidproject,项目名称:mantid,代码行数:34,代码来源:HB2AReduce.py
示例3: startup
def startup(self, cycle='14_3'):
user_data_directory = os.path.normpath(self.use_folder + cycle)
self.set_data_directory(user_data_directory)
logger.notice("Raw Data in : {}".format(user_data_directory))
user_data_processed = self.out_folder
self.set_user_directory(directory=user_data_processed)
logger.notice("Processed Data in : {}".format(user_data_processed))
开发者ID:samueljackson92,项目名称:mantid,代码行数:7,代码来源:reduce.py
示例4: getWSprefix
def getWSprefix(wsname,runfile=None):
'''Returns a string of the form '<ins><run>_<analyser><refl>_' on which
all of our other naming conventions are built.
The workspace is used to get the instrument parameters. If the runfile
string is given it is expected to be a string with instrument prefix
and run number. If it is empty then the workspace name is assumed to
contain this information
'''
if wsname == '':
return ''
if runfile is None:
runfile = wsname
ws = mtd[wsname]
facility = config['default.facility']
if facility == 'ILL':
instr = ws.getInstrument().getName()
logger.notice('Facility is '+facility)
prefix = instr + '_' + wsname[:-3]
else:
(instr, run) = getInstrRun(runfile)
run_name = instr + run
try:
analyser = ws.getInstrument().getStringParameter('analyser')[0]
reflection = ws.getInstrument().getStringParameter('reflection')[0]
except IndexError:
analyser = ''
reflection = ''
prefix = run_name + '_' + analyser + reflection + '_'
return prefix
开发者ID:trnielsen,项目名称:mantid,代码行数:29,代码来源:IndirectCommon.py
示例5: PyExec
def PyExec(self):
run_f2py_compatibility_test()
self.log().information('Jump input')
inType = self.getPropertyValue('InputType')
prefix = self.getPropertyValue('Instrument')
ana = self.getPropertyValue('Analyser')
prog = self.getPropertyValue('QLprogram')
jump = self.getPropertyValue('Fit')
fw = self.getPropertyValue('Width')
sam = self.getPropertyValue('SamNumber')
sname = prefix+sam+'_'+ana+'_'+prog
cropOp = self.getProperty('CropQ')
if cropOp:
qmin = self.getPropertyValue('Qmin')
qmax = self.getPropertyValue('Qmax')
qrange = [qmin, qmax]
else:
qrange = [0.0, 5.0]
verbOp = self.getProperty('Verbose')
plotOp = self.getProperty('Plot')
saveOp = self.getProperty('Save')
workdir = config['defaultsave.directory']
if inType == 'File':
path = os.path.join(workdir, sname+'_Parameters.nxs') # path name for nxs file
LoadNexusProcessed(Filename=path, OutputWorkspace=sname+'_Parameters')
message = 'Input from File : '+path
else:
message = 'Input from Workspace : '+sname
if verbOp:
logger.notice(message)
Main.JumpRun(sname,jump,prog,fw,cropOp,qrange,verbOp,plotOp,saveOp)
开发者ID:trnielsen,项目名称:mantid,代码行数:34,代码来源:JumpFit.py
示例6: createQaxis
def createQaxis(inputWS):
result = []
ws = mtd[inputWS]
nHist = ws.getNumberHistograms()
if ws.getAxis(1).isSpectra():
inst = ws.getInstrument()
samplePos = inst.getSample().getPos()
beamPos = samplePos - inst.getSource().getPos()
for i in range(0,nHist):
efixed = getEfixed(inputWS, i)
detector = ws.getDetector(i)
theta = getDetectorTwoTheta(detector, samplePos, beamPos) / 2
lamda = math.sqrt(81.787/efixed)
q = 4 * math.pi * math.sin(theta) / lamda
result.append(q)
else:
axis = ws.getAxis(1)
msg = 'Creating Axis based on Detector Q value: '
if not axis.isNumeric():
msg += 'Input workspace must have either spectra or numeric axis.'
logger.notice(msg)
sys.exit(msg)
if ( axis.getUnit().unitID() != 'MomentumTransfer' ):
msg += 'Input must have axis values of Q'
logger.notice(msg)
sys.exit(msg)
for i in range(0, nHist):
result.append(float(axis.label(i)))
return result
开发者ID:trnielsen,项目名称:mantid,代码行数:29,代码来源:IndirectCommon.py
示例7: _calculate_energy
def _calculate_energy(self, monitor_ws, grouped_ws, red_ws):
"""
Convert the input run to energy transfer
@param monitor_ws :: name of the monitor workspace to divide by
@param grouped_ws :: name of workspace with the detectors grouped
@param red_ws :: name to call the reduced workspace
"""
x_range = self._monitor_range(monitor_ws)
Scale(InputWorkspace=monitor_ws, OutputWorkspace=monitor_ws, Factor=0.001, Operation='Multiply')
CropWorkspace(InputWorkspace=monitor_ws, OutputWorkspace=monitor_ws, Xmin=x_range[0], XMax=x_range[1])
ScaleX(InputWorkspace=monitor_ws, OutputWorkspace=monitor_ws, Factor=-x_range[0], Operation='Add')
CropWorkspace(InputWorkspace=grouped_ws, OutputWorkspace=grouped_ws, Xmin=x_range[0], XMax=x_range[1])
ScaleX(InputWorkspace=grouped_ws, OutputWorkspace=grouped_ws, Factor=-x_range[0], Operation='Add')
Divide(LHSWorkspace=grouped_ws, RHSWorkspace=monitor_ws, OutputWorkspace=grouped_ws)
formula = self._energy_range(grouped_ws)
ConvertAxisByFormula(InputWorkspace=grouped_ws, OutputWorkspace=red_ws, Axis='X', Formula=formula,
AxisTitle='Energy transfer', AxisUnits='meV')
if self._verbose:
xnew = mtd[red_ws].readX(0) # energy array
logger.notice('Energy range : %f to %f' % (xnew[0], xnew[-1]))
DeleteWorkspace(grouped_ws)
DeleteWorkspace(monitor_ws)
开发者ID:jkrueger1,项目名称:mantid,代码行数:28,代码来源:IndirectILLReduction.py
示例8: unwrap_monitor
def unwrap_monitor(workspace_name):
"""
Unwrap monitor if required based on value of Workflow.UnwrapMonitor parameter
@param workspace_name Name of workspace
@return True if the monitor was unwrapped
"""
from mantid.simpleapi import (UnwrapMonitor, RemoveBins, FFTSmooth)
monitor_workspace_name = workspace_name + '_mon'
instrument = mtd[monitor_workspace_name].getInstrument()
# Determine if the monitor should be unwrapped
try:
unwrap = instrument.getStringParameter('Workflow.UnwrapMonitor')[0]
if unwrap == 'Always':
should_unwrap = True
elif unwrap == 'BaseOnTimeRegime':
mon_time = mtd[monitor_workspace_name].readX(0)[0]
det_time = mtd[workspace_name].readX(0)[0]
logger.notice(str(mon_time) + " " + str(det_time))
should_unwrap = mon_time == det_time
else:
should_unwrap = False
except IndexError:
should_unwrap = False
logger.debug('Need to unwrap monitor for %s: %s' % (workspace_name, str(should_unwrap)))
if should_unwrap:
sample = instrument.getSample()
sample_to_source = sample.getPos() - instrument.getSource().getPos()
radius = mtd[workspace_name].getDetector(0).getDistance(sample)
z_dist = sample_to_source.getZ()
l_ref = z_dist + radius
logger.debug('For workspace %s: radius=%d, z_dist=%d, l_ref=%d' %
(workspace_name, radius, z_dist, l_ref))
_, join = UnwrapMonitor(InputWorkspace=monitor_workspace_name,
OutputWorkspace=monitor_workspace_name,
LRef=l_ref)
RemoveBins(InputWorkspace=monitor_workspace_name,
OutputWorkspace=monitor_workspace_name,
XMin=join - 0.001, XMax=join + 0.001,
Interpolation='Linear')
try:
FFTSmooth(InputWorkspace=monitor_workspace_name,
OutputWorkspace=monitor_workspace_name,
WorkspaceIndex=0,
IgnoreXBins=True)
except ValueError:
raise ValueError('Uneven bin widths are not supported.')
return should_unwrap
开发者ID:DanNixon,项目名称:mantid,代码行数:59,代码来源:IndirectReductionCommon.py
示例9: load_multi_run_part
def load_multi_run_part(self, extension, run, panel):
filename = self.get_file_name(run, extension)
logger.notice("reading filename... {}".format(filename))
spectra_min, spectra_max = self.return_panel.get(panel)
output1 = "w{0}-{1}".format(run, panel)
simple.LoadRaw(Filename=filename, OutputWorkspace=output1, SpectrumMin=str(spectra_min),
SpectrumMax=str(spectra_max), LoadLogFiles="0")
return output1
开发者ID:samueljackson92,项目名称:mantid,代码行数:8,代码来源:reduce.py
示例10: PyExec
def PyExec(self):
from IndirectImport import run_f2py_compatibility_test, is_supported_f2py_platform
if is_supported_f2py_platform():
import IndirectBayes as Main
run_f2py_compatibility_test()
self.log().information('Quest input')
inType = self.getPropertyValue('InputType')
prefix = self.getPropertyValue('Instrument')
ana = self.getPropertyValue('Analyser')
sam = self.getPropertyValue('SamNumber')
rinType = self.getPropertyValue('ResInputType')
res = self.getPropertyValue('ResNumber')
elastic = self.getProperty('ElasticOption').value
bgd = self.getPropertyValue('BackgroundOption')
emin = self.getPropertyValue('EnergyMin')
emax = self.getPropertyValue('EnergyMax')
nbin = self.getPropertyValue('SamBinning')
nbins = [nbin, 1]
nbet = self.getProperty('NumberBeta').value
nsig = self.getProperty('NumberSigma').value
nbs = [nbet, nsig]
sname = prefix+sam+'_'+ana + '_red'
rname = prefix+res+'_'+ana + '_res'
erange = [float(emin), float(emax)]
if elastic:
o_el = 1
else:
o_el = 0
fitOp = [o_el, bgd, 0, 0]
loopOp = self.getProperty('Sequence').value
verbOp = self.getProperty('Verbose').value
plotOp = self.getPropertyValue('Plot')
saveOp = self.getProperty('Save').value
workdir = config['defaultsave.directory']
if inType == 'File':
spath = os.path.join(workdir, sname+'.nxs') # path name for sample nxs file
LoadNexusProcessed(Filename=spath, OutputWorkspace=sname)
Smessage = 'Sample from File : '+spath
else:
Smessage = 'Sample from Workspace : '+sname
if rinType == 'File':
rpath = os.path.join(workdir, rname+'.nxs') # path name for res nxs file
LoadNexusProcessed(Filename=rpath, OutputWorkspace=rname)
Rmessage = 'Resolution from File : '+rpath
else:
Rmessage = 'Resolution from Workspace : '+rname
if verbOp:
logger.notice(Smessage)
logger.notice(Rmessage)
Main.QuestRun(sname,rname,nbs,erange,nbins,fitOp,loopOp,plotOp,saveOp)
开发者ID:stothe2,项目名称:mantid,代码行数:57,代码来源:Quest.py
示例11: PyExec
def PyExec(self):
run_f2py_compatibility_test()
self.log().information("Quest input")
inType = self.getPropertyValue("InputType")
prefix = self.getPropertyValue("Instrument")
ana = self.getPropertyValue("Analyser")
sam = self.getPropertyValue("SamNumber")
rinType = self.getPropertyValue("ResInputType")
res = self.getPropertyValue("ResNumber")
elastic = self.getProperty("ElasticOption")
bgd = self.getPropertyValue("BackgroundOption")
emin = self.getPropertyValue("EnergyMin")
emax = self.getPropertyValue("EnergyMax")
nbin = self.getPropertyValue("SamBinning")
nbins = [nbin, 1]
nbet = self.getPropertyValue("NumberBeta")
nsig = self.getPropertyValue("NumberSigma")
nbs = [nbet, nsig]
sname = prefix + sam + "_" + ana + "_red"
rname = prefix + res + "_" + ana + "_res"
erange = [float(emin), float(emax)]
if elastic:
o_el = 1
else:
o_el = 0
if bgd == "Sloping":
o_bgd = 2
if bgd == "Flat":
o_bgd = 1
if bgd == "Zero":
o_bgd = 0
fitOp = [o_el, o_bgd, 0, 0]
loopOp = self.getProperty("Sequence")
verbOp = self.getProperty("Verbose")
plotOp = self.getPropertyValue("Plot")
saveOp = self.getProperty("Save")
workdir = config["defaultsave.directory"]
if inType == "File":
spath = os.path.join(workdir, sname + ".nxs") # path name for sample nxs file
LoadNexusProcessed(Filename=spath, OutputWorkspace=sname)
Smessage = "Sample from File : " + spath
else:
Smessage = "Sample from Workspace : " + sname
if rinType == "File":
rpath = os.path.join(workdir, rname + ".nxs") # path name for res nxs file
LoadNexusProcessed(Filename=rpath, OutputWorkspace=rname)
Rmessage = "Resolution from File : " + rpath
else:
Rmessage = "Resolution from Workspace : " + rname
if verbOp:
logger.notice(Smessage)
logger.notice(Rmessage)
Main.QuestRun(sname, rname, nbs, erange, nbins, fitOp, loopOp, verbOp, plotOp, saveOp)
开发者ID:trnielsen,项目名称:mantid,代码行数:56,代码来源:Quest.py
示例12: SymmStart
def SymmStart(inType,sname,cut,Verbose,Plot,Save):
StartTime('Symmetrise')
workdir = config['defaultsave.directory']
if inType == 'File':
spath = os.path.join(workdir, sname+'.nxs') # path name for sample nxs file
LoadNexusProcessed(FileName=spath, OutputWorkspace=sname)
message = 'Input from File : '+spath
else:
message = 'Input from Workspace : '+sname
if Verbose:
logger.notice(message)
SymmRun(sname,cut,Verbose,Plot,Save)
EndTime('Symmetrise')
开发者ID:trnielsen,项目名称:mantid,代码行数:13,代码来源:IndirectSymm.py
示例13: CheckHistZero
def CheckHistZero(inWS):
nhist = mtd[inWS].getNumberHistograms() # no. of hist/groups in WS
if nhist == 0:
error = 'Workspace '+inWS+' has NO histograms'
logger.notice('ERROR *** ' + error)
sys.exit(error)
Xin = mtd[inWS].readX(0)
ntc = len(Xin)-1 # no. points from length of x array
if ntc == 0:
error = 'Workspace '+inWS+' has NO points'
logger.notice('ERROR *** ' + error)
sys.exit(error)
return nhist,ntc
开发者ID:trnielsen,项目名称:mantid,代码行数:13,代码来源:IndirectCommon.py
示例14: read
def read(self, number, panel, extension):
if type(number) is int:
filename = self.datafile
logger.notice("will be reading filename...{}".format(filename))
spectra_min, spectra_max = self.return_panel_van.get(panel) if self.is_vanadium else \
self.return_panel.get(panel)
if panel != 0:
output = "w{0}-{1}".format(number, panel)
else:
output = "w{}".format(number)
shared_load_files(extension, filename, output, spectra_max, spectra_min, False)
if extension == "nxs_event":
simple.LoadEventNexus(Filename=filename, OutputWorkspace=output, LoadMonitors='1')
self.read_event_nexus(number, output, panel)
if extension[:10] == "nxs_event_":
label, tmin, tmax = split_string_event(extension)
output = output + "_" + label
if tmax == "end":
simple.LoadEventNexus(Filename=filename, OutputWorkspace=output, FilterByTimeStart=tmin,
LoadMonitors='1', MonitorsAsEvents='1', FilterMonByTimeStart=tmin)
else:
simple.LoadEventNexus(Filename=filename, OutputWorkspace=output, FilterByTimeStart=tmin,
FilterByTimeStop=tmax, LoadMonitors='1', MonitorsAsEvents='1',
FilterMonByTimeStart=tmin, FilterMonByTimeStop=tmax)
self.read_event_nexus(number, output, panel)
else:
num_1, num_2 = split_run_string(number)
output = "w{0}_{1}-{2}".format(num_1, num_2, panel)
output1 = self.load_multi_run_part(extension, num_1, panel)
output2 = self.load_multi_run_part(extension, num_2, panel)
simple.MergeRuns(output1 + "," + output2, output)
simple.DeleteWorkspace(output1)
simple.DeleteWorkspace(output2)
simple.ConvertUnits(InputWorkspace=output, OutputWorkspace=output, Target="Wavelength", Emode="Elastic")
lmin, lmax = Wish.LAMBDA_RANGE
simple.CropWorkspace(InputWorkspace=output, OutputWorkspace=output, XMin=lmin, XMax=lmax)
monitor_run = "monitor{}".format(number)
if monitor_run not in simple.mtd:
monitor = self.process_incidentmon(number, extension, spline_terms=70)
else:
monitor = simple.mtd[monitor_run]
simple.NormaliseToMonitor(InputWorkspace=output, OutputWorkspace=output + "norm1", MonitorWorkspace=monitor)
simple.NormaliseToMonitor(InputWorkspace=output + "norm1", OutputWorkspace=output + "norm2",
MonitorWorkspace=monitor, IntegrationRangeMin=0.7, IntegrationRangeMax=10.35)
simple.DeleteWorkspace(output)
simple.DeleteWorkspace(output + "norm1")
simple.RenameWorkspace(InputWorkspace=output + "norm2", OutputWorkspace=output)
simple.ConvertUnits(InputWorkspace=output, OutputWorkspace=output, Target="TOF", EMode="Elastic")
simple.ReplaceSpecialValues(InputWorkspace=output, OutputWorkspace=output, NaNValue=0.0, NaNError=0.0,
InfinityValue=0.0, InfinityError=0.0)
return output
开发者ID:samueljackson92,项目名称:mantid,代码行数:51,代码来源:reduce.py
示例15: CubicFit
def CubicFit(inputWS, spec, Verbose=False):
'''Uses the Mantid Fit Algorithm to fit a quadratic to the inputWS
parameter. Returns a list containing the fitted parameter values.'''
function = 'name=Quadratic, A0=1, A1=0, A2=0'
fit = Fit(Function=function, InputWorkspace=inputWS, WorkspaceIndex=spec,
CreateOutput=True, Output='Fit')
table = mtd['Fit_Parameters']
A0 = table.cell(0,1)
A1 = table.cell(1,1)
A2 = table.cell(2,1)
Abs = [A0, A1, A2]
if Verbose:
logger.notice('Group '+str(spec)+' of '+inputWS+' ; fit coefficients are : '+str(Abs))
return Abs
开发者ID:trnielsen,项目名称:mantid,代码行数:14,代码来源:IndirectDataAnalysis.py
注:本文中的mantid.logger.notice函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论