Skip to content

Commit

Permalink
Refs #5421 Modified JumpFit to plot desired spectrum.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Jackson committed Sep 25, 2013
1 parent 61511fd commit 51021df
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ namespace MantidQt
private slots:
/// Handle when the sample input is ready
void handleSampleInputReady(const QString& filename);
/// Slot to handle plotting a different spectrum of the workspace
void handleWidthChange(int index);
/// Slot for when the min range on the range selector changes
virtual void minValueChanged(double min);
/// Slot for when the min range on the range selector changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
</property>
<property name="workspaceSuffixes" stdset="0">
<stringlist>
<string>_red</string>
<string>_Workspace</string>
</stringlist>
</property>
<property name="fileBrowserSuffixes" stdset="0">
<stringlist>
<string>_red.nxs</string>
<string>_Workspace.nxs</string>
</stringlist>
</property>
</widget>
Expand Down
38 changes: 38 additions & 0 deletions Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ namespace MantidQt

// Connect data selector to handler method
connect(m_uiForm.dsSample, SIGNAL(dataReady(const QString&)), this, SLOT(handleSampleInputReady(const QString&)));
// Connect width selector to handler method
connect(m_uiForm.cbWidth, SIGNAL(currentIndexChanged(int)), this, SLOT(handleWidthChange(int)));
}

/**
Expand Down Expand Up @@ -115,6 +117,25 @@ namespace MantidQt
std::pair<double,double> res;
std::pair<double,double> range = getCurveRange();

auto ws = Mantid::API::AnalysisDataService::Instance().retrieve(filename.toStdString());
auto mws = boost::dynamic_pointer_cast<const Mantid::API::MatrixWorkspace>(ws);

size_t size = mws->getNumberHistograms();

if(size <= 2)
{
// we're using a ConvFit file as input
// we only have one spectra so disable selecting anything but the first
m_uiForm.cbWidth->setCurrentIndex(0);
m_uiForm.cbWidth->setEnabled(false);
}
else
{
//we're using a QLines files as input
//enable the option to select other spectra
m_uiForm.cbWidth->setEnabled(true);
}

//Use the values from the instrument parameter file if we can
if(getInstrumentResolution(filename, res))
{
Expand All @@ -128,6 +149,23 @@ namespace MantidQt
setPlotRange(m_properties["QMin"], m_properties["QMax"], range);
}


/**
* Plots the loaded file to the miniplot when the selected spectrum changes
*
* @param index :: The name spectrum index to plot
*/
void JumpFit::handleWidthChange(int index)
{
QString sampleName = m_uiForm.dsSample->getCurrentDataName();
QString samplePath = m_uiForm.dsSample->getFullFilePath();

if(checkFileLoaded(sampleName, samplePath))
{
plotMiniPlot(sampleName, index*2);
}
}

/**
* Updates the property manager when the lower guide is moved on the mini plot
*
Expand Down

0 comments on commit 51021df

Please sign in to comment.