Skip to content

Commit

Permalink
Refs #4531 - Change method used to get third spectra.
Browse files Browse the repository at this point in the history
An undo of changes made previously on this ticket, and replacing them with a simple change to the Workflow.FixedGrouping property value in TOSCA_parameters.xml.

This gives us the same functionality, but removes the problem of having
more than one spectra with the same ID.

Change to System Tests to follow...
  • Loading branch information
PeterParker committed Feb 2, 2012
1 parent a70d924 commit 2880712
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 62 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/DataHandling/test/LoadRaw3Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class LoadRaw3Test : public CxxTest::TestSuite
TS_ASSERT_EQUALS( ptrDet->getID(), 60);

Mantid::Geometry::ParameterMap& pmap = output2D->instrumentParameters();
TS_ASSERT_EQUALS( static_cast<int>(pmap.size()), 155);
TS_ASSERT_EQUALS( static_cast<int>(pmap.size()), 154);
AnalysisDataService::Instance().remove("parameterIDF");
}

Expand Down
6 changes: 1 addition & 5 deletions Code/Mantid/instrument/TOSCA_Parameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,11 @@
<value val="Fixed" />
</parameter>
<parameter name="Workflow.FixedGrouping" type="string">
<value val="0-69,70-139" />
<value val="0-69,70-139,0-139" />
</parameter>
<parameter name="Workflow.Masking" type="string">
<value val="IdentifyNoisyDetectors" />
</parameter>
<!-- Available options are "average", "sum", or "none". -->
<parameter name="Workflow.Summary" type="string">
<value val="Average" />
</parameter>

</component-link>

Expand Down
5 changes: 0 additions & 5 deletions Code/Mantid/scripts/Inelastic/inelastic_indirect_reducer.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ def _setup_steps(self):
else:
return

# "Summary" adds another histogram onto the end of the resultant workspaces.
# "none", "sum" or "average" are currently supported.
step = steps.Summary(MultipleFrames=self._multiple_frames)
self.append_step(step)

step = steps.ConvertToCm1(MultipleFrames=self._multiple_frames)
step.set_save_to_cm_1(self._save_to_cm_1)
self.append_step(step)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,57 +581,6 @@ def _ws_in_range(self, ranges, xval):
if ( xval >= range[0] and xval <= range[1] ): result += 1
return result

class Summary(ReductionStep):
"""
Adds an extra histogram to the workspace(s) that result from the reduction.
The options are:
* "Sum" - the sum of all the other histograms in the workspace.
* "Average" - the average of all the other histograms in the workspace.
* "None" - no extra histogram is added.
"""

_multiple_frames = False

def __init__(self, MultipleFrames=False):
super(Summary, self).__init__()
self._multiple_frames = MultipleFrames

def execute(self, reducer, file_ws):
try:
summary = mtd[file_ws].getInstrument().getStringParameter('Workflow.Summary')[0]
except IndexError:
return

if ((summary != "Sum") and (summary != "Average")):
return

if ( self._multiple_frames ):
try:
workspaceNames = mtd[file_ws].getNames()
except AttributeError:
workspaceNames = [file_ws]
else:
workspaceNames = [file_ws]

for wsName in workspaceNames:
try:
ws = mtd[wsName]
except:
continue
nSpec = ws.getNumberHistograms()
if (nSpec == 0):
continue
tempName = wsName + '_temp_sum'
SumSpectra(InputWorkspace=wsName, OutputWorkspace=tempName)

if (summary == 'Average'):
tempWs = mtd[tempName]
tempWs /= nSpec
# Note: Detector info of the output becomes spurious as there will be a third entry for a detector
# that does not exist.
ConjoinWorkspaces(wsName, tempName, False)

class ConvertToCm1(ReductionStep):
"""
Converts the workspaces to cm-1.
Expand Down

0 comments on commit 2880712

Please sign in to comment.