本文整理汇总了Python中EnggUtils.readInExpectedPeaks方法的典型用法代码示例。如果您正苦于以下问题:Python EnggUtils.readInExpectedPeaks方法的具体用法?Python EnggUtils.readInExpectedPeaks怎么用?Python EnggUtils.readInExpectedPeaks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnggUtils
的用法示例。
在下文中一共展示了EnggUtils.readInExpectedPeaks方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PyExec
# 需要导入模块: import EnggUtils [as 别名]
# 或者: from EnggUtils import readInExpectedPeaks [as 别名]
def PyExec(self):
import EnggUtils
# Get peaks in dSpacing from file
expectedPeaksD = EnggUtils.readInExpectedPeaks(self.getPropertyValue("ExpectedPeaksFromFile"),
self.getProperty('ExpectedPeaks').value)
if len(expectedPeaksD) < 1:
raise ValueError("Cannot run this algorithm without any input expected peaks")
# Get expected peaks in TOF for the detector
inWS = self.getProperty("InputWorkspace").value
dimType = inWS.getXDimension().getName()
if self.EXPECTED_DIM_TYPE != dimType:
raise ValueError("This algorithm expects a workspace with %s X dimension, but "
"the X dimension of the input workspace is: '%s'" % (self.EXPECTED_DIM_TYPE, dimType))
wsIndex = self.getProperty("WorkspaceIndex").value
# FindPeaks will return a list of peaks sorted by the centre found. Sort the peaks as well,
# so we can match them with fitted centres later.
expectedPeaksToF = sorted(self._expectedPeaksInTOF(expectedPeaksD, inWS, wsIndex))
foundPeaks = self._peaksFromFindPeaks(inWS, expectedPeaksToF, wsIndex)
if foundPeaks.rowCount() < len(expectedPeaksToF):
txt = "Peaks effectively found: " + str(foundPeaks)[1:-1]
self.log().warning("Some peaks from the list of expected peaks were not found by the algorithm "
"FindPeaks which this algorithm uses to check that the data has the the "
"expected peaks. " + txt)
peaksTableName = self.getPropertyValue("OutFittedPeaksTable")
difc, zero = self._fitAllPeaks(inWS, wsIndex, (foundPeaks, expectedPeaksD), peaksTableName)
self._produceOutputs(difc, zero)
示例2: PyExec
# 需要导入模块: import EnggUtils [as 别名]
# 或者: from EnggUtils import readInExpectedPeaks [as 别名]
def PyExec(self):
# Get peaks in dSpacing from file, and check we have what we need, before doing anything
expectedPeaksD = EnggUtils.readInExpectedPeaks(self.getPropertyValue("ExpectedPeaksFromFile"),
self.getProperty('ExpectedPeaks').value)
if len(expectedPeaksD) < 1:
raise ValueError("Cannot run this algorithm without any input expected peaks")
inWS = self.getProperty('Workspace').value
WSIndices = EnggUtils.getWsIndicesFromInProperties(inWS, self.getProperty('Bank').value,
self.getProperty(self.INDICES_PROP_NAME).value)
vanWS = self.getProperty("VanadiumWorkspace").value
vanIntegWS = self.getProperty('VanIntegrationWorkspace').value
vanCurvesWS = self.getProperty('VanCurvesWorkspace').value
# These corrections rely on ToF<->Dspacing conversions, so ideally they'd be done after the
# calibration step, which creates a cycle / chicken-and-egg issue.
EnggUtils.applyVanadiumCorrections(self, inWS, WSIndices, vanWS, vanIntegWS, vanCurvesWS)
rebinnedWS = self._prepareWsForFitting(inWS)
posTbl = self._calculateCalibPositionsTbl(rebinnedWS, WSIndices, expectedPeaksD)
# Produce 2 results: 'output table' and 'apply calibration' + (optional) calibration file
self.setProperty("OutDetPosTable", posTbl)
self._applyCalibrationTable(inWS, posTbl)
self._outputDetPosFile(self.getPropertyValue('OutDetPosFilename'), posTbl)
示例3: PyExec
# 需要导入模块: import EnggUtils [as 别名]
# 或者: from EnggUtils import readInExpectedPeaks [as 别名]
def PyExec(self):
import EnggUtils
focussed_ws = self._focusRun(self.getProperty('InputWorkspace').value,
self.getProperty("VanadiumWorkspace").value,
self.getProperty('Bank').value,
self.getProperty(self.INDICES_PROP_NAME).value)
# Get peaks in dSpacing from file
expectedPeaksD = EnggUtils.readInExpectedPeaks(self.getPropertyValue("ExpectedPeaksFromFile"),
self.getProperty('ExpectedPeaks').value)
if len(expectedPeaksD) < 1:
raise ValueError("Cannot run this algorithm without any input expected peaks")
difc, zero = self._fitParams(focussed_ws, expectedPeaksD)
self._produceOutputs(difc, zero)
示例4: PyExec
# 需要导入模块: import EnggUtils [as 别名]
# 或者: from EnggUtils import readInExpectedPeaks [as 别名]
def PyExec(self):
import EnggUtils
# Get peaks in dSpacing from file
expectedPeaksD = EnggUtils.readInExpectedPeaks(self.getPropertyValue("ExpectedPeaksFromFile"),
self.getProperty('ExpectedPeaks').value)
prog = Progress(self, start=0, end=1, nreports=2)
prog.report('Focusing the input workspace')
focussed_ws = self._focusRun(self.getProperty('InputWorkspace').value,
self.getProperty("VanadiumWorkspace").value,
self.getProperty('Bank').value,
self.getProperty(self.INDICES_PROP_NAME).value)
if len(expectedPeaksD) < 1:
raise ValueError("Cannot run this algorithm without any input expected peaks")
prog.report('Fitting parameters for the focused run')
difc, zero = self._fitParams(focussed_ws, expectedPeaksD)
self._produceOutputs(difc, zero)