diff --git a/Code/Mantid/Framework/Algorithms/src/GetDetectorOffsets.cpp b/Code/Mantid/Framework/Algorithms/src/GetDetectorOffsets.cpp index 1a6000b87c09fcd7557cda0e3135a16443f65ffd..f48cb324fa42653ba869a912f54eebb964d405a0 100644 --- a/Code/Mantid/Framework/Algorithms/src/GetDetectorOffsets.cpp +++ b/Code/Mantid/Framework/Algorithms/src/GetDetectorOffsets.cpp @@ -94,6 +94,8 @@ namespace Mantid OffsetsWorkspace_sptr outputW(new OffsetsWorkspace(inputW->getInstrument())); // Create the output MaskWorkspace MatrixWorkspace_sptr maskWS(new SpecialWorkspace2D(inputW->getInstrument())); + //To get the workspace index from the detector ID + detid2index_map * pixel_to_wi = maskWS->getDetectorIDToWorkspaceIndexMap(true); // Fit all the spectra with a gaussian Progress prog(this, 0, 1.0, nspec); @@ -103,11 +105,11 @@ namespace Mantid PARALLEL_START_INTERUPT_REGION // Fit the peak double offset=fitSpectra(wi); - maskWS->dataY(wi)[0] = 1.0; + double mask=1.0; if (std::abs(offset) > maxOffset) { offset = 0.0; - maskWS->maskWorkspaceIndex(wi); + mask = 0.0; } // Get the list of detectors in this pixel @@ -121,6 +123,8 @@ namespace Mantid for (it = dets.begin(); it != dets.end(); it++) { outputW->setValue(*it, offset); + if (mask == 0.) maskWS->maskWorkspaceIndex((*pixel_to_wi)[*it]); + else maskWS->dataY((*pixel_to_wi)[*it])[0] = mask; } } prog.report(); diff --git a/Code/Mantid/Framework/PythonAPI/PythonAlgorithms/CalibrateRectangularDetectors.py b/Code/Mantid/Framework/PythonAPI/PythonAlgorithms/CalibrateRectangularDetectors.py index 022b0266bd1b3aee10f78f56b2b3276e84e5f265..407e52d7879b63d1df012ed20a14a99645c6073c 100644 --- a/Code/Mantid/Framework/PythonAPI/PythonAlgorithms/CalibrateRectangularDetectors.py +++ b/Code/Mantid/Framework/PythonAPI/PythonAlgorithms/CalibrateRectangularDetectors.py @@ -218,10 +218,12 @@ class CalibrateRectangularDetectors(PythonAlgorithm): WorkspaceIndexMin=self._lastpixel+1, WorkspaceIndexMax=wksp.getNumberHistograms()-1, XMin=self._peakmin2, XMax=self._peakmax2) # Get offsets for pixels using interval around cross correlations center and peak at peakpos (d-Spacing) GetDetectorOffsets(InputWorkspace=str(wksp)+"cc2", OutputWorkspace=str(wksp)+"offset2", Step=abs(self._binning[1]), - DReference=self._peakpos2, XMin=-self._ccnumber, XMax=self._ccnumber, MaxOffset=self._maxoffset, MaskWorkspace=str(wksp)+"mask",) + DReference=self._peakpos2, XMin=-self._ccnumber, XMax=self._ccnumber, MaxOffset=self._maxoffset, MaskWorkspace=str(wksp)+"mask2",) Plus(LHSWorkspace=str(wksp)+"offset", RHSWorkspace=str(wksp)+"offset2",OutputWorkspace=str(wksp)+"offset") + Plus(LHSWorkspace=str(wksp)+"mask", RHSWorkspace=str(wksp)+"mask2",OutputWorkspace=str(wksp)+"mask") mtd.deleteWorkspace(str(wksp)+"cc2") mtd.deleteWorkspace(str(wksp)+"offset2") + mtd.deleteWorkspace(str(wksp)+"mask2") mtd.releaseFreeMemory() CreateGroupingWorkspace(InputWorkspace=wksp, GroupNames=groups, OutputWorkspace=str(wksp)+"group") lcinst = str(self._instrument)