ConvertUnits
From MantidProject
Contents |
Summary
Performs a unit change on the X values of a workspace
Properties
| Order | Name | Direction | Type | Default | Description |
|---|---|---|---|---|---|
| 1 | InputWorkspace | Input | Workspace | Mandatory | The name of the input workspace. |
| 2 | OutputWorkspace | Output | Workspace | Mandatory | The name to use for the output workspace. Can be the same as the input one. |
| 3 | Target | Input | string | Mandatory | The name of the unit to convert to (must be one of those registered in the Unit Factory). |
| 4 | EMode | Input | string | Elastic | The energy mode (Elastic, Direct or Indirect). |
| 5 | EFixed | Input | double | 0.0 | Value of fixed energy: EI (emode=Direct) or EF (emode=Indirect) (meV). Must be set for units that require it (e.g. ΔE), either here or in the instrument definition. |
| 6 | AlignBins | Input | boolean | false | If true, rebins if necessary to ensure that all spectra in the output workspace have identical bins (with linear binning) |
Description
Changes the units in which the X values of a workspace are represented. The available units are those registered with the Unit Factory. If the Y data is 'dimensioned' (i.e. has been divided by the bin width), then this will be correctly handled, but at present nothing else is done to the Y data. If the sample-detector distance cannot be calculated then the affected spectrum will be zeroed, and a warning message will be output on the logging service.
If AlignBins is false or left at the default the output workspace is a Ragged Workspace. If it is set to true then the data is automatically rebinned to a regular grid so that the maximum and minimum X values will be maintained, it uses the same number of bins a the input data, and divides them linearly equally between the minimum and maximum values.
If converting to ΔE any bins which correspond to a physically inaccessible will be removed, leading to an output workspace than is smaller than the input one. If the geometry is indirect then the value of EFixed will be taken, if available, from the instrument definition file.
Restrictions on the input workspace
- Naturally, the X values must have a unit set, and that unit must be known to the Unit Factory.
- Only histograms, not point data, can be handled at present.
- The algorithm will also fail if the source-sample distance cannot be calculated (i.e. the instrument has not been properly defined).
Available units
The units currently available to this algorithm are listed here, along with equations specifying exactly how the conversions are done.
Source Code
Header ConvertUnits.h
Source ConvertUnits.cpp
