Table of Contents
Warning
ConvertUnitsUsingDetectorTable is deprecated and has no replacement.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | Name of the input workspace |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | Name of the output workspace, can be the same as the input |
Target | Input | string | Mandatory | The name of the units to convert to (must be one of those registered in the Unit Factory). Allowed values: [‘Degrees’, ‘DeltaE’, ‘DeltaE_inFrequency’, ‘DeltaE_inWavenumber’, ‘dSpacing’, ‘dSpacingPerpendicular’, ‘Empty’, ‘Energy’, ‘Energy_inWavenumber’, ‘Label’, ‘Momentum’, ‘MomentumTransfer’, ‘QSquared’, ‘SpinEchoLength’, ‘SpinEchoTime’, ‘Time’, ‘TOF’, ‘Wavelength’] |
DetectorParameters | Input | TableWorkspace | Name of a TableWorkspace containing the detector parameters to use instead of the IDF. | |
AlignBins | Input | boolean | False | If true (default is false), rebins after conversion to ensure that all spectra in the output workspace have identical bin boundaries. This option is not recommended (see http://www.mantidproject.org/ConvertUnits). |
ConvertFromPointData | Input | boolean | True | When checked, if the Input Workspace contains Points the algorithm ConvertToHistogram will be run to convert the Points to Bins. The Output Workspace will contains Bins. |
This algorithm functions in the same basic way as ConvertUnits v1 but instead of reading the geometric parameters from the instrument, it uses values that are specified in a TableWorkspace
The units currently available to this algorithm are listed here, along with equations specifying exactly how the conversions are done.
Example - Convert to wavelength using parameters from a table
# Create a host workspace
ws = CreateSampleWorkspace("Histogram",NumBanks=1,BankPixelWidth=1)
# Create a TableWorkspace to hold the detector parameters
detpars = CreateEmptyTableWorkspace()
detpars.addColumn("int", "spectra")
detpars.addColumn("double", "l1")
detpars.addColumn("double", "l2")
detpars.addColumn("double", "twotheta")
detpars.addColumn("double", "efixed")
detpars.addColumn("int", "emode")
# Add the parameters
detpars.addRow([1, 10.0, 5.0, 90.0, 0.0, 0])
wsOut = ConvertUnitsUsingDetectorTable(ws,Target="Wavelength",DetectorParameters=detpars)
print("Input {}".format(ws.readX(0)[ws.blocksize()-1]))
print("Output {:.11f}".format(wsOut.readX(0)[wsOut.blocksize()-1]))
Output:
Input 19800.0
Output 5.22196485301
Categories: Algorithms | Utility\Development | Deprecated
C++ source: ConvertUnitsUsingDetectorTable.cpp (last modified: 2017-10-03)
C++ header: ConvertUnitsUsingDetectorTable.h (last modified: 2016-12-19)