def PyExec(self): import EnginXUtils ws = self._loadCalibrationRun() ws = self._prepareWsForFitting(ws) positionTable = self._createPositionsTable() indices = EnginXUtils.getWsIndicesForBank(self.getProperty('Bank').value, ws) prog = Progress(self, 0, 1, len(indices)) for i in indices: _, difc = self._fitPeaks(ws, i) det = ws.getDetector(i) newPos = self._getCalibratedDetPos(difc, det, ws) positionTable.addRow([det.getID(), newPos]) prog.report() self.setProperty("DetectorPositions", positionTable)
def _cropData(self, ws): """ Crops the workspace so that only data for the specified bank is left. NB: This assumes spectra for a bank are consequent. """ import EnginXUtils indices = EnginXUtils.getWsIndicesForBank(self.getProperty("Bank").value, ws) # Leave only spectra between min and max alg = self.createChildAlgorithm("CropWorkspace") alg.setProperty("InputWorkspace", ws) alg.setProperty("StartWorkspaceIndex", min(indices)) alg.setProperty("EndWorkspaceIndex", max(indices)) alg.execute() return alg.getProperty("OutputWorkspace").value
def _cropData(self, ws): """ Crops the workspace so that only data for the specified bank is left. NB: This assumes spectra for a bank are consequent. """ import EnginXUtils indices = EnginXUtils.getWsIndicesForBank(self.getProperty('Bank').value, ws) # Leave only spectra between min and max alg = self.createChildAlgorithm('CropWorkspace') alg.setProperty('InputWorkspace', ws) alg.setProperty('StartWorkspaceIndex', min(indices)) alg.setProperty('EndWorkspaceIndex', max(indices)) alg.execute() return alg.getProperty('OutputWorkspace').value