Skip to content
Snippets Groups Projects
Commit f6b577da authored by Matthew Andrew's avatar Matthew Andrew
Browse files

Corrected resolution spectrum error Re #28123

When you updated the spectra of interest after loading the data the resolution spectra to use were not updated this corrects  this issue.
parent aefad272
No related branches found
No related tags found
No related merge requests found
......@@ -399,13 +399,13 @@ void ConvFitModel::addWorkspace(MatrixWorkspace_sptr workspace,
const Spectra &spectra) {
IndirectFittingModel::addWorkspace(workspace, spectra);
const auto dataSize = numberOfWorkspaces();
if (m_resolution.size() < dataSize)
m_resolution.emplace_back(MatrixWorkspace_sptr());
else if (m_resolution.size() == dataSize &&
m_resolution[dataSize - TableDatasetIndex{1}].lock() &&
m_extendedResolution.size() < dataSize)
addExtendedResolution(dataSize - TableDatasetIndex{1});
// const auto dataSize = numberOfWorkspaces();
// if (m_resolution.size() < dataSize)
// m_resolution.emplace_back(MatrixWorkspace_sptr());
// else if (m_resolution.size() == dataSize &&
// m_resolution[dataSize - TableDatasetIndex{1}].lock() &&
// m_extendedResolution.size() < dataSize)
// addExtendedResolution(dataSize - TableDatasetIndex{1});
}
void ConvFitModel::removeWorkspace(TableDatasetIndex index) {
......
......@@ -48,7 +48,8 @@ public:
void addOutput(Mantid::API::IAlgorithm_sptr fitAlgorithm) override;
std::vector<std::pair<std::string, int>> getResolutionsForFit() const;
std::vector<std::pair<std::string, int>>
getResolutionsForFit() const override;
private:
Mantid::API::IAlgorithm_sptr sequentialFitAlgorithm() const override;
......
......@@ -709,7 +709,8 @@ QStringList IndirectFitAnalysisTab::getDatasetNames() const {
void IndirectFitAnalysisTab::updateDataReferences() {
m_fitPropertyBrowser->updateFunctionBrowserData(
m_fittingModel->getNumberOfDomains(), getDatasetNames(),
m_fittingModel->getQValuesForData());
m_fittingModel->getQValuesForData(),
m_fittingModel->getResolutionsForFit());
m_fittingModel->setFitFunction(m_fitPropertyBrowser->getFittingFunction());
}
......@@ -734,7 +735,8 @@ void IndirectFitAnalysisTab::respondToChangeOfSpectraRange(
m_dataPresenter->updateSpectraInTable(i);
m_fitPropertyBrowser->updateFunctionBrowserData(
m_fittingModel->getNumberOfDomains(), getDatasetNames(),
m_fittingModel->getQValuesForData());
m_fittingModel->getQValuesForData(),
m_fittingModel->getResolutionsForFit());
setModelFitFunction();
updateParameterEstimationData();
}
......
......@@ -354,12 +354,14 @@ TableRowIndex IndirectFitPropertyBrowser::currentDataset() const {
void IndirectFitPropertyBrowser::updateFunctionBrowserData(
TableRowIndex nData, const QStringList &datasetNames,
const std::vector<double> &qValues) {
const std::vector<double> &qValues,
const std::vector<std::pair<std::string, int>> &fitResolutions) {
m_functionBrowser->setNumberOfDatasets(nData.value);
m_functionBrowser->setDatasetNames(datasetNames);
m_templateBrowser->setNumberOfDatasets(nData.value);
m_templateBrowser->setDatasetNames(datasetNames);
m_templateBrowser->setQValues(qValues);
m_templateBrowser->setResolution(fitResolutions);
}
void IndirectFitPropertyBrowser::setFitEnabled(bool) {}
......
......@@ -63,9 +63,10 @@ public:
void setFitEnabled(bool enable);
void setCurrentDataset(TableRowIndex i);
TableRowIndex currentDataset() const;
void updateFunctionBrowserData(TableRowIndex nData,
const QStringList &datasetNames,
const std::vector<double> &qValues);
void updateFunctionBrowserData(
TableRowIndex nData, const QStringList &datasetNames,
const std::vector<double> &qValues,
const std::vector<std::pair<std::string, int>> &fitResolutions);
void updatePlotGuess(MatrixWorkspace_const_sptr sampleWorkspace);
void setErrorsEnabled(bool enabled);
void
......
......@@ -965,6 +965,11 @@ std::vector<double> IndirectFittingModel::getQValuesForData() const {
return qValues;
}
std::vector<std::pair<std::string, int>>
IndirectFittingModel::getResolutionsForFit() const {
return std::vector<std::pair<std::string, int>>();
}
} // namespace IDA
} // namespace CustomInterfaces
} // namespace MantidQt
......@@ -143,6 +143,7 @@ public:
getDataForParameterEstimation(EstimationDataSelector selector) const;
std::vector<double> getQValuesForData() const;
virtual std::vector<std::pair<std::string, int>> getResolutionsForFit() const;
protected:
Mantid::API::IAlgorithm_sptr getFittingAlgorithm(FittingMode mode) const;
......
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