Skip to content

Commit

Permalink
Re #12398 Display errors in corrected curve (BaselineModelling step)
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelalvarezbanos committed Jun 15, 2015
1 parent 6343dc6 commit 45264c3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ namespace CustomInterfaces
public slots:
void initialize();
void setDataCurve(const QwtData &data, const std::vector<double> &errors);
void setCorrectedCurve(const QwtData& data);
void setCorrectedCurve(const QwtData &data,
const std::vector<double> &errors);
void setBaselineCurve(const QwtData& data);
void setFunction(Mantid::API::IFunction_const_sptr func);
void setNoOfSectionRows(int rows);
Expand Down Expand Up @@ -98,7 +99,8 @@ namespace CustomInterfaces
QwtPlotCurve *m_dataCurve, *m_fitCurve, *m_correctedCurve;

/// Error curves
MantidQt::MantidWidgets::ErrorCurve *m_dataErrorCurve;
MantidQt::MantidWidgets::ErrorCurve *m_dataErrorCurve,
*m_correctedErrorCurve;

/// Range selectors
std::map<int, RangeSelector*> m_rangeSelectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ namespace CustomInterfaces
* Update displayed corrected data curve
* @param data :: New curve data
*/
virtual void setCorrectedCurve(const QwtData& data) = 0;
virtual void setCorrectedCurve(const QwtData &data,
const std::vector<double> &errors) = 0;

/**
* Update displayed baseline curve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,13 @@ namespace CustomInterfaces
{
if(MatrixWorkspace_const_sptr correctedData = m_model->correctedData())
{
m_view->setCorrectedCurve(*(ALCHelper::curveDataFromWs(correctedData, 0)));
m_view->setCorrectedCurve(*(ALCHelper::curveDataFromWs(correctedData, 0)),
ALCHelper::curveErrorsFromWs(correctedData, 0));
}
else
{
m_view->setCorrectedCurve(*(ALCHelper::emptyCurveData()));
m_view->setCorrectedCurve(*(ALCHelper::emptyCurveData()),
std::vector<double>());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,25 @@ namespace CustomInterfaces
ALCBaselineModellingView::ALCBaselineModellingView(QWidget* widget)
: m_widget(widget), m_ui(),
m_dataCurve(new QwtPlotCurve()), m_fitCurve(new QwtPlotCurve()),
m_dataErrorCurve(NULL), m_correctedCurve(new QwtPlotCurve()), m_rangeSelectors(),
m_correctedCurve(new QwtPlotCurve()), m_dataErrorCurve(NULL),
m_correctedErrorCurve(NULL), m_rangeSelectors(),
m_selectorModifiedMapper(new QSignalMapper(this))
{}

ALCBaselineModellingView::~ALCBaselineModellingView()
{
m_dataCurve->detach();
delete m_dataCurve;
m_correctedCurve->detach();
delete m_correctedCurve;
if (m_dataErrorCurve) {
m_dataErrorCurve->detach();
delete m_dataErrorCurve;
}
if (m_correctedErrorCurve) {
m_correctedErrorCurve->detach();
delete m_correctedErrorCurve;
}
}

void ALCBaselineModellingView::initialize()
Expand Down Expand Up @@ -122,9 +129,22 @@ namespace CustomInterfaces
m_ui.dataPlot->replot();
}

void ALCBaselineModellingView::setCorrectedCurve(const QwtData &data)
void ALCBaselineModellingView::setCorrectedCurve(
const QwtData &data, const std::vector<double> &errors)
{
// Set data
m_correctedCurve->setData(data);

// Set errors
if (m_correctedErrorCurve) {
m_correctedErrorCurve->detach();
delete m_correctedErrorCurve;
}
m_correctedErrorCurve =
new MantidQt::MantidWidgets::ErrorCurve(m_correctedCurve, errors);
m_correctedErrorCurve->attach(m_ui.dataPlot);

// Replot
m_ui.correctedPlot->replot();
}

Expand Down

0 comments on commit 45264c3

Please sign in to comment.