Skip to content
Snippets Groups Projects
Commit ab68fa0d authored by Peter Parker's avatar Peter Parker
Browse files

Refs #9587 - Correct usage example.

parent 94e193b8
No related branches found
No related tags found
No related merge requests found
......@@ -71,7 +71,7 @@ value that should be excluded, then the entire bin is excluded. What
this means in practice is that the edge bins will possibly have a
reduced number of counts.
Restrictions on the input workspace
Restrictions on the Input Workspace
###################################
The input workspace must contain histogram data where the X unit is
......@@ -79,7 +79,7 @@ time-of-flight and the Y data is raw counts. The
`instrument <instrument>`__ associated with the workspace must be fully
defined because detector, source & sample position are needed.
Child algorithms used
Child Algorithms Used
#####################
If the input workspace contains more than a single spectrum, Unwrap
......@@ -87,4 +87,40 @@ makes use of the `rebin <rebin>`__ algorithm to set the bins on the
output workspace to common values which cover the maximum theoretically
accessible wavelength range.
Usage
-----
**Example - Unwrap Dummy Monitor**
.. testcode:: ExUnwrap
# Create dummy workspace.
ws = CreateSimulationWorkspace(Instrument="IRIS", BinParams="0,500,2000", UnitX="TOF")
# Get the reference length.
instrument = ws.getInstrument()
sample = instrument.getSample()
source = instrument.getSource()
detector = ws.getDetector(0)
sample_to_source = sample.getPos() - source.getPos()
r = detector.getDistance(sample)
x = sample_to_source.getZ()
l_ref = x + r
unwrapped_ws, join = UnwrapMonitor(ws, LRef=l_ref)
print "The join wavelength was %d." % join
print "The length used for the reference flight path was %d." % l_ref
print "The first spectra did contain %s." % str(ws.readY(0))
print "The first spectra now contains %s." % str(unwrapped_ws.readY(0))
Output:
.. testoutput:: ExUnwrap
The join wavelength was 0.
The length used for the reference flight path was 37.
The first spectra did contain [ 1. 1. 1. 1.].
The first spectra now contains [ 1.33333333 1.33333333 0.33333333].
.. categories::
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment