Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #9213. Massive re-factoring of the Baseline Modelling step
It now follows MVC patter much stricter - we have a model which handles the data, a very thin view which displays stuff, and presenter which glues those two together. Both model and view have intermediate interfaces which allow to test presenter throughlty. Model is tested independently as well.
- Loading branch information
1 parent
ce9afc4
commit 6d7b24c
Showing
13 changed files
with
687 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...d/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingModel.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#ifndef MANTID_CUSTOMINTERFACES_ALCBASELINEMODELLINGMODEL_H_ | ||
#define MANTID_CUSTOMINTERFACES_ALCBASELINEMODELLINGMODEL_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidQtCustomInterfaces/DllConfig.h" | ||
|
||
#include "MantidQtCustomInterfaces/Muon/IALCBaselineModellingModel.h" | ||
|
||
using namespace Mantid::API; | ||
|
||
namespace MantidQt | ||
{ | ||
namespace CustomInterfaces | ||
{ | ||
/** ALCBaselineModellingModel : Concrete ALC Baseline Modelling step model implementation. | ||
Copyright © 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class DLLExport ALCBaselineModellingModel : public IALCBaselineModellingModel | ||
{ | ||
public: | ||
/// @see IALCBaselineModellingModel::setData | ||
void setData(MatrixWorkspace_const_sptr data) { m_data = data; } | ||
/// @see IALCBaselineModellingModel::data | ||
MatrixWorkspace_const_sptr data() const { return m_data; } | ||
|
||
/// @see IALCBaselineModellingModel::fit | ||
void fit(IFunction_const_sptr function, const std::vector<Section> §ions); | ||
|
||
/// @see IALCBaselineModellingModel::fittedFunction | ||
IFunction_const_sptr fittedFunction() const { return m_fittedFunction; } | ||
|
||
/// @see IALCBaselineModellingModel::correctedData | ||
MatrixWorkspace_const_sptr correctedData() const { return m_correctedData; } | ||
|
||
private: | ||
/// Data to use for fitting | ||
MatrixWorkspace_const_sptr m_data; | ||
|
||
/// Corrected data of the last fit | ||
MatrixWorkspace_const_sptr m_correctedData; | ||
|
||
/// Result function of the last fit | ||
IFunction_const_sptr m_fittedFunction; | ||
|
||
/// Disables points which shouldn't be used for fitting | ||
static void disableUnwantedPoints(MatrixWorkspace_sptr ws, const std::vector<Section>& sections); | ||
}; | ||
|
||
} // namespace CustomInterfaces | ||
} // namespace MantidQt | ||
|
||
#endif /* MANTID_CUSTOMINTERFACES_ALCBASELINEMODELLINGMODEL_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
.../MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCBaselineModellingModel.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#ifndef MANTID_CUSTOMINTERFACES_IALCBASELINEMODELLINGMODEL_H_ | ||
#define MANTID_CUSTOMINTERFACES_IALCBASELINEMODELLINGMODEL_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
|
||
#include "MantidAPI/MatrixWorkspace.h" | ||
#include "MantidAPI/IFunction.h" | ||
|
||
using namespace Mantid::API; | ||
|
||
namespace MantidQt | ||
{ | ||
namespace CustomInterfaces | ||
{ | ||
|
||
/** IALCBaselineModellingModel : Model interface for ALC BaselineModelling step | ||
Copyright © 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class DLLExport IALCBaselineModellingModel | ||
{ | ||
public: | ||
typedef std::pair<double, double> Section; | ||
|
||
/** | ||
* @return Function produced by the last fit | ||
*/ | ||
virtual IFunction_const_sptr fittedFunction() const = 0; | ||
|
||
/** | ||
* @return Corrected data produced by the last fit | ||
*/ | ||
virtual MatrixWorkspace_const_sptr correctedData() const = 0; | ||
|
||
/** | ||
* @return Current data used for fitting | ||
*/ | ||
virtual MatrixWorkspace_const_sptr data() const = 0; | ||
|
||
/** | ||
* @param data :: New data which will be used for fit | ||
*/ | ||
virtual void setData(MatrixWorkspace_const_sptr data) = 0; | ||
|
||
/** | ||
* Perform a fit using current data and specified function and sections. Modified values returned | ||
* by fittedFunction and correctedData. | ||
* @param function :: Function to fit | ||
* @param sections :: Data sections to include in the fit | ||
*/ | ||
virtual void fit(IFunction_const_sptr function, const std::vector<Section>& sections) = 0; | ||
|
||
}; | ||
|
||
} // namespace CustomInterfaces | ||
} // namespace MantidQt | ||
|
||
#endif /* MANTID_CUSTOMINTERFACES_IALCBASELINEMODELLINGMODEL_H_ */ |
Oops, something went wrong.