Table of Contents
Converts the axis of a Workspace2D which normally holds spectrum numbers to some other unit, which will normally be some physical value about the instrument such as Q, Q^2 or theta. ‘Note’: After running this algorithm, some features will be unavailable on the workspace as it will have lost all connection to the instrument. This includes things like the 3D Instrument Display.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | The name of the input workspace. |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | The name to use for the output workspace. |
Target | Input | string | Mandatory | The unit to which the spectrum axis should be converted. This can be either “theta” (for <math>theta</math> degrees), or any of the IDs known to the [[Unit Factory]]. Allowed values: [‘Degrees’, ‘DeltaE’, ‘DeltaE_inWavenumber’, ‘dSpacing’, ‘Empty’, ‘Energy’, ‘Energy_inWavenumber’, ‘Label’, ‘Momentum’, ‘MomentumTransfer’, ‘QSquared’, ‘SpinEchoLength’, ‘SpinEchoTime’, ‘Time’, ‘TOF’, ‘Wavelength’, ‘theta’, ‘signed_theta’] |
EMode | Input | string | Direct | Some unit conversions require this value to be set (“Direct” or “Indirect”). Allowed values: [‘Direct’, ‘Indirect’] |
EFixed | Input | number | Optional | Value of fixed energy in meV : EI (EMode=Direct) or EF (EMode=Indirect)) |
Converts the representation of the vertical axis (the one up the side of a matrix in MantidPlot) of a Workspace2D from its default of holding the spectrum number to the target unit given.
The spectra will be reordered in increasing order by the new unit and duplicates will not be aggregated. Any spectrum for which a detector is not found (i.e. if the instrument definition is incomplete) will not appear in the output workspace.
For units other than , the value placed in the axis is generated by using the ConvertUnits v1 methods to translate the values of the first and last bin for the current X-data unit into the target unit, then taking the mid-point of these.
Example: Convert Vertical Axis to Theta
# Creates a workspace with some detectors attached
dataws = CreateSampleWorkspace(NumBanks=1,BankPixelWidth=2) # 2x2 detector
theta = ConvertSpectrumAxis(dataws, Target="theta", Version=1)
vertical_axis = theta.getAxis(1)
print "There are %d axis values" % vertical_axis.length()
print "Final theta value: %f (degrees)" % vertical_axis.getValue(vertical_axis.length() - 1)
There are 4 axis values
Final theta value: 0.129645 (degrees)
Categories: Algorithms | Transforms | Units | Transforms | Axes