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


Python EnggUtils.applyVanadiumCorrection方法代码示例

本文整理汇总了Python中EnggUtils.applyVanadiumCorrection方法的典型用法代码示例。如果您正苦于以下问题:Python EnggUtils.applyVanadiumCorrection方法的具体用法?Python EnggUtils.applyVanadiumCorrection怎么用?Python EnggUtils.applyVanadiumCorrection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EnggUtils的用法示例。


在下文中一共展示了EnggUtils.applyVanadiumCorrection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PyExec

# 需要导入模块: import EnggUtils [as 别名]
# 或者: from EnggUtils import applyVanadiumCorrection [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
        # 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.applyVanadiumCorrection(self, inWS, vanWS)

        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:nimgould,项目名称:mantid,代码行数:27,代码来源:EnggCalibrateFull.py

示例2: PyExec

# 需要导入模块: import EnggUtils [as 别名]
# 或者: from EnggUtils import applyVanadiumCorrection [as 别名]
    def PyExec(self):
        import EnggUtils

        # Get the run workspace
        ws = self.getProperty('InputWorkspace').value

        # Get spectra indices either from bank or direct list of indices, checking for errors
        bank = self.getProperty('Bank').value
        spectra = self.getProperty(self.INDICES_PROP_NAME).value
        indices = EnggUtils.getWsIndicesFromInProperties(ws, bank, spectra)

    	# Leave the data for the bank we are interested in only
        ws = EnggUtils.cropData(self, ws, indices)

    	# Apply calibration
        detPos = self.getProperty("DetectorPositions").value
        if detPos:
            self._applyCalibration(ws, detPos)

        # Leave data for the same bank in the vanadium workspace too
        vanWS = self.getProperty("VanadiumWorkspace").value
        # if it is raw data (not precalculated curve), needs to be cropped
        if EnggUtils.vanadiumWorkspaceIsPrecalculated(ws):
            vanWS = EnggUtils.cropData(self, vanWS, indices)

        # These corrections rely on ToF<->Dspacing conversions, so they're done after the calibration step
        vanFittingWS = EnggUtils.applyVanadiumCorrection(self, ws, vanWS,
                                                         self.getProperty('VanadiumIntegWorkspace').value)

    	# Convert to dSpacing
        ws = EnggUtils.convertToDSpacing(self, ws)

    	# Sum the values
        ws = EnggUtils.sumSpectra(self, ws)

    	# Convert back to time of flight
        ws = EnggUtils.convertToToF(self, ws)

    	# OpenGenie displays distributions instead of pure counts (this is done implicitly when
    	# converting units), so I guess that's what users will expect
        self._convertToDistr(ws)

        self.setProperty("OutputWorkspace", ws)

        # optinally, generate the workspace with per-bank vanadium fitting curves
        outVanWSName = self.getPropertyValue('OutVanadiumCurveFits')
        if outVanWSName:
            mtd[outVanWSName] = vanFittingWS
开发者ID:nimgould,项目名称:mantid,代码行数:50,代码来源:EnggFocus.py


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