\(\renewcommand\AA{\unicode{x212B}}\)
ConvertUnitsUsingDetectorTable v1¶
Warning
ConvertUnitsUsingDetectorTable is deprecated and has no replacement.
Summary¶
Performs a unit change on the X values of a workspace
See Also¶
ConvertAxisByFormula, ConvertAxesToRealSpace, ConvertSpectrumAxis, ConvertToYSpace
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
Name of the input workspace |
|
OutputWorkspace |
Output |
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: [‘DeltaE’, ‘DeltaE_inFrequency’, ‘DeltaE_inWavenumber’, ‘dSpacing’, ‘dSpacingPerpendicular’, ‘Energy’, ‘Energy_inWavenumber’, ‘Momentum’, ‘MomentumTransfer’, ‘QSquared’, ‘SpinEchoLength’, ‘SpinEchoTime’, ‘TOF’, ‘Wavelength’] |
DetectorParameters |
Input |
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. |
Description¶
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
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.
Usage¶
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: AlgorithmIndex | Utility\Development | Deprecated
Source¶
C++ header: ConvertUnitsUsingDetectorTable.h
C++ source: ConvertUnitsUsingDetectorTable.cpp