Skip to content

Commit

Permalink
Removed old reduction scripts, switch UI to new algo
Browse files Browse the repository at this point in the history
Need to add saving

Refs #10855
  • Loading branch information
DanNixon committed Jan 12, 2015
1 parent 378a845 commit bbe37ec
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 212 deletions.
Expand Up @@ -3,7 +3,7 @@
from mantid.kernel import *
from mantid import config

import os.path as path
import os


class ISISIndirectDiffractionReduction(DataProcessorAlgorithm):
Expand Down Expand Up @@ -133,6 +133,8 @@ def _setup(self):

# Get the IPF filename
self._ipf_filename = self._instrument_name + '_diffraction_' + self._mode + '_Parameters.xml'
if not os.path.exists(self._ipf_filename):
self._ipf_filename = os.path.join(config['instrumentDefinition.directory'], self._ipf_filename)
logger.information('IPF filename is: %s' % (self._ipf_filename))

# Only enable sum files if we actually have more than one file
Expand All @@ -159,7 +161,7 @@ def _load_files(self):

for filename in self._raw_file_list:
# The filename without path and extension will be the workspace name
ws_name = path.splitext(path.basename(filename))[0]
ws_name = os.path.splitext(os.path.basename(filename))[0]

logger.debug('Loading file %s as workspace %s' % (filename, ws_name))

Expand Down Expand Up @@ -415,11 +417,11 @@ def _group_spectra(self, ws_name, masked_detectors):
raise RuntimeError('IPF requests grouping using file but does not specify a filename')

# If the file is not found assume it is in the grouping files directory
if not path.isfile(grouping_file):
grouping_file = path.join(config.getString('groupingFiles.directory'), grouping_file)
if not os.path.isfile(grouping_file):
grouping_file = os.path.join(config.getString('groupingFiles.directory'), grouping_file)

# If it is still not found just give up
if not path.isfile(grouping_file):
if not os.path.isfile(grouping_file):
raise RuntimeError('Cannot find grouping file %s' % grouping_file)

# Mask detectors if required
Expand Down

This file was deleted.

Expand Up @@ -102,7 +102,7 @@ void IndirectDiffractionReduction::plotResults(bool error)
return;
}

// Ungroup the output workspace if MSGDiffractionReduction was used
// Ungroup the output workspace if generic reducer was used
if(AnalysisDataService::Instance().doesExist("IndirectDiffraction_Workspaces"))
{
WorkspaceGroup_sptr diffResultsGroup = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>("IndirectDiffraction_Workspaces");
Expand Down Expand Up @@ -153,15 +153,13 @@ void IndirectDiffractionReduction::runGenericReduction(QString instName, QString
if(!rebinStart.isEmpty() && !rebinWidth.isEmpty() && !rebinEnd.isEmpty())
rebin = rebinStart + "," + rebinWidth + "," + rebinEnd;

bool individualGrouping = m_uiForm.ckIndividualGrouping->isChecked();

// Get detector range
std::vector<long> detRange;
detRange.push_back(m_uiForm.set_leSpecMin->text().toLong());
detRange.push_back(m_uiForm.set_leSpecMax->text().toLong());

// Get MSGDiffractionReduction algorithm instance
IAlgorithm_sptr msgDiffReduction = AlgorithmManager::Instance().create("MSGDiffractionReduction");
// Get generic reduction algorithm instance
IAlgorithm_sptr msgDiffReduction = AlgorithmManager::Instance().create("ISISIndirectDiffractionReduction");
msgDiffReduction->initialize();

// Get save formats
Expand All @@ -175,14 +173,18 @@ void IndirectDiffractionReduction::runGenericReduction(QString instName, QString
msgDiffReduction->setProperty("Mode", mode.toStdString());
msgDiffReduction->setProperty("SumFiles", m_uiForm.dem_ckSumFiles->isChecked());
msgDiffReduction->setProperty("InputFiles", m_uiForm.dem_rawFiles->getFilenames().join(",").toStdString());
msgDiffReduction->setProperty("DetectorRange", detRange);
msgDiffReduction->setProperty("SpectraRange", detRange);
msgDiffReduction->setProperty("RebinParam", rebin.toStdString());
msgDiffReduction->setProperty("IndividualGrouping", individualGrouping);
msgDiffReduction->setProperty("SaveFormats", saveFormats);
msgDiffReduction->setProperty("OutputWorkspace", "IndirectDiffraction_Workspaces");

// Add the pproperty for grouping policy if needed
if(m_uiForm.ckIndividualGrouping->isChecked())
msgDiffReduction->setProperty("GroupingPolicy", "Individual");

m_batchAlgoRunner->addAlgorithm(msgDiffReduction);

//TODO: saving

m_batchAlgoRunner->executeBatchAsync();
}

Expand Down
72 changes: 0 additions & 72 deletions Code/Mantid/scripts/Inelastic/IndirectDiffractionReduction.py

This file was deleted.

0 comments on commit bbe37ec

Please sign in to comment.