Skip to content

Commit

Permalink
Added new MSD and Fury plots
Browse files Browse the repository at this point in the history
Refs #11036
  • Loading branch information
DanNixon committed Feb 12, 2015
1 parent 043325d commit e1f908e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 52 deletions.
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>444</width>
<height>251</height>
<width>506</width>
<height>355</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -49,7 +49,7 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<layout class="QHBoxLayout" name="loElwinOptions">
<item>
<layout class="QVBoxLayout" name="properties"/>
</item>
Expand Down Expand Up @@ -91,43 +91,38 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="plot"/>
<widget class="MantidQt::MantidWidgets::PreviewPlot" name="ppPlot" native="true">
<property name="canvasColour" stdset="0">
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="3">
<spacer name="horizontalSpacer_28">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="loSampleLog">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>SE log name: </string>
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QLineEdit" name="leLogName">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_29">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
Expand Down Expand Up @@ -185,6 +180,12 @@
<extends>QWidget</extends>
<header>MantidQtMantidWidgets/MWRunFiles.h</header>
</customwidget>
<customwidget>
<class>MantidQt::MantidWidgets::PreviewPlot</class>
<extends>QWidget</extends>
<header>MantidQtMantidWidgets/PreviewPlot.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down
Expand Up @@ -113,7 +113,18 @@
<layout class="QVBoxLayout" name="properties"/>
</item>
<item>
<layout class="QVBoxLayout" name="plot"/>
<widget class="MantidQt::MantidWidgets::PreviewPlot" name="ppPlot" native="true">
<property name="canvasColour" stdset="0">
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</property>
<property name="showLegend" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
Expand Down Expand Up @@ -187,6 +198,12 @@
<extends>QWidget</extends>
<header>MantidQtMantidWidgets/DataSelector.h</header>
</customwidget>
<customwidget>
<class>MantidQt::MantidWidgets::PreviewPlot</class>
<extends>QWidget</extends>
<header>MantidQtMantidWidgets/PreviewPlot.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down
18 changes: 5 additions & 13 deletions Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Elwin.cpp
Expand Up @@ -63,26 +63,18 @@ namespace IDA
m_elwTree->addProperty(m_properties["BackgroundRange"]);
m_elwTree->addProperty(m_properties["Normalise"]);

// Create Slice Plot Widget for Range Selection
m_plots["ElwinPlot"] = new QwtPlot(m_parentWidget);
m_plots["ElwinPlot"]->setAxisFont(QwtPlot::xBottom, m_parentWidget->font());
m_plots["ElwinPlot"]->setAxisFont(QwtPlot::yLeft, m_parentWidget->font());
m_uiForm.plot->addWidget(m_plots["ElwinPlot"]);
m_plots["ElwinPlot"]->setCanvasBackground(Qt::white);
// We always want one range selector... the second one can be controlled from
// within the elwinTwoRanges(bool state) function
m_rangeSelectors["ElwinIntegrationRange"] = new MantidWidgets::RangeSelector(m_plots["ElwinPlot"]);
m_rangeSelectors["ElwinIntegrationRange"] = new MantidWidgets::RangeSelector(m_uiForm.ppPlot);
connect(m_rangeSelectors["ElwinIntegrationRange"], SIGNAL(minValueChanged(double)), this, SLOT(minChanged(double)));
connect(m_rangeSelectors["ElwinIntegrationRange"], SIGNAL(maxValueChanged(double)), this, SLOT(maxChanged(double)));
// create the second range
m_rangeSelectors["ElwinBackgroundRange"] = new MantidWidgets::RangeSelector(m_plots["ElwinPlot"]);
m_rangeSelectors["ElwinBackgroundRange"] = new MantidWidgets::RangeSelector(m_uiForm.ppPlot);
m_rangeSelectors["ElwinBackgroundRange"]->setColour(Qt::darkGreen); // dark green for background
connect(m_rangeSelectors["ElwinIntegrationRange"], SIGNAL(rangeChanged(double, double)), m_rangeSelectors["ElwinBackgroundRange"], SLOT(setRange(double, double)));
connect(m_rangeSelectors["ElwinBackgroundRange"], SIGNAL(minValueChanged(double)), this, SLOT(minChanged(double)));
connect(m_rangeSelectors["ElwinBackgroundRange"], SIGNAL(maxValueChanged(double)), this, SLOT(maxChanged(double)));
m_rangeSelectors["ElwinBackgroundRange"]->setRange(m_rangeSelectors["ElwinIntegrationRange"]->getRange());
// Refresh the plot window
replot("ElwinPlot");

connect(m_dblManager, SIGNAL(valueChanged(QtProperty*, double)), this, SLOT(updateRS(QtProperty*, double)));
connect(m_blnManager, SIGNAL(valueChanged(QtProperty*, bool)), this, SLOT(twoRanges(QtProperty*, bool)));
Expand Down Expand Up @@ -362,13 +354,13 @@ namespace IDA
setDefaultResolution(ws);
setDefaultSampleLog(ws);

plotMiniPlot(ws, specNo, "ElwinPlot", "ElwinDataCurve");
m_uiForm.ppPlot->clear();
m_uiForm.ppPlot->addSpectrum("Sample", ws, specNo);

try
{
const std::pair<double, double> range = getCurveRange("ElwinDataCurve");
QPair<double, double> range = m_uiForm.ppPlot->getCurveRange(ws);
m_rangeSelectors["ElwinIntegrationRange"]->setRange(range.first, range.second);
replot("ElwinPlot");
}
catch(std::invalid_argument & exc)
{
Expand Down
25 changes: 9 additions & 16 deletions Code/Mantid/MantidQt/CustomInterfaces/src/Indirect/Fury.cpp
Expand Up @@ -15,8 +15,7 @@ namespace
Mantid::Kernel::Logger g_log("Fury");
}

using Mantid::API::MatrixWorkspace;
using Mantid::API::MatrixWorkspace_const_sptr;
using namespace Mantid::API;

namespace MantidQt
{
Expand All @@ -36,12 +35,6 @@ namespace IDA
m_furTree = new QtTreePropertyBrowser();
m_uiForm.properties->addWidget(m_furTree);

m_plots["FuryPlot"] = new QwtPlot(m_parentWidget);
m_uiForm.plot->addWidget(m_plots["FuryPlot"]);
m_plots["FuryPlot"]->setCanvasBackground(Qt::white);
m_plots["FuryPlot"]->setAxisFont(QwtPlot::xBottom, m_parentWidget->font());
m_plots["FuryPlot"]->setAxisFont(QwtPlot::yLeft, m_parentWidget->font());

// Create and configure properties
m_properties["ELow"] = m_dblManager->addProperty("ELow");
m_dblManager->setDecimals(m_properties["ELow"], NUM_DECIMALS);
Expand Down Expand Up @@ -75,7 +68,7 @@ namespace IDA

m_furTree->setFactoryForManager(m_dblManager, m_dblEdFac);

m_rangeSelectors["FuryRange"] = new MantidQt::MantidWidgets::RangeSelector(m_plots["FuryPlot"]);
m_rangeSelectors["FuryRange"] = new MantidQt::MantidWidgets::RangeSelector(m_uiForm.ppPlot);

// signals / slots & validators
connect(m_rangeSelectors["FuryRange"], SIGNAL(selectionChangedLazy(double, double)), this, SLOT(rsRangeChangedLazy(double, double)));
Expand Down Expand Up @@ -250,24 +243,26 @@ namespace IDA

void Fury::plotInput(const QString& wsname)
{
MatrixWorkspace_const_sptr workspace;
MatrixWorkspace_sptr workspace;
try
{
workspace = Mantid::API::AnalysisDataService::Instance().retrieveWS<const MatrixWorkspace>(wsname.toStdString());
workspace = Mantid::API::AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(wsname.toStdString());
}
catch(Mantid::Kernel::Exception::NotFoundError&)
{
showMessageBox(QString("Unable to retrieve workspace: " + wsname));
return;
}

plotMiniPlot(workspace, 0, "FuryPlot", "FuryCurve");
m_uiForm.ppPlot->clear();
m_uiForm.ppPlot->addSpectrum("Sample", workspace, 0);

try
{
const std::pair<double, double> range = getCurveRange("FuryCurve");
QPair<double, double> range = m_uiForm.ppPlot->getCurveRange(workspace);
double rounded_min(range.first);
double rounded_max(range.second);
const std::string instrName( workspace->getInstrument()->getName() );
const std::string instrName(workspace->getInstrument()->getName());
if(instrName == "BASIS")
{
m_rangeSelectors["FuryRange"]->setRange(range.first, range.second);
Expand Down Expand Up @@ -308,8 +303,6 @@ namespace IDA
//set default value for width
m_dblManager->setValue(m_properties["EWidth"], 0.005);
}

replot("FuryPlot");
}
catch(std::invalid_argument & exc)
{
Expand Down

0 comments on commit e1f908e

Please sign in to comment.