Skip to content

Commit

Permalink
refs #6667 Intensities of old and new dgreduce coincide in arb units
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Jun 27, 2013
1 parent e8972f3 commit 5c2c5ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/instrument/MAPS_Parameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
monovan_hi_value = monovan-integr-max;
use_hard_mask_only=hardmaskOnly;
bkgd_range = background_range;
hard_mask_file=hard_mask = =hardmaskPlus;
hard_mask_file=hard_mask =hardmaskPlus;
van_out_lo = diag_van_median_rate_limit_lo=diag_van_out_lo;
van_out_hi = diag_van_median_rate_limit_hi=diag_van_out_hi;
van_lo = diag_van_median_sigma_lo=diag_van_lo;
Expand Down
12 changes: 9 additions & 3 deletions Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def mono_van(self, mono_van, ei_guess, white_run=None, map_file=None,
monovan = self._do_mono(sample_data, sample_data, result_name, ei_guess,
white_run, map_file, spectra_masks, Tzero)
# Normalize by vanadium sample weight
monovan /= float(self.van_mass)/float(self.__van_rmm)
monovan /= float(self.van_mass)/float(self.van_rmm)
self.workspace_list['monovan_ws'] = monovan
return monovan

Expand Down Expand Up @@ -290,6 +290,7 @@ def _do_mono(self, data_ws, monitor_ws, result_name, ei_guess,
Convert units of a given workspace to deltaE, including possible
normalisation to a white-beam vanadium run.
"""
prefix='new'

# Special load monitor stuff.
if (self.instr_name == "CNCS" or self.instr_name == "HYSPEC"):
Expand Down Expand Up @@ -426,12 +427,16 @@ def _do_mono(self, data_ws, monitor_ws, result_name, ei_guess,
# TODO: This really should be done as soon as possible after loading
self.normalise(mtd[result_name], result_name, self.normalise_method, range_offset=bin_offset)



# This next line will fail the SystemTests
#ConvertUnits(result_ws, result_ws, Target="DeltaE",EMode='Direct', EFixed=ei_value)
# But this one passes...
ConvertUnits(InputWorkspace=result_name,OutputWorkspace=result_name, Target="DeltaE",EMode='Direct')
self.log("_do_mono: finished ConvertUnits for "+result_name)

iws = mtd[result_name]


if not self.energy_bins is None:
Rebin(InputWorkspace=result_name,OutputWorkspace=result_name,Params= self.energy_bins,PreserveEvents=False)

Expand Down Expand Up @@ -459,14 +464,15 @@ def _do_mono(self, data_ws, monitor_ws, result_name, ei_guess,
result_ws = mtd[result_name]
result_ws = self.remap(result_ws, spectra_masks, map_file)


ConvertToDistribution(Workspace=result_ws)
# White beam correction
if white_run is not None:
white_ws = self.do_white(white_run, spectra_masks, map_file,None)
result_ws /= white_ws

# Overall scale factor
result_ws *= self.scale_factor
#CloneWorkspace(InputWorkspace=result_ws,OutputWorkspace='StepLastConvertUnits'+prefix)
return result_ws

#-------------------------------------------------------------------------------
Expand Down
7 changes: 5 additions & 2 deletions Code/Mantid/scripts/Inelastic/dgreduce.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from DirectEnergyConversion import *
import DirectEnergyConversion as DRC
import CommonFunctions as common
import time as time
import numpy
Expand All @@ -10,6 +10,8 @@
global Reducer
Reducer = None

DRC=reload(DRC)

def setup(instname=None,reload=False):
"""
setup('mar')
Expand All @@ -18,6 +20,7 @@ def setup(instname=None,reload=False):
if the instrument has already been defined, does nothing unless
reload = True is specified
"""

global Reducer
if instname == None :
instname = config['default.instrument']
Expand All @@ -28,7 +31,7 @@ def setup(instname=None,reload=False):
if not reload :
return # has been already defined

Reducer = setup_reducer(instname)
Reducer = DRC.setup_reducer(instname)

def help(keyword=None) :
"""function returns help on reduction parameters.
Expand Down

0 comments on commit 5c2c5ac

Please sign in to comment.