diff --git a/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp b/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp index f4cd29e45b9b2d8b381e3a8e97acd9fd0ce501f4..e6eaad079c82030b0453c58b2eae13ff1d242e16 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/CalculateCoverageDGS.cpp @@ -171,8 +171,10 @@ void CalculateCoverageDGS::exec() { std::vector<double> tt, phi; for (int i = 0; i < static_cast<int>(detIDS.size()); i++) { auto detector = instrument->getDetector(detIDS[i]); - tt.push_back(detector->getTwoTheta(V3D(0, 0, 0), V3D(0, 0, 1))); - phi.push_back(detector->getPhi()); + if(!detector->isMasked()){ + tt.push_back(detector->getTwoTheta(V3D(0, 0, 0), V3D(0, 0, 1))); + phi.push_back(detector->getPhi()); + } } double ttmax = *(std::max_element(tt.begin(), tt.end())); diff --git a/Code/Mantid/docs/source/images/DGSPlanner.png b/Code/Mantid/docs/source/images/DGSPlanner.png index d0c34363f5246dea33ada6eeb0a0a81fc613c431..7135e3aec52e7cf71f27e928f0aa6703fdc78e05 100644 Binary files a/Code/Mantid/docs/source/images/DGSPlanner.png and b/Code/Mantid/docs/source/images/DGSPlanner.png differ diff --git a/Code/Mantid/docs/source/interfaces/DGSPlanner.rst b/Code/Mantid/docs/source/interfaces/DGSPlanner.rst index 10f1b0bd8f73e522d3dd4c4b20184f320a29e59b..5b59c96a436b228cb1da39290837bde719493abe 100644 --- a/Code/Mantid/docs/source/interfaces/DGSPlanner.rst +++ b/Code/Mantid/docs/source/interfaces/DGSPlanner.rst @@ -26,6 +26,8 @@ of HYSPEC, a value for the **S2** angle is required. The monochromator to sample chosen to be msd=1798.5. The **Incident Energy** is in mili-electron-Volts. The **Fast** option will use only 25% of the detectors to calculate the coverage. +One can use a previously saved Mantid workspace containing a mask, the **Mask file** option, +to eliminate from the coverage calculations detectors that are masked in the experiment. The **Goniometer** settings follow the Mantid convention (see :ref:`SetGoniometer <algm-SetGoniometer>`. The default values follow the goniometer description in `Horace <http://horace.isis.rl.ac.uk/Generating_SQW_files>`_. diff --git a/Code/Mantid/scripts/DGSPlanner/DGSPlannerGUI.py b/Code/Mantid/scripts/DGSPlanner/DGSPlannerGUI.py index 235da3d98fbe1d4d74b54befe11e13ae864afcb1..9b121a0683fb969bb5b0ea9ad9d79a40eadb0f01 100644 --- a/Code/Mantid/scripts/DGSPlanner/DGSPlannerGUI.py +++ b/Code/Mantid/scripts/DGSPlanner/DGSPlannerGUI.py @@ -168,6 +168,16 @@ class DGSPlannerGUI(QtGui.QWidget): LogText=str(self.masterDict['S2']),LogType='Number Series') mantid.simpleapi.LoadInstrument(Workspace="__temp_instrument",InstrumentName="HYSPEC") #masking + if self.masterDict.has_key('maskFilename') and len(self.masterDict['maskFilename'].strip())>0: + try: + __maskWS=mantid.simpleapi.Load(self.masterDict['maskFilename']) + mantid.simpleapi.MaskDetectors(Workspace="__temp_instrument",MaskedWorkspace=__maskWS) + except (ValueError,RuntimeError) as e: + reply = QtGui.QMessageBox.critical(self, 'Error',"The following error has occured in loading the mask:\n"+ + str(e)+"\nDo you want to continue without mask?", + QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) + if reply==QtGui.QMessageBox.No: + return if self.masterDict['makeFast']: sp=range(mantid.mtd["__temp_instrument"].getNumberHistograms()) tomask=sp[::4]+sp[1::4]+sp[2::4] @@ -254,8 +264,8 @@ class DGSPlannerGUI(QtGui.QWidget): tempintensity= __mdws.getSignalArray()[:,:,0,0] intensity[numpy.where( tempintensity>0)]=1. progressDialog.close() - x = numpy.linspace(__mdws.getDimension(0).getMinimum(), __mdws.getDimension(0).getMaximum(),intensity.shape[1] ) - y = numpy.linspace(__mdws.getDimension(1).getMinimum(), __mdws.getDimension(1).getMaximum(),intensity.shape[0] ) + x = numpy.linspace(__mdws.getDimension(0).getMinimum(), __mdws.getDimension(0).getMaximum(),intensity.shape[0] ) + y = numpy.linspace(__mdws.getDimension(1).getMinimum(), __mdws.getDimension(1).getMaximum(),intensity.shape[1] ) Y,X = numpy.meshgrid(y,x) xx, yy = self.tr(X, Y) Z=numpy.ma.masked_array(intensity,intensity==0) diff --git a/Code/Mantid/scripts/DGSPlanner/InstrumentSetupWidget.py b/Code/Mantid/scripts/DGSPlanner/InstrumentSetupWidget.py index 3a5470ee400820dc3afa701aca0cabd680f7a6e2..de237a833b183b4a06dcd519ad426c8c1546720c 100644 --- a/Code/Mantid/scripts/DGSPlanner/InstrumentSetupWidget.py +++ b/Code/Mantid/scripts/DGSPlanner/InstrumentSetupWidget.py @@ -230,10 +230,11 @@ class InstrumentSetupWidget(QtGui.QWidget): self.layout().addWidget(self.canvas) #connections self.editS2.textEdited.connect(self.checkValidInputs) - self.editEi.textEdited.connect(self.checkValidInputs) + self.editMask.textEdited.connect(self.setMaskFile) self.combo.activated[str].connect(self.instrumentSelected) self.fast.stateChanged.connect(self.updateFast) self.buttonMask.clicked.connect(self.loadMaskFromFile) + self.editEi.textEdited.connect(self.checkValidInputs) #call instrumentSelected once self.instrumentSelected(self.instrument) #connect goniometer change with figure @@ -326,6 +327,12 @@ class InstrumentSetupWidget(QtGui.QWidget): if not fileName: return self.editMask.setText(QString(fileName)) + self.setMaskFile() + + def setMaskFile(self): + filename=str(self.editMask.text()) + d={'maskFilename':filename} + self.updateAll(**d) def checkValidInputs(self, *dummy_args, **dummy_kwargs): sender = self.sender()