diff --git a/Framework/Crystal/src/FilterPeaks.cpp b/Framework/Crystal/src/FilterPeaks.cpp index 7c2540a4efa2fb7fc3da9b57eb74949874caecef..374e0812b72cafeb124a45bcdc96c26794230295 100644 --- a/Framework/Crystal/src/FilterPeaks.cpp +++ b/Framework/Crystal/src/FilterPeaks.cpp @@ -12,6 +12,10 @@ double HKL2(const Mantid::Geometry::IPeak &p) { return p.getH() * p.getH() + p.getK() * p.getK() + p.getL() * p.getL(); } +double QMOD(const Mantid::Geometry::IPeak &p) { + return p.getQSampleFrame().norm(); +} + double intensity(const Mantid::Geometry::IPeak &p) { return p.getIntensity(); } double SN(const Mantid::Geometry::IPeak &p) { @@ -61,6 +65,7 @@ void FilterPeaks::init() { filters.push_back("h^2+k^2+l^2"); filters.push_back("Intensity"); filters.push_back("Signal/Noise"); + filters.push_back("QMod"); declareProperty("FilterVariable", "", boost::make_shared<StringListValidator>(filters), "The variable on which to filter the peaks"); @@ -98,6 +103,8 @@ void FilterPeaks::exec() { filterFunction = &intensity; else if (FilterVariable == "Signal/Noise") filterFunction = &SN; + else if (FilterVariable == "QMod") + filterFunction = &QMOD; else throw std::invalid_argument("Unknown FilterVariable: " + FilterVariable); diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfQ3D.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfQ3D.h index 1db019647c7af7bddf7d27bef8b6cb847c481c8d..8c63d3573d746cea5370cba35f0db997f17e2e8e 100644 --- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfQ3D.h +++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDTransfQ3D.h @@ -99,6 +99,9 @@ protected: // and used to calculate Lorentz corrections double m_SinThetaSq; // all other variables are the same as in ModQ + // hole near origin of Q + double m_AbsMin; + private: /// how to transform workspace data in elastic case inline bool calcMatrixCoord3DElastic(const double &k0, diff --git a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDWSDescription.h b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDWSDescription.h index 6a9a0ddc1b9d0ba8d25ee069ac9da7165d08229a..a6a1bedef75da1a86a132cb9870b83495e1846d8 100644 --- a/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDWSDescription.h +++ b/Framework/MDAlgorithms/inc/MantidMDAlgorithms/MDWSDescription.h @@ -93,6 +93,7 @@ public: // for the time being /**check if one needs to perform Lorentz corrections */ bool isLorentsCorrections() const { return m_LorentzCorr; } + double absMin() const { return m_AbsMin; } void getMinMax(std::vector<double> &min, std::vector<double> &max) const; std::vector<double> getTransfMatrix() const { return m_RotMatrix; } @@ -138,6 +139,7 @@ public: // for the time being void setDimUnit(unsigned int nDim, const std::string &Unit); /** do we need to perform Lorentz corrections */ void setLorentsCorr(bool On = false) { m_LorentzCorr = On; } + void setAbsMin(double absMin) { m_AbsMin = absMin; } // static helper functions: /// helper function checks if min values are less them max values and are /// consistent between each other @@ -177,6 +179,8 @@ protected: // until MDWSDesctiptionDepricatedExist Kernel::DeltaEMode::Type m_Emode; /// if one needs to calculate Lorentz corrections bool m_LorentzCorr; + /// hole near origin of Q + double m_AbsMin; /// the vector of MD coordinates, which are obtained from workspace /// properties. std::vector<coord_t> m_AddCoord; diff --git a/Framework/MDAlgorithms/src/ConvertToMD.cpp b/Framework/MDAlgorithms/src/ConvertToMD.cpp index 375e4467d683893bf65dd0f2a736b58f3bb5cf2c..7cdeff300d7abe76168a2a1e2658ce0394e1b5c5 100644 --- a/Framework/MDAlgorithms/src/ConvertToMD.cpp +++ b/Framework/MDAlgorithms/src/ConvertToMD.cpp @@ -402,6 +402,9 @@ bool ConvertToMD::buildTargetWSDescription( bool LorentzCorrections = getProperty("LorentzCorrection"); targWSDescr.setLorentsCorr(LorentzCorrections); + double m_AbsMin = getProperty("AbsMinQ"); + targWSDescr.setAbsMin(m_AbsMin); + // instantiate class, responsible for defining Mslice-type projection MDAlgorithms::MDWSTransform MsliceProj; // identify if u,v are present among input parameters and use defaults if not diff --git a/Framework/MDAlgorithms/src/ConvertToMDParent.cpp b/Framework/MDAlgorithms/src/ConvertToMDParent.cpp index 26fa03786e3805d1615d83f0e9bfcff890040b19..5defd33c0d811672f108418d7f13ca8d30bb0b2f 100644 --- a/Framework/MDAlgorithms/src/ConvertToMDParent.cpp +++ b/Framework/MDAlgorithms/src/ConvertToMDParent.cpp @@ -175,6 +175,12 @@ void ConvertToMDParent::init() { // value is still not fully verified (see ticket #5982). " "Defines the third projection vector of the target Q " "coordinate system in **Q3D** mode. - Default (0,0,1)"); + // if one needs no events near the origin of Q + declareProperty( + new PropertyWithValue<double>("AbsMinQ", 0.0, Direction::Input), + "Do not add events to MD workspace that are closer to the origin " + "in QSample radius than this value. Needed for 3D" + "views to remove noise. "); } /**The method responsible for analyzing input workspace parameters and *preprocessing detectors positions into reciprocal space diff --git a/Framework/MDAlgorithms/src/MDTransfQ3D.cpp b/Framework/MDAlgorithms/src/MDTransfQ3D.cpp index 6ea22f885e9c51584aa55d1df4e02f8895902477..3a79ff96bc4584f006cd49ae3803944af1e2ac36 100644 --- a/Framework/MDAlgorithms/src/MDTransfQ3D.cpp +++ b/Framework/MDAlgorithms/src/MDTransfQ3D.cpp @@ -90,6 +90,10 @@ bool MDTransfQ3D::calcMatrixCoord3DInelastic( if (Coord[2] < m_DimMin[2] || Coord[2] >= m_DimMax[2]) return false; + if (std::sqrt(Coord[0] * Coord[0] + Coord[1] * Coord[1] + + Coord[2] * Coord[2]) < m_AbsMin) + return false; + return true; } /** function calculates workspace-dependent coordinates in elastic case. @@ -116,7 +120,6 @@ bool MDTransfQ3D::calcMatrixCoord3DElastic(const double &k0, double qx = -m_ex * k0; double qy = -m_ey * k0; double qz = (1 - m_ez) * k0; - Coord[0] = (coord_t)(m_RotMat[0] * qx + m_RotMat[1] * qy + m_RotMat[2] * qz); if (Coord[0] < m_DimMin[0] || Coord[0] >= m_DimMax[0]) return false; @@ -129,6 +132,10 @@ bool MDTransfQ3D::calcMatrixCoord3DElastic(const double &k0, if (Coord[2] < m_DimMin[2] || Coord[2] >= m_DimMax[2]) return false; + if (std::sqrt(Coord[0] * Coord[0] + Coord[1] * Coord[1] + + Coord[2] * Coord[2]) < m_AbsMin) + return false; + /*Apply Lorentz corrections if necessary */ if (m_isLorentzCorrected) { double kdash = k0 / (2 * M_PI); @@ -246,6 +253,7 @@ void MDTransfQ3D::initialize(const MDWSDescription &ConvParams) { } // use detectors masks untill signals are masked by 0 instead of NaN m_pDetMasks = ConvParams.m_PreprDetTable->getColDataArray<int>("detMask"); + m_AbsMin = ConvParams.absMin(); } /**method returns default ID-s for ModQ elastic and inelastic modes. The ID-s are related to the units, @@ -311,7 +319,7 @@ MDTransfQ3D::outputUnitID(Kernel::DeltaEMode::Type dEmode, /// constructor; MDTransfQ3D::MDTransfQ3D() : m_isLorentzCorrected(false), m_SinThetaSqArray(NULL), SinThetaSq(), - m_SinThetaSq(0.) {} + m_SinThetaSq(0.), m_AbsMin(0.) {} } // End MDAlgorighms namespace } // End Mantid namespace diff --git a/Framework/MDAlgorithms/src/MDWSDescription.cpp b/Framework/MDAlgorithms/src/MDWSDescription.cpp index 60c9681ee3f5b1a3ae4732076657c1e7e1d7a86d..74f68df4967c256c0dbe45db3d31b7179f8d9564 100644 --- a/Framework/MDAlgorithms/src/MDWSDescription.cpp +++ b/Framework/MDAlgorithms/src/MDWSDescription.cpp @@ -181,6 +181,7 @@ void MDWSDescription::setUpMissingParameters( m_InWS = SourceMatrWS.m_InWS; m_Emode = SourceMatrWS.m_Emode; m_LorentzCorr = SourceMatrWS.m_LorentzCorr; + m_AbsMin = SourceMatrWS.m_AbsMin; this->AlgID = SourceMatrWS.AlgID; m_AddCoord.assign(SourceMatrWS.m_AddCoord.begin(), @@ -242,7 +243,7 @@ void MDWSDescription::checkWSCorresponsMDWorkspace( MDWSDescription::MDWSDescription(unsigned int nDimensions) : m_Wtransf(3, 3, true), m_RotMatrix(9, 0), m_buildingNewWorkspace(true), m_Emode(Kernel::DeltaEMode::Undefined), m_LorentzCorr(false), - m_coordinateSystem(Mantid::Kernel::None) { + m_AbsMin(0.), m_coordinateSystem(Mantid::Kernel::None) { this->resizeDimDescriptions(nDimensions); m_DimMin.assign(m_NDims, std::numeric_limits<double>::quiet_NaN()); diff --git a/Framework/MDAlgorithms/test/ConvertToMDTest.h b/Framework/MDAlgorithms/test/ConvertToMDTest.h index 2caba5494cac06902e02e8d7a39f37644d512746..12c2eaff3b33a468a40978fdcb0669671c06fe02 100644 --- a/Framework/MDAlgorithms/test/ConvertToMDTest.h +++ b/Framework/MDAlgorithms/test/ConvertToMDTest.h @@ -57,7 +57,7 @@ public: TS_ASSERT_THROWS_NOTHING(pAlg->initialize()) TS_ASSERT(pAlg->isInitialized()) - TSM_ASSERT_EQUALS("algorithm should have 22 properties", 22, + TSM_ASSERT_EQUALS("algorithm should have 23 properties", 23, (size_t)(pAlg->getProperties().size())); } diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEV.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEV.h index d521c6f5df8cd3f1a374792c42cad55cefb69eef..0572e52ccbbcf1439b82415b54bf9aa506cb08e1 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEV.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEV.h @@ -39,6 +39,7 @@ class RunLoadAndConvertToMD : public QRunnable const std::string & file_name, const std::string & ev_ws_name, const std::string & md_ws_name, + const double modQ, const double minQ, const double maxQ, const bool do_lorentz_corr, @@ -55,6 +56,7 @@ class RunLoadAndConvertToMD : public QRunnable std::string file_name; std::string ev_ws_name; std::string md_ws_name; + double modQ; double minQ; double maxQ; bool do_lorentz_corr; @@ -77,7 +79,9 @@ class RunFindPeaks : public QRunnable const std::string & peaks_ws_name, double max_abc, size_t num_to_find, - double min_intensity ); + double min_intensity, + double minQPeaks, + double maxQPeaks); /// Calls worker->findPeaks from a separate thread void run(); @@ -90,6 +94,8 @@ class RunFindPeaks : public QRunnable double max_abc; size_t num_to_find; double min_intensity; + double minQPeaks; + double maxQPeaks; }; /// Local class to run PredictPeaks in a Non-Qt thread. diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEV.ui b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEV.ui index 444a801ee7c1922ac59b39bed0e278bb2ec0724b..148cf977be72e4771fba5bc2a2cab164a9956985 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEV.ui +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEV.ui @@ -146,7 +146,7 @@ </widget> </item> <item> - <spacer name="horizontalSpacer_6"> + <spacer name="horizontalSpacer_611"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> @@ -245,6 +245,49 @@ <property name="sizeConstraint"> <enum>QLayout::SetDefaultConstraint</enum> </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_41"> + <item> + <widget class="QLabel" name="ModQ_lbl"> + <property name="text"> + <string>Min ModQ to Map to MD</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_511"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLineEdit" name="ModQ_ledt"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Specify value to use as lower bound of ModQ for hole near origin</string> + </property> + </widget> + </item> + </layout> + </item> <item> <layout class="QHBoxLayout" name="horizontalLayout_3"> <item> @@ -840,6 +883,112 @@ </item> </layout> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_113"> + <item> + <spacer name="horizontalSpacer_112"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>15</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="MinQPeaks_lbl"> + <property name="text"> + <string>Min ModQ</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_116"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLineEdit" name="MinQPeaks_ledt"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Lower bound on mod Q for peaks.</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_213"> + <item> + <spacer name="horizontalSpacer_212"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>15</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="MaxQPeaks_lbl"> + <property name="text"> + <string>Max ModQ</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_216"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLineEdit" name="MaxQPeaks_ledt"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Upper bound on mod Q for peaks.</string> + </property> + </widget> + </item> + </layout> + </item> <item> <widget class="QRadioButton" name="UseExistingPeaksWorkspace_rbtn"> <property name="toolTip"> diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEVWorker.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEVWorker.h index c1f4c9b00a26930e661832b3baca69afcd10c6bf..8bf454e5a492cc38f6ccd586e417c80a7cc4f3d5 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEVWorker.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MantidEVWorker.h @@ -68,6 +68,7 @@ public: bool loadAndConvertToMD(const std::string & file_name, const std::string & ev_ws_name, const std::string & md_ws_name, + const double modQ, const double minQ, const double maxQ, const bool do_lorentz_corr, @@ -82,7 +83,9 @@ public: const std::string & peaks_ws_name, double max_abc, size_t num_to_find, - double min_intensity ); + double min_intensity, + double minQPeaks, + double maxQPeaks ); /// Predict peaks and overwrite the peaks workspace bool predictPeaks( const std::string & peaks_ws_name, diff --git a/MantidQt/CustomInterfaces/src/MantidEV.cpp b/MantidQt/CustomInterfaces/src/MantidEV.cpp index e13ab5d3e19be94d2dd10cf73a65f3d73cde9a95..01dfb933afa7e5a9a7edc61348cc47c27c7a7037 100644 --- a/MantidQt/CustomInterfaces/src/MantidEV.cpp +++ b/MantidQt/CustomInterfaces/src/MantidEV.cpp @@ -30,6 +30,7 @@ RunLoadAndConvertToMD::RunLoadAndConvertToMD(MantidEVWorker * worker, const std::string & file_name, const std::string & ev_ws_name, const std::string & md_ws_name, + const double modQ, const double minQ, const double maxQ, const bool do_lorentz_corr, @@ -39,7 +40,7 @@ RunLoadAndConvertToMD::RunLoadAndConvertToMD(MantidEVWorker * worker, const std::string & det_cal_file2 ) : worker(worker), file_name(file_name), ev_ws_name(ev_ws_name), md_ws_name(md_ws_name), - minQ(minQ), maxQ(maxQ), do_lorentz_corr(do_lorentz_corr), + modQ(modQ), minQ(minQ), maxQ(maxQ), do_lorentz_corr(do_lorentz_corr), load_data(load_data), load_det_cal(load_det_cal), det_cal_file(det_cal_file), det_cal_file2(det_cal_file2) { @@ -48,7 +49,7 @@ RunLoadAndConvertToMD::RunLoadAndConvertToMD(MantidEVWorker * worker, void RunLoadAndConvertToMD::run() { worker->loadAndConvertToMD( file_name, ev_ws_name, md_ws_name, - minQ, maxQ, do_lorentz_corr, load_data, + modQ, minQ, maxQ, do_lorentz_corr, load_data, load_det_cal, det_cal_file, det_cal_file2 ); } @@ -61,7 +62,9 @@ RunFindPeaks::RunFindPeaks( MantidEVWorker * worker, const std::string & peaks_ws_name, double max_abc, size_t num_to_find, - double min_intensity ) + double min_intensity, + double minQPeaks, + double maxQPeaks) { this->worker = worker; this->ev_ws_name = ev_ws_name; @@ -70,6 +73,8 @@ RunFindPeaks::RunFindPeaks( MantidEVWorker * worker, this->max_abc = max_abc; this->num_to_find = num_to_find; this->min_intensity = min_intensity; + this->minQPeaks = minQPeaks; + this->maxQPeaks = maxQPeaks; } @@ -79,7 +84,7 @@ RunFindPeaks::RunFindPeaks( MantidEVWorker * worker, void RunFindPeaks::run() { worker->findPeaks( ev_ws_name, md_ws_name, peaks_ws_name, - max_abc, num_to_find, min_intensity ); + max_abc, num_to_find, min_intensity, minQPeaks, maxQPeaks ); } /** @@ -434,6 +439,7 @@ void MantidEV::setDefaultState_slot() m_uiForm.loadDataGroupBox->setChecked(true); m_uiForm.EventFileName_ledt->setText(""); m_uiForm.MaxMagQ_ledt->setText("25"); + m_uiForm.ModQ_ledt->setText("0"); m_uiForm.LorentzCorrection_ckbx->setChecked(true); setEnabledLoadEventFileParams_slot(true); m_uiForm.LoadDetCal_ckbx->setChecked(false); @@ -585,6 +591,9 @@ void MantidEV::selectWorkspace_slot() } } + double modQ; + getDouble( m_uiForm.ModQ_ledt, modQ ); + double minQ; getDouble( m_uiForm.MinMagQ_ledt, minQ ); @@ -602,7 +611,7 @@ void MantidEV::selectWorkspace_slot() RunLoadAndConvertToMD* runner = new RunLoadAndConvertToMD(worker,file_name, ev_ws_name, md_ws_name, - minQ, maxQ, + modQ, minQ, maxQ, m_uiForm.LorentzCorrection_ckbx->isChecked(), m_uiForm.loadDataGroupBox->isChecked(), load_det_cal, det_cal_file, det_cal_file2 ); @@ -753,10 +762,18 @@ void MantidEV::findPeaks_slot() if ( !getPositiveDouble( m_uiForm.MinIntensity_ledt, min_intensity ) ) return; + + double minQPeaks; + getDouble( m_uiForm.MinQPeaks_ledt, minQPeaks ); + + double maxQPeaks; + getDouble( m_uiForm.MaxQPeaks_ledt, maxQPeaks ); + std::string ev_ws_name = m_uiForm.SelectEventWorkspace_ledt->text().trimmed().toStdString(); RunFindPeaks* runner = new RunFindPeaks( worker, ev_ws_name, md_ws_name, peaks_ws_name, - max_abc, num_to_find, min_intensity ); + max_abc, num_to_find, min_intensity, + minQPeaks, maxQPeaks); bool running = m_thread_pool->tryStart( runner ); if ( !running ) @@ -1694,6 +1711,8 @@ void MantidEV::setEnabledFindPeaksParams_slot( bool on ) m_uiForm.NumToFind_ledt->setEnabled( on ); m_uiForm.MinIntensity_lbl->setEnabled( on ); m_uiForm.MinIntensity_ledt->setEnabled( on ); + m_uiForm.MinQPeaks_ledt->setEnabled( on ); + m_uiForm.MaxQPeaks_ledt->setEnabled( on ); } /** @@ -2157,6 +2176,8 @@ void MantidEV::saveSettings( const std::string & filename ) state->setValue("MaxABC_ledt", m_uiForm.MaxABC_ledt->text()); state->setValue("NumToFind_ledt", m_uiForm.NumToFind_ledt->text()); state->setValue("MinIntensity_ledt", m_uiForm.MinIntensity_ledt->text()); + state->setValue("MinQPeaks_ledt", m_uiForm.MinQPeaks_ledt->text()); + state->setValue("MaxQPeaks_ledt", m_uiForm.MaxQPeaks_ledt->text()); state->setValue("UseExistingPeaksWorkspace_rbtn", m_uiForm.UseExistingPeaksWorkspace_rbtn->isChecked()); state->setValue("LoadIsawPeaks_rbtn", m_uiForm.LoadIsawPeaks_rbtn->isChecked()); state->setValue("SelectPeaksFile_ledt", m_uiForm.SelectPeaksFile_ledt->text()); @@ -2268,6 +2289,8 @@ void MantidEV::loadSettings( const std::string & filename ) restore( state, "MaxABC_ledt", m_uiForm.MaxABC_ledt ); restore( state, "NumToFind_ledt", m_uiForm.NumToFind_ledt ); restore( state, "MinIntensity_ledt", m_uiForm.MinIntensity_ledt ); + restore( state, "MinQPeaks_ledt", m_uiForm.MinQPeaks_ledt ); + restore( state, "MaxQPeaks_ledt", m_uiForm.MaxQPeaks_ledt ); restore( state, "UseExistingPeaksWorkspace_rbtn", m_uiForm.UseExistingPeaksWorkspace_rbtn ); restore( state, "LoadIsawPeaks_rbtn", m_uiForm.LoadIsawPeaks_rbtn ); restore( state, "SelectPeaksFile_ledt", m_uiForm.SelectPeaksFile_ledt ); diff --git a/MantidQt/CustomInterfaces/src/MantidEVWorker.cpp b/MantidQt/CustomInterfaces/src/MantidEVWorker.cpp index c38bb836d42d5fe42ad7b7f52b3e75ca628daf98..cade5b48a2350318806474499ac2e5468e7eea44 100644 --- a/MantidQt/CustomInterfaces/src/MantidEVWorker.cpp +++ b/MantidQt/CustomInterfaces/src/MantidEVWorker.cpp @@ -142,7 +142,9 @@ bool MantidEVWorker::isEventWorkspace( const std::string & event_ws_name ) * @param file_name Name of the NeXus file to load * @param ev_ws_name Name of the event workspace to create * @param md_ws_name Name of the MD workspace to create - * @param minQ The smallest absolute value of any component + * @param modQ The smallest absolute value of any component + * of Q to include. + * @param minQ The smallest value of any component * of Q to include. * @param maxQ The largest absolute value of any component * of Q to include. When ConvertToMD is called, @@ -163,6 +165,7 @@ bool MantidEVWorker::isEventWorkspace( const std::string & event_ws_name ) bool MantidEVWorker::loadAndConvertToMD( const std::string & file_name, const std::string & ev_ws_name, const std::string & md_ws_name, + const double modQ, const double minQ, const double maxQ, const bool do_lorentz_corr, @@ -215,6 +218,7 @@ bool MantidEVWorker::loadAndConvertToMD( const std::string & file_name, alg->setProperty("QConversionScales","Q in A^-1"); alg->setProperty("Q3DFrames","Q_sample"); alg->setProperty("LorentzCorrection",do_lorentz_corr); + alg->setProperty("AbsMinQ", modQ); alg->setProperty("MinValues",min_str.str()); alg->setProperty("MaxValues",max_str.str()); alg->setProperty("SplitInto","2"); @@ -256,7 +260,8 @@ bool MantidEVWorker::loadAndConvertToMD( const std::string & file_name, * MD box to be a possible peak. If this * is 10000, only boxes with intensity 10000 times * the average intensity will be considered. - * + * @param minQPeaks Filter with ModQ min + * @param maxQPeaks Filter with ModQmax * @return true if FindPeaksMD completed successfully. */ bool MantidEVWorker::findPeaks( const std::string & ev_ws_name, @@ -264,7 +269,9 @@ bool MantidEVWorker::findPeaks( const std::string & ev_ws_name, const std::string & peaks_ws_name, double max_abc, size_t num_to_find, - double min_intensity ) + double min_intensity, + double minQPeaks, + double maxQPeaks) { try { @@ -313,6 +320,29 @@ bool MantidEVWorker::findPeaks( const std::string & ev_ws_name, else peak.setMonitorCount( proton_charge ); } + + if (minQPeaks != Mantid::EMPTY_DBL()) + { + IAlgorithm_sptr filter_alg = AlgorithmManager::Instance().create("FilterPeaks"); + filter_alg->setProperty("InputWorkspace", peaks_ws ); + filter_alg->setProperty("FilterVariable", "QMod" ); + filter_alg->setProperty("FilterValue", minQPeaks ); + filter_alg->setProperty("Operator", ">" ); + filter_alg->setPropertyValue("OutputWorkspace", peaks_ws_name); + filter_alg->execute(); + peaks_ws = ADS.retrieveWS<IPeaksWorkspace>(peaks_ws_name); + } + if (maxQPeaks != Mantid::EMPTY_DBL()) + { + IAlgorithm_sptr filter_alg = AlgorithmManager::Instance().create("FilterPeaks"); + filter_alg->setProperty("InputWorkspace", peaks_ws ); + filter_alg->setProperty("FilterVariable", "QMod" ); + filter_alg->setProperty("FilterValue", maxQPeaks ); + filter_alg->setProperty("Operator", "<" ); + filter_alg->setPropertyValue("OutputWorkspace", peaks_ws_name ); + filter_alg->execute(); + peaks_ws = ADS.retrieveWS<IPeaksWorkspace>(peaks_ws_name); + } return true; } }