Skip to content

Commit

Permalink
refs #6667 Comments and code niceness.
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Jun 27, 2013
1 parent 0168f2e commit d834266
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
5 changes: 2 additions & 3 deletions Code/Mantid/instrument/MAPS_Parameters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@
<parameter name="background" type="bool">
<value val="False"/>
</parameter>
<!-- True if background is to be checked UNUSED PROPERTY !!! -->
<!-- True if background is to be checked UNUSED PROPERTY !!!
<parameter name="check_background" type="bool">
<value val="True"/>
</parameter>


-->

<!-- detector_van_range- integratin in E(mev) for detector(white beam) vanadium data [20,100] -->
<parameter name="wb-integr-min">
Expand Down
57 changes: 29 additions & 28 deletions Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ def do_white(self, white_run, spectra_masks, map_file,mon_number=None):
white_ws = self.remap(white_ws, spectra_masks, map_file)

# White beam scale factor
white_ws *= self.wb_scale_factor
self.workspace_list['white_ws'] = white_ws
white_ws *= self.wb_scale_factor
return white_ws

def mono_van(self, mono_van, ei_guess, white_run=None, map_file=None,
Expand All @@ -261,7 +260,6 @@ def mono_van(self, mono_van, ei_guess, white_run=None, map_file=None,
white_run, map_file, spectra_masks, Tzero)
# Normalize by vanadium sample weight
monovan /= float(self.van_mass)/float(self.van_rmm)
self.workspace_list['monovan_ws'] = monovan
return monovan

def mono_sample(self, mono_run, ei_guess, white_run=None, map_file=None,
Expand All @@ -275,9 +273,9 @@ def mono_sample(self, mono_run, ei_guess, white_run=None, map_file=None,
if result_name is None:
result_name = common.create_resultname(mono_run, prefix=self.instr_name)

self.workspace_list['sample_ws']=self._do_mono(sample_data, sample_data, result_name, ei_guess,
mono_s=self._do_mono(sample_data, sample_data, result_name, ei_guess,
white_run, map_file, spectra_masks, Tzero)
return self.workspace_list['sample_ws']
return mono_s


# -------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -766,13 +764,6 @@ def __init__(self, instr_name=None):
self._idf_values_read = False
self.instr_name=None
if not (instr_name is None or len(instr_name)==0) :
# Instrument and default parameter setup
# fomats availible for saving. As the reducer has to have a method to process one of this, it is private property
self.__save_formats = {}
self.__save_formats['.spe'] = lambda workspace,filename : SaveSPE(InputWorkspace=workspace,Filename= filename)
self.__save_formats['.nxspe'] = lambda workspace,filename : SaveNXSPE(InputWorkspace=workspace,Filename= filename, KiOverKfScaling=self.apply_kikf_correction,Psi=self.psi)
self.__save_formats['.nxs'] = lambda workspace,filename : SaveNexus(InputWorkspace=workspace,Filename= filename)

self.initialise(instr_name)

#----------------------------------------------------------------------------------
Expand Down Expand Up @@ -877,6 +868,26 @@ def initialise(self, instr_name,reload_instrument=False):
"""
Initialise the attributes of the class
"""

# Instrument and default parameter setup
# fomats availible for saving. As the reducer has to have a method to process one of this, it is private property
self.__save_formats = {}
self.__save_formats['.spe'] = lambda workspace,filename : SaveSPE(InputWorkspace=workspace,Filename= filename)
self.__save_formats['.nxspe'] = lambda workspace,filename : SaveNXSPE(InputWorkspace=workspace,Filename= filename, KiOverKfScaling=self.apply_kikf_correction,Psi=self.psi)
self.__save_formats['.nxs'] = lambda workspace,filename : SaveNexus(InputWorkspace=workspace,Filename= filename)
## Detector diagnosis
# Diag parameters -- keys used by diag method to pick from default parameters. Diag cuts these keys removing diag_ word
# and tries to get rest from the correspondent dgreduced 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']


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

# list of the parameters which should usually be changed by user and if not, user should be warn about it.
self.__abs_units_par_to_change=['sample_mass','sample_rmm']

# Instrument name might be a prefix, query Mantid for the full name
new_name = config.getFacility().instrument(instr_name).shortName()
if new_name != self.instr_name:
Expand Down Expand Up @@ -922,21 +933,8 @@ def init_idf_params(self, reload_instrument=False):
"""
self.efixed = 0

## Detector diagnosis
# Diag parameters -- keys used by diag method to pick from default parameters. Diag cuts these keys removing diag_ word
# and tries to get rest from the correspondent dgreduced 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']

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

# list of the parameters which should usually be changed by user and if not, user should be warn about it.
self.__abs_units_par_to_change=['sample_mass','sample_rmm']

# the list of the workspaces used by the reducer
self.workspace_list = {}


# mandatrory command line parameter
self.energy_bins = None

Expand Down Expand Up @@ -1390,8 +1388,11 @@ def test_set_get_mono_range(self):
tReducer.initialise("MAP");

energy_incident = 100
if tReducer.monovan_integr_range is None :
tReducer.monovan_integr_range = [tReducer.monovan_lo_frac*energy_incident,tReducer.monovan_hi_frac*energy_incident]
tReducer.efixed = energy_incident
hi_frac = tReducer.monovan_hi_frac
lo_frac = tReducer.monovan_lo_frac
tReducer.monovan_integr_range = None
self.assertEqual(tReducer.monovan_integr_range,[lo_frac*energy_incident,hi_frac*energy_incident])

def test_comlex_get(self):
tReducer = self.reducer
Expand Down

0 comments on commit d834266

Please sign in to comment.