コード例 #1
0
    def PyExec(self):
        import EnginXUtils

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

        indices = EnginXUtils.getWsIndicesFromInProperties(ws, self.getProperty('Bank').value,
                                                           self.getProperty(self.INDICES_PROP_NAME).value)

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

    	# Apply calibration
        self._applyCalibration(ws)

    	# Convert to dSpacing
        ws = self._convertToDSpacing(ws)

    	# Sum the values
        ws = self._sumSpectra(ws)

    	# Convert back to time of flight
        ws = self._convertToTOF(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)
コード例 #2
0
    def PyExec(self):

        # Get peaks in dSpacing from file, and check we have what we need, before doing anything
        expectedPeaksD = EnginXUtils.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 = EnginXUtils.getWsIndicesFromInProperties(inWS, self.getProperty('Bank').value,
                                                             self.getProperty(self.INDICES_PROP_NAME).value)

        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)