Skip to content

Commit

Permalink
refs #6667 The run data look very close to each other (MAPS)
Browse files Browse the repository at this point in the history
but not yet identical -- diag seems a bit different
  • Loading branch information
abuts committed Jun 19, 2013
1 parent c6a8e0e commit 99a8f64
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 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 @@ -22,7 +22,7 @@

<!-- Extension of the data files obtained from DAE -->
<parameter name="data_file_ext" type="string">
<value val=".RAW"/>
<value val=".raw"/>
</parameter>
<!-- The name of the hard mask file to use together with diag masking 4to1_124mod.msk-->
<parameter name="hard_mask_file" type="string">
Expand Down
10 changes: 5 additions & 5 deletions Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def diagnose(self, white, **kwargs):
IncludePartialBins=True)
total_counts = Integration(result_ws, IncludePartialBins=True)
background_int = ConvertUnits(background_int, "Energy", AlignBins=0)
Logger.notice("Diagnose: finisthed convertUnits ")
logger.notice("Diagnose: finisthed convertUnits ")
background_int *= self.scale_factor
diagnostics.normalise_background(background_int, whiteintegrals, kwargs.get('second_white',None))
kwargs['background_int'] = background_int
Expand Down Expand Up @@ -199,7 +199,7 @@ def do_white(self, white_run, spectra_masks, map_file,mon_number=None):
white_ws = self.normalise(white_data, whitews_name, self.normalise_method,0.0,mon_number)
# Units conversion
white_ws = ConvertUnits(InputWorkspace=white_ws,OutputWorkspace=whitews_name, Target= "Energy", AlignBins=0)
Logger.notice("do_white: finisthed convertUnits ")
logger.notice("do_white: finisthed convertUnits ")
# This both integrates the workspace into one bin spectra and sets up common bin boundaries for all spectra
low = self.wb_integr_range[0]
upp = self.wb_integr_range[1]
Expand Down Expand Up @@ -397,7 +397,7 @@ def _do_mono(self, data_ws, monitor_ws, result_name, ei_guess,
#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')
Logger.notice("_do_mono: finished ConvertUnits")
logger.notice("_do_mono: finished ConvertUnits")

if not self.energy_bins is None:
Rebin(InputWorkspace=result_name,OutputWorkspace=result_name,Params= self.energy_bins,PreserveEvents=False)
Expand All @@ -410,7 +410,7 @@ def _do_mono(self, data_ws, monitor_ws, result_name, ei_guess,
ConvertUnits(InputWorkspace=result_name,OutputWorkspace= result_name, Target="DeltaE",EMode='Direct', EFixed=ei_value)
else:
DetectorEfficiencyCor(InputWorkspace=result_name,OutputWorkspace=result_name)
Logger.notice("_do_mono: finished DetectorEfficiencyCor")
logger.notice("_do_mono: finished DetectorEfficiencyCor")

# Ki/Kf Scaling...
if self.apply_kikf_correction:
Expand Down Expand Up @@ -497,7 +497,7 @@ def convert_to_energy(self, mono_run, ei, white_run=None, mono_van=None,\

return sample_wkspace
#----------------------------------------------------------------------------------
# COMPLEX SETTERS/GETTERS
# Complex setters/getters
#----------------------------------------------------------------------------------
def __getattribute__(self, name):
if name == "van_rmm":
Expand Down
28 changes: 13 additions & 15 deletions Code/Mantid/scripts/Inelastic/dgreduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,14 @@ def arb_units(wb_run,sample_run,ei_guess,rebin,map_file=None,monovan_run=None,**

# calculate absolute units integral and apply it to the workspace
if monovan_run != None or Reducer.mono_correction_factor != None :
deltaE_wkspace_sample = apply_absolute_normalization(Reducer,deltaE_wkspace_sample,monovan_run,ei_guess,wb_run,wksp_out)
deltaE_wkspace_sample = apply_absolute_normalization(Reducer,deltaE_wkspace_sample,monovan_run,ei_guess,wb_run)
results_name = deltaE_wkspace_sample.name();
else:
results_name=str(sample_run)+'.spe'

if mtd.doesExist(results_name)==True and results_name != wksp_out:
deltaE_wkspace_sample=RenameWorkspace(InputWorkspace=results_name,OutputWorkspace=wksp_out)


ei= (deltaE_wkspace_sample.getRun().getLogData("Ei").value)
print 'Incident energy found for sample run: ',ei,' meV'
Expand All @@ -264,14 +271,11 @@ def arb_units(wb_run,sample_run,ei_guess,rebin,map_file=None,monovan_run=None,**
if mtd.doesExist('_wksp.spe-white')==True:
DeleteWorkspace(Workspace='_wksp.spe-white')

results_name=str(sample_run)+'.spe'
if mtd.doesExist(results_name)==True:
deltaE_wkspace_sample=RenameWorkspace(InputWorkspace=results_name,OutputWorkspace=wksp_out)

return deltaE_wkspace_sample


def apply_absolute_normalization(Reducer,deltaE_wkspace_sample,monovan_run,ei_guess,wb_mono,wksp_out):
def apply_absolute_normalization(Reducer,deltaE_wkspace_sample,monovan_run,ei_guess,wb_mono):
""" Function applies absolute normalization factor to the target workspace
and calculates this factor if nececcary
Expand All @@ -288,6 +292,7 @@ def apply_absolute_normalization(Reducer,deltaE_wkspace_sample,monovan_run,ei_gu
print ' Value : ', absnorm_factor

else:
# TODO: !!!!
if Reducer.monovan_integr_range is None: # integration in the range relative to incident energy
Reducer.monovan_integr_range = [Reducer.monovan_lo_frac*ei_guess,Reducer.monovan_hi_frac*ei_guess]
print '##### Evaluate the integral from the monovan run and calculate the correction factor ######'
Expand All @@ -304,19 +309,12 @@ def apply_absolute_normalization(Reducer,deltaE_wkspace_sample,monovan_run,ei_gu
(absnorm_factorL,absnorm_factorSS,absnorm_factorP,absnorm_factTGP) = get_abs_normalization_factor(Reducer,deltaE_wkspace_monovan.getName(),ei_monovan)
print ' Absolute correction factor S^2 =',absnorm_factorSS,' Libisis: ',absnorm_factorL,' Puasonian: ',absnorm_factorP, ' TGP : ',absnorm_factTGP
absnorm_factor = absnorm_factTGP;



if mtd.doesExist('_wksp.spe-white')==True:
DeleteWorkspace(Workspace='_wksp.spe-white')




ws_out = RenameWorkspace(InputWorkspace=deltaE_wkspace_sample,OutputWorkspace=wksp_out)
ws_out = ws_out/absnorm_factor;
deltaE_wkspace_sample = deltaE_wkspace_sample/absnorm_factor;


return ws_out
return deltaE_wkspace_sample
def check_some_parameters(Reducer) :
monovan_mapfile
pass
Expand Down

0 comments on commit 99a8f64

Please sign in to comment.