$$\renewcommand\AA{\unicode{x212B}}$$

# GetEiMonDet v3¶

## Summary¶

Calculates the kinetic energy of neutrons leaving the source based on the time it takes for them to travel between a monitor and a set of detectors.

GetEi

## Properties¶

Name

Direction

Type

Default

Description

DetectorWorkspace

Input

MatrixWorkspace

Mandatory

A workspace containing the detector spectra.

DetectorWorkspaceIndexType

Input

string

The type of indices in the optional index set; For optimal performance WorkspaceIndex should be preferred;. Allowed values: [‘WorkspaceIndex’, ‘SpectrumNumber’]

DetectorWorkspaceIndexSet

Input

long list

An optional set of spectra that will be processed by the algorithm; If not set, all spectra will be processed; The indices in this list can be workspace indices or possibly spectrum numbers, depending on the selection made for the index type; Indices are entered as a comma-separated list of values, and/or ranges; For example, ‘4,6,10-20,1000’;

MonitorWorkspace

Input

MatrixWorkspace

A Workspace containing the monitor spectrum; if empty, DetectorWorkspace will be used.

MonitorEPPTable

Input

TableWorkspace

An EPP table corresponding to MonitorWorkspace

MonitorIndex

Input

number

Mandatory

Usable monitor’s workspace index.

PulseInterval

Input

number

Optional

Interval between neutron pulses, in microseconds; taken from the sample logs, if not specified.

MaximumEnergy

Input

number

Optional

Multiple pulse intervals will be added to the flight time the until final energy is less than this value.

IncidentEnergy

Output

number

Calculated incident energy, in meV.

## Description¶

This algorithm calculates the incident energy from the time-of-flight between one monitor and some detectors. The detector spectra are summed together using GroupDetectors and a Gaussian is fitted to both the monitor and summed detector data, the difference in the peak positions giving the time-of-flight. If the detector peak is before the monitor one, one pulse interval is added to the time-of-flight. The pulse interval can be given by the PulseInterval property or it is read from the sample logs under the entry pulse_interval (in seconds). It is also possible to specify a maximum expected neutron energy by MaximumEnergy. The pulse interval is added to the time-of-flight also if the calculated energy exceeds this value.

If the monitor peak has been previously fitted using FindEPP, one fitting step can be omitted by supplying the EPP table via MonitorEPPWorkspace.

If no MonitorWorkspace is specified, the monitor spectrum is expected to be in the detector workspace. DetectorWorkspaceIndexSet understands complex expression, for example 2,3,5-7,101 would use detectors 2, 3, 5, 6, 7, and 101 for the computation.

## Usage¶

Example - simple incident energy calibration:

import numpy

spectrum = 'name = Gaussian, PeakCentre = 1000.0, Height = 500.0, Sigma = 30.0'
ws = CreateSampleWorkspace(WorkspaceType='Histogram', XUnit='TOF',
XMin=100.0, XMax=1100.0, BinWidth=10.0,
NumBanks=1, NumMonitors=1,
Function='User Defined', UserDefinedFunction=spectrum, BankDistanceFromSample = 1.5)
# Shift monitor Y and E data
shift = -70
calibratedE_i = GetEiMonDet(DetectorWorkspace=ws,
DetectorWorkspaceIndexSet="1-100", MonitorIndex=0)

print('Calibrated energy: {0:.3f}'.format(calibratedE_i))


Output:

Calibrated energy: 53.298


Example - using separate monitor workspace and monitor EPP table:

import numpy
from scipy.constants import elementary_charge, neutron_mass

spectrum = 'name = Gaussian, PeakCentre = 1000.0, Height = 500.0, Sigma = 30.0'
ws = CreateSampleWorkspace(WorkspaceType='Histogram', XUnit='TOF',
XMin=100.0, XMax=1100.0, BinWidth=10.0,
NumBanks=1, NumMonitors=1,
Function='User Defined', UserDefinedFunction=spectrum, BankDistanceFromSample = 1.5)
# Shift monitor Y and E data
shift = -70
ExtractMonitors(ws, DetectorWorkspace='detectors', MonitorWorkspace='monitors')
monitorEPPs = FindEPP('monitors')
calibratedE_i = GetEiMonDet(DetectorWorkspace='detectors',
DetectorWorkspaceIndexSet="0-99", MonitorWorkspace='monitors', MonitorEPPTable=monitorEPPs, MonitorIndex=0)

print('Calibrated energy: {0:.3f}'.format(calibratedE_i))


Output:

Calibrated energy: 53.298


Categories: AlgorithmIndex | Inelastic\Ei