.. algorithm:: .. summary:: .. relatedalgorithms:: .. properties:: Description ----------- This algorithm converts a workspace from (spectrum number, TOF) coordinates to (:math:`2\theta`, TOF). The latter view is useful for visualization and diagnostics purposes of direct geometry spectrometers with large PSD arrays. The algorithm performs the following steps: #. Equalize the sample-to-detector distances using :ref:`ConvertToConstantL2 ` #. :ref:`Rebin ` the ragged workspace to same binning over all histograms. The bin width is taken from the first bin of the first histogram. This will introduce zero padding to the histograms. #. Mask the zero padding using :ref:`MaskNonOverlappingBins `. #. Group the detectors to given :math:`2\theta` bins using :ref:`GenerateGroupingPowder ` and :ref:`GroupDetectors `. #. Convert the spectrum axis from spectrum numbers to :math:`2\theta` using :ref:`ConvertSpectrumAxis ` A default ``AngleStep`` can be defined in the :ref:`instrument parameters `. The parameter is called ``natural-angle-step``; its type should be ``float`` and value the desired ``AngleStep`` in degrees. The instrument should have an ``l2`` parameter defined which is the nominal sample to detector distance. Also, sample logs should include a ``wavelength`` entry (in Angstroms). See :ref:`ConvertToConstantL2 ` for more details. By default, the ``.xml`` and ``.par`` files generated by :ref:`GenerateGroupingPowder ` are stored in a temporary location and deleted when the algorithm finishes. If these files are needed afterwards, a name for the ``.xml`` file can be given by ``GroupingFilename``. The ``.par`` file will have the same name except for the file extension which is changed from ``.xml`` to ``.par``. Note that this algorithm forces the ``.xml`` extension to ``GroupingFilename``. Usage ----- **Example - Applying SofTwoThetaTOF and plotting the result** .. plot:: :include-source: from mantid.simpleapi import * import directtools as dt ws = CreateSampleWorkspace(Function='Quasielastic Tunnelling', NumBanks=1, BankPixelWidth=20) AddSampleLog(ws, 'wavelength', '6.26', 'Number', 'Angstrom') SetInstrumentParameter(ws, ParameterName='l2', ParameterType='String', Value='5') SofTT = SofTwoThetaTOF(ws, AngleStep=1) fig, axes = dt.subplots() axes.pcolor(SofTT) axes.set_xlim(0.) # Uncomment the line below to show the plot. #fig.show() .. categories:: .. sourcelink::