Skip to content
Snippets Groups Projects
Commit 06b4d629 authored by Elliot Oram's avatar Elliot Oram
Browse files

Ensure calculate binning only runs with valid input

Refs #16259
parent 3850a9b4
No related branches found
No related tags found
No related merge requests found
......@@ -205,10 +205,10 @@ bool Iqt::validate() {
uiv.checkDataSelectorIsValid("Sample", m_uiForm.dsInput);
uiv.checkDataSelectorIsValid("Resolution", m_uiForm.dsResolution);
const auto eMin = m_dblManager->value(m_properties["ELow"]);
const auto eMax = m_dblManager->value(m_properties["EHigh"]);
if (eMin >= eMax)
uiv.addErrorMessage("EMin must be strictly less than EMax.\n");
const auto eLow = m_dblManager->value(m_properties["ELow"]);
const auto eHigh = m_dblManager->value(m_properties["EHigh"]);
if (eLow >= eHigh)
uiv.addErrorMessage("ELow must be strictly less than EHigh.\n");
QString message = uiv.generateErrorMessage();
showMessageBox(message);
......@@ -257,9 +257,6 @@ void Iqt::updatePropertyValues(QtProperty *prop, double val) {
void Iqt::calculateBinning() {
using namespace Mantid::API;
disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updatePropertyValues(QtProperty *, double)));
QString wsName = m_uiForm.dsInput->getCurrentDataName();
QString resName = m_uiForm.dsResolution->getCurrentDataName();
if (wsName.isEmpty() || resName.isEmpty())
......@@ -268,8 +265,11 @@ void Iqt::calculateBinning() {
double energyMin = m_dblManager->value(m_properties["ELow"]);
double energyMax = m_dblManager->value(m_properties["EHigh"]);
double numBins = m_dblManager->value(m_properties["SampleBinning"]);
if (numBins == 0)
return;
if (energyMin == 0 && energyMax == 0)
return;
IAlgorithm_sptr furyAlg =
AlgorithmManager::Instance().create("TransformToIqt");
......@@ -297,6 +297,9 @@ void Iqt::calculateBinning() {
int sampleBins = propsTable->getColumn("SampleOutputBins")->cell<int>(0);
int resolutionBins = propsTable->getColumn("ResolutionBins")->cell<int>(0);
disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updatePropertyValues(QtProperty *, double)));
// Update data in property editor
m_dblManager->setValue(m_properties["EWidth"], energyWidth);
m_dblManager->setValue(m_properties["ResolutionBins"], resolutionBins);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment