Skip to content

Commit

Permalink
Merge pull request #679 from mantidproject/11654_respect_qmin_qmax_in…
Browse files Browse the repository at this point in the history
…_new_refl_ui

Respect qmin & qmax limits in new Reflectometry UI
  • Loading branch information
FedeMPouzols committed May 20, 2015
2 parents 3936193 + e152e7b commit b70386f
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,25 @@ namespace MantidQt
m_tableDirty = true;
}

//We need to make sure that qmin and qmax are respected, so we rebin to
//those limits here.
IAlgorithm_sptr algCrop = AlgorithmManager::Instance().create("Rebin");
algCrop->initialize();
algCrop->setProperty("InputWorkspace", "IvsQ_" + runNo);
algCrop->setProperty("OutputWorkspace", "IvsQ_" + runNo);
const double qmin = m_model->data(m_model->index(rowNo, COL_QMIN)).toDouble();
const double qmax = m_model->data(m_model->index(rowNo, COL_QMAX)).toDouble();
const double dqq = m_model->data(m_model->index(rowNo, COL_DQQ)).toDouble();
std::vector<double> params;
params.push_back(qmin);
params.push_back(-dqq);
params.push_back(qmax);
algCrop->setProperty("Params", params);
algCrop->execute();

if(!algCrop->isExecuted())
throw std::runtime_error("Failed to run Rebin algorithm");

//Also fill in theta if needed
if(m_model->data(m_model->index(rowNo, COL_ANGLE)).toString().isEmpty() && thetaGiven)
m_model->setData(m_model->index(rowNo, COL_ANGLE), theta);
Expand Down

0 comments on commit b70386f

Please sign in to comment.