Skip to content

Commit

Permalink
refs #6667 Changes to MARI reduction to produce previous results
Browse files Browse the repository at this point in the history
MARI generates the results which are similar to the one, produced by old reducer. Reasons for difference are generally clear.
  • Loading branch information
abuts committed Jul 5, 2013
1 parent a80b20b commit 884e2ba
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 48 deletions.
17 changes: 13 additions & 4 deletions Code/Mantid/instrument/LET_Parameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@



<!-- integration range for background tests (in TOF) - composite property -->
<!-- integration range for background tests (in TOF) - composite property
Used in test to reject high backgound (FlatBackground) and in High Background tests integration in Diagnostics
if diag_background_test_range is not set -->
<parameter name="bkgd-range-min">
<value val="90000"/>
</parameter>
Expand Down Expand Up @@ -192,9 +194,13 @@
<parameter name="diag_variation">
<value val="1.1"/>
</parameter>
<parameter name="diag_background_range">
<!-- The range used in diagnostics and rejecting high background.
If none, the diag background range uses background ranges from background_range. Has to be directly set otherwise -->
<parameter name="diag_background_test_range" type="string" >
<value val="None"/>
</parameter>


<!-- -->
<!-- Bleeding corrections -->

Expand Down Expand Up @@ -297,14 +303,16 @@

<!-- **************************************** Workflow control **************************** -->

<!-- This parameter controls the format of output data writteb by reducer. Three values are currently supported, namely spe, nxspe, and nexus (mantid workspace)
<!-- This parameter controls the format of output data written by reducer.
Three values are currently supported, namely .spe, .nxspe, and nexus (mantid workspace) (.nxs)
Three possible values for this are defined inin DirectEnergyConversion init routine as recognized by save method
If None is there, no internal script saving occurs and one needs to use external save operations -->
<parameter name="save_format" type="string">
<value val="None"/>
</parameter>

<!-- If one wants to sum runs -->
<!-- If one wants to sum runs. By default no, as in addition to the key word one has to provide list of input run-numbers
but presence of this key here allows to propagate this key-word to the reducer -->
<parameter name="sum_runs" type="bool">
<value val="False"/>
</parameter>
Expand Down Expand Up @@ -351,6 +359,7 @@
monovan_hi_value = monovan-integr-max;
use_hard_mask_only=hardmaskOnly;
bkgd_range = background_range;
background_test_range = diag_background_test_range;
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;
Expand Down
12 changes: 10 additions & 2 deletions Code/Mantid/instrument/MAPS_Parameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,13 @@
<parameter name="diag_variation">
<value val="1.1"/>
</parameter>
<parameter name="diag_background_range">
<!-- The range used in diagnostics and rejecting high background.
If none, the diag background range uses background ranges from background_range. Has to be directly set otherwise -->
<parameter name="diag_background_test_range" type="string" >
<value val="None"/>
</parameter>


<!-- -->
<!-- Bleeding corrections -->

Expand Down Expand Up @@ -306,7 +310,8 @@
<value val="None"/>
</parameter>

<!-- If one wants to sum runs -->
<!-- If one wants to sum runs. By default no, as in addition to the key word one has to provide list of input run-numbers
but presence of this key here allows to propagate this key word for to the reducer -->
<parameter name="sum_runs" type="bool">
<value val="False"/>
</parameter>
Expand Down Expand Up @@ -353,6 +358,7 @@
monovan_hi_value = monovan-integr-max;
use_hard_mask_only=hardmaskOnly;
bkgd_range = background_range;
background_test_range = diag_background_test_range;
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;
Expand All @@ -367,6 +373,8 @@
samp_sig = diag_samp_median_sigma=diag_samp_sig;
variation = diag_variation;
bleed_test = bleed = diag_bleed_test;
bleed_maxrate = diag_bleed_maxrate;
bleed_pixels = diag_bleed_pixels;
ei-mon2-spec = test_ei2_mon_spectra;
ei_mon_spectra=test_mon_spectra_composite"
/>
Expand Down
31 changes: 21 additions & 10 deletions Code/Mantid/instrument/MARI_Parameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<!-- The file which defines detectors to spectra mapping; File extension has to be specified here but filepath not
if None - one2one map is used -->
<parameter name="map_file" type="string">
<value val="mari_res"/>
<value val="mari_res2012"/>
</parameter>

<!-- Extension of the data files obtained from DAE -->
Expand Down Expand Up @@ -80,7 +80,7 @@
</parameter>



<!-- 1.7016e8-->
<parameter name="scale-factor">
<value val="1.8182e8"/>
</parameter>
Expand All @@ -91,7 +91,7 @@

<!-- Remove the count rate seen in the regions of the histograms defined as the background regions -->
<parameter name="background" type="bool">
<value val="False"/>
<value val="True"/>
</parameter>
<!-- True if background is to be checked UNUSED PROPERTY !!!
<parameter name="check_background" type="bool">
Expand All @@ -104,15 +104,17 @@
<value val="20"/>
</parameter>
<parameter name="wb-integr-max">
<value val="40"/>
<value val="100"/>
</parameter>
<parameter name="wb_integr_range" type="string">
<value val="wb-integr-min:wb-integr-max"/>
</parameter>



<!-- integration range for background tests (in TOF) - composite property -->
<!-- integration range for background tests (in TOF) - composite property
Used in test to reject high backgound (FlatBackground) and in High Background tests integration in Diagnostics
if diag_background_test_range is not set -->
<parameter name="bkgd-range-min">
<value val="18000"/>
</parameter>
Expand Down Expand Up @@ -159,7 +161,7 @@
difference with respect to the median value must also exceed this number of error bars (default=3.3)
-->
<parameter name="diag_samp_sig">
<value val="3.3"/>
<value val="3"/>
</parameter>

<!-- Lower bound defining outliers as fraction of median value (v_out_lo)-->
Expand All @@ -179,7 +181,7 @@

<!-- Fraction of median to consider counting high for the white beam diag (vv_hi) vanhi=1.5 -->
<parameter name="diag_van_hi">
<value val="3.0"/>
<value val="1.5"/>
</parameter>

<!-- Error criterion as a multiple of error bar van_sig "
Expand All @@ -193,9 +195,13 @@
<parameter name="diag_variation">
<value val="1.1"/>
</parameter>
<parameter name="diag_background_range">
<!-- The range used in diagnostics and rejecting high background.
If none, the diag background range uses background ranges from background_range. Has to be directly set otherwise -->
<parameter name="diag_background_test_range" type="string" >
<value val="None"/>
</parameter>


<!-- -->
<!-- Bleeding corrections -->

Expand Down Expand Up @@ -300,14 +306,16 @@

<!-- **************************************** Workflow control **************************** -->

<!-- This parameter controls the format of output data writteb by reducer. Three values are currently supported, namely spe, nxspe, and nexus (mantid workspace)
<!-- This parameter controls the format of output data written by reducer.
Three values are currently supported, namely .spe, .nxspe, and nexus (mantid workspace) (.nxs)
Three possible values for this are defined inin DirectEnergyConversion init routine as recognized by save method
If None is there, no internal script saving occurs and one needs to use external save operations -->
<parameter name="save_format" type="string">
<value val="None"/>
</parameter>

<!-- If one wants to sum runs -->
<!-- If one wants to sum runs. By default no, as in addition to the key word one has to provide list of input run-numbers
but presence of this key here allows to propagate this key word for to the reducer -->
<parameter name="sum_runs" type="bool">
<value val="False"/>
</parameter>
Expand Down Expand Up @@ -354,6 +362,7 @@
monovan_hi_value = monovan-integr-max;
use_hard_mask_only=hardmaskOnly;
bkgd_range = background_range;
background_test_range = diag_background_test_range;
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;
Expand All @@ -368,6 +377,8 @@
samp_sig = diag_samp_median_sigma=diag_samp_sig;
variation = diag_variation;
bleed_test = bleed = diag_bleed_test;
bleed_maxrate = diag_bleed_maxrate;
bleed_pixels = diag_bleed_pixels;
ei-mon2-spec = test_ei2_mon_spectra;
ei_mon_spectra=test_mon_spectra_composite"
/>
Expand Down
17 changes: 13 additions & 4 deletions Code/Mantid/instrument/MERLIN_Parameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@



<!-- integration range for background tests (in TOF) - composite property -->
<!-- integration range for background tests (in TOF) - composite property
Used in test to reject high backgound (FlatBackground) and in High Background tests integration in Diagnostics
if diag_background_test_range is not set -->
<parameter name="bkgd-range-min">
<value val="12000"/>
</parameter>
Expand Down Expand Up @@ -179,7 +181,7 @@

<!-- Fraction of median to consider counting high for the white beam diag (vv_hi) vanhi=1.5 -->
<parameter name="diag_van_hi">
<value val="2.0"/>
<value val="1.5"/>
</parameter>

<!-- Error criterion as a multiple of error bar van_sig "
Expand All @@ -193,7 +195,10 @@
<parameter name="diag_variation">
<value val="1.1"/>
</parameter>
<parameter name="diag_background_range">
<!-- The range used in diagnostics and rejecting high background.
If none, the diag background range uses background ranges from background_range. Has to be directly set otherwise -->
<parameter name="diag_background_test_range" type="string" >
<value val="None"/>
</parameter>

<!-- -->
Expand Down Expand Up @@ -305,7 +310,8 @@
<value val="None"/>
</parameter>

<!-- If one wants to sum runs -->
<!-- If one wants to sum runs. By default no, as in addition to the key word one has to provide list of input run-numbers
but presence of this key here allows to propagate this key word for to the reducer -->
<parameter name="sum_runs" type="bool">
<value val="False"/>
</parameter>
Expand Down Expand Up @@ -352,6 +358,7 @@
monovan_hi_value = monovan-integr-max;
use_hard_mask_only=hardmaskOnly;
bkgd_range = background_range;
background_test_range = diag_background_test_range;
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;
Expand All @@ -366,6 +373,8 @@
samp_sig = diag_samp_median_sigma=diag_samp_sig;
variation = diag_variation;
bleed_test = bleed = diag_bleed_test;
bleed_maxrate = diag_bleed_maxrate;
bleed_pixels = diag_bleed_pixels;
ei-mon2-spec = test_ei2_mon_spectra;
ei_mon_spectra=test_mon_spectra_composite"
/>
Expand Down
48 changes: 42 additions & 6 deletions Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def diagnose(self, white, **kwargs):
hard_mask - A file specifying those spectra that should be masked without testing (default=None)
tiny - Minimum threshold for acceptance (default = 1e-10)
huge - Maximum threshold for acceptance (default = 1e10)
bkgd_range - A list of two numbers indicating the background range (default=instrument defaults)
background_test_range - A list of two numbers indicating the background range (default=instrument defaults)
van_out_lo - Lower bound defining outliers as fraction of median value (default = 0.01)
van_out_hi - Upper bound defining outliers as fraction of median value (default = 100.)
van_lo - Fraction of median to consider counting low for the white beam diag (default = 0.1)
Expand Down Expand Up @@ -167,11 +167,11 @@ def diagnose(self, white, **kwargs):
# Set up the background integrals
result_ws = common.load_runs(sample)
result_ws = self.normalise(result_ws, result_ws.name(), self.normalise_method)
if 'bkgd_range' in kwargs:
bkgd_range = kwargs['bkgd_range']
del kwargs['bkgd_range']
if 'background_test_range' in kwargs:
bkgd_range = kwargs['background_test_range']
del kwargs['background_test_range']
else:
bkgd_range = self.bkgd_range
bkgd_range = self.background_test_range
background_int = Integration(result_ws,
RangeLower=bkgd_range[0],RangeUpper=bkgd_range[1],
IncludePartialBins=True)
Expand Down Expand Up @@ -954,6 +954,42 @@ def relocate_dets(self) :
else:
return False

@property
def normalise_method(self):
return self._normalise_method
@normalise_method.setter
def normalise_method(self,value):
if value is None:
value = 'none'
if not isinstance(value,str):
self.log('Normalization method should be a string or None','error')

value = value.lower()
if value in self.__normalization_methods:
self._normalise_method = value
else:
self.log('Attempt to set up unknown normalization method {0}'.format(value),'error')
raise KeyError('Attempt to set up unknown normalization method {0}'.format(value))

@property
def background_test_range(self):
if not hasattr(self,'_background_test_range') or self._background_test_range is None:
return self.bkgd_range;
else:
return self._background_test_range
@background_test_range.setter
def background_test_range(self,value):
if value is None:
self._background_test_range=None
return
if isinstance(value,str):
value = str.split(value,',')
if len(value) != 2:
raise ValueError("background test range can be set to a 2 element list of floats")

self._background_test_range=[float(value[0]),float(value[1])]


def initialise(self, instr_name,reload_instrument=False):
"""
Initialise the private attributes of the class and the nullify the attributes which expected to be always set-up from a calling script
Expand All @@ -970,7 +1006,7 @@ def initialise(self, instr_name,reload_instrument=False):
# and tries to get rest from the correspondent Direct Energy conversion attributes.
self.__diag_params = ['diag_tiny', 'diag_huge', 'diag_samp_zero', 'diag_samp_lo', 'diag_samp_hi','diag_samp_sig',\
'diag_van_out_lo', 'diag_van_out_hi', 'diag_van_lo', 'diag_van_hi', 'diag_van_sig', 'diag_variation',\
'diag_bleed_test','diag_bleed_pixels','diag_bleed_maxrate','diag_hard_mask_file','diag_use_hard_mask_only','diag_bkgd_range']
'diag_bleed_test','diag_bleed_pixels','diag_bleed_maxrate','diag_hard_mask_file','diag_use_hard_mask_only','diag_background_test_range']


self.__normalization_methods=['none','monitor-1','current'] # 'monitor-2','uamph', peak -- disabled/unknown at the moment
Expand Down

0 comments on commit 884e2ba

Please sign in to comment.