DetectorEfficiencyCorUser v1

../_images/DetectorEfficiencyCorUser-v1_dlg.png

DetectorEfficiencyCorUser dialog.

Summary

This algorithm calculates the detector efficiency according the formula set in the instrument definition file/parameters.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory The workspace to correct for detector efficiency
OutputWorkspace Output MatrixWorkspace Mandatory The name of the workspace in which to store the result.
IncidentEnergy Input number Optional The energy of neutrons leaving the source.

Description

This algorithm will correct detector efficiency according to the ILL INX program for time-of-flight data reduction.

A formula named “formula_eff” must be defined in the instrument parameters file. The input workspace must be in DeltaE units.

The output data will be corrected as:

y = \frac{y}{eff}

where eff is

eff = \frac{f(Ei - \Delta E)}{f(E_i)}

The function f is defined as “formula_eff” in the IDF. To date this has been implemented at the ILL for ILL IN4, IN5 and IN6.

Usage

Example - A sample correction

# a sample workspace with a sample instrument
ws = CreateSampleWorkspace()
# convert to Wavelength
ws = ConvertUnits(ws,"DeltaE",EMode="Direct",EFixed=3.27)

correction_formula = "exp(-0.0565/sqrt(e))*(1.0-exp(-3.284/sqrt(e)))"
SetInstrumentParameter(ws,ParameterName="formula_eff",Value=correction_formula)


#Now we are ready to run the correction
wsCorrected = DetectorEfficiencyCorUser(ws)


print ("The correction correct the data by the user defined function.")
print ("In this case: " + correction_formula)
for i in range(0,wsCorrected.blocksize(),10):
  print ("The correct value in bin %i is %.2f compared to %.2f" % (i,wsCorrected.readY(0)[i],ws.readY(0)[i]))

Output:

The correction correct the data by the user defined function.
In this case: exp(-0.0565/sqrt(e))*(1.0-exp(-3.284/sqrt(e)))
The correct value in bin 0 is 5.53 compared to 0.30
The correct value in bin 10 is 0.53 compared to 0.30
The correct value in bin 20 is 0.36 compared to 0.30
The correct value in bin 30 is 0.30 compared to 0.30

Categories: Algorithms | CorrectionFunctions | EfficiencyCorrections | Inelastic