Skip to content

Commit

Permalink
Ungroup results from IDR ET tab
Browse files Browse the repository at this point in the history
Refs #10638
  • Loading branch information
DanNixon committed Nov 26, 2014
1 parent a74869f commit fc10f5e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Expand Up @@ -48,6 +48,7 @@ namespace CustomInterfaces
virtual bool validate();

private slots:
void algorithmComplete(bool error);
void setInstrumentDefault(); ///< Sets default parameters for current instrument
void mappingOptionSelected(const QString& groupType); ///< change ui to display appropriate options
void backgroundClicked(); ///< handles showing and hiding m_backgroundDialog
Expand Down
Expand Up @@ -5,6 +5,8 @@
#include <QFileInfo>
#include <QInputDialog>

using namespace Mantid::API;

namespace MantidQt
{
namespace CustomInterfaces
Expand Down Expand Up @@ -62,6 +64,8 @@ namespace CustomInterfaces
connect(m_uiForm.entryRebinWidth, SIGNAL(textChanged(const QString &)), this, SLOT(validateTab()));
connect(m_uiForm.entryRebinHigh, SIGNAL(textChanged(const QString &)), this, SLOT(validateTab()));

connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool)));

// Update UI widgets to show default values
mappingOptionSelected(m_uiForm.cbMappingOptions->currentText());
rebinEntryToggle(m_uiForm.rebin_ckDNR->isChecked());
Expand Down Expand Up @@ -89,7 +93,6 @@ namespace CustomInterfaces

void IndirectConvertToEnergy::run()
{
using namespace Mantid::API;
using MantidQt::API::BatchAlgorithmRunner;

IAlgorithm_sptr reductionAlg = AlgorithmManager::Instance().create("InelasticIndirectReduction", -1);
Expand Down Expand Up @@ -164,7 +167,7 @@ namespace CustomInterfaces
reductionAlg->setProperty("SaveCM1", m_uiForm.ckCm1Units->isChecked());
reductionAlg->setProperty("SaveFormats", getSaveFormats());

reductionAlg->setProperty("OutputWorkspace", "IndirectInergyTransfer_Workspaces");
reductionAlg->setProperty("OutputWorkspace", "IndirectEnergyTransfer_Workspaces");

// Plot Output options
switch(m_uiForm.ind_cbPlotOutput->currentIndex())
Expand All @@ -183,6 +186,30 @@ namespace CustomInterfaces
m_batchAlgoRunner->executeBatchAsync();
}

/**
* Handles completion of the algorithm.
*
* Sets result workspace for Python export and ungroups result WorkspaceGroup.
*
* @param error True if the algorithm was stopped due to error, false otherwise
*/
void IndirectConvertToEnergy::algorithmComplete(bool error)
{
if(error)
return;

WorkspaceGroup_sptr energyTransferOutputGroup = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>("IndirectEnergyTransfer_Workspaces");
if(energyTransferOutputGroup->size() == 0)
return;

// Set workspace for Python export as the first result workspace
m_pythonExportWsName = energyTransferOutputGroup->getNames()[0];

// Ungroup the output workspace
energyTransferOutputGroup->removeAll();
AnalysisDataService::Instance().remove("IndirectEnergyTransfer_Workspaces");
}

bool IndirectConvertToEnergy::validate()
{
bool valid = true;
Expand Down Expand Up @@ -496,8 +523,6 @@ namespace CustomInterfaces
*/
QString IndirectConvertToEnergy::createMapFile(const QString& groupType)
{
using namespace Mantid::API;

QString specRange = m_uiForm.leSpectraMin->text() + "," + m_uiForm.leSpectraMax->text();

if(groupType == "File")
Expand Down Expand Up @@ -563,7 +588,6 @@ namespace CustomInterfaces
*/
void IndirectConvertToEnergy::plotRaw()
{
using namespace Mantid::API;
using MantidQt::API::BatchAlgorithmRunner;

if(!m_uiForm.ind_runFiles->isValid())
Expand Down

0 comments on commit fc10f5e

Please sign in to comment.