当前位置: 首页>>代码示例>>Python>>正文


Python EnggUtils.readInExpectedPeaks方法代码示例

本文整理汇总了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)
开发者ID:stothe2,项目名称:mantid,代码行数:36,代码来源:EnggFitPeaks.py

示例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)
开发者ID:spaceyatom,项目名称:mantid,代码行数:29,代码来源:EnggCalibrateFull.py

示例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)
开发者ID:nimgould,项目名称:mantid,代码行数:21,代码来源:EnggCalibrate.py

示例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)
开发者ID:stothe2,项目名称:mantid,代码行数:25,代码来源:EnggCalibrate.py


注:本文中的EnggUtils.readInExpectedPeaks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。