Skip to content
Snippets Groups Projects
Commit a4c286e8 authored by Nick Draper's avatar Nick Draper
Browse files

re #9590 Done up to and including 15

parent 0e98abda
No related branches found
No related tags found
No related merge requests found
Showing
with 275 additions and 5 deletions
......@@ -30,6 +30,22 @@ sub-algorithms as listed below.
#. :ref:`algm-DiffractionFocussing`
#. :ref:`algm-SortEvents` (event workspace only)
#. :ref:`algm-EditInstrumentGeometry` (if appropriate)
#. :ref:`algm-ConvertUnits` to time-of-f
#. :ref:`algm-ConvertUnits` to time-of-flight
Usage
-----
**Example: A simple Powgen example**
The files needed for this example are not present in our standard usage data download due to their size. They can however be downloaded using these links: `PG3_9830_event.nxs <https://github.com/mantidproject/systemtests/blob/master/Data/PG3_9830_event.nxs?raw=true>`_ and `pg3_mantid_det.cal <https://github.com/mantidproject/mantid/raw/master/Test/AutoTestData/pg3_mantid_det.cal>`_.
.. code-block:: python
PG3_9830_event = Load('PG3_9830_event.nxs')
PG3_9830_event = AlignAndFocusPowder(PG3_9830_event,
CalFileName='pg3_mantid_det.cal', Params='100')
.. categories::
......@@ -12,4 +12,30 @@ Description
Creates a single spectrum Workspace2D with X,Y, and E copied from an
first non-integrated dimension of a IMDHistoWorkspace.
Usage
-----
**Example**
.. testcode:: ExHasUB
ws = CreateMDHistoWorkspace(SignalInput='1,2,3,4,5,6,7,8,9',
ErrorInput='1,1,1,1,1,1,1,1,1', Dimensionality='2',
Extents='-1,1,-1,1', NumberOfBins='3,3', Names='A,B', Units='U,T')
print "%s is a %s" % (ws, ws.id())
wsOut=ConvertMDHistoToMatrixWorkspace(ws)
print "%s is a %s with %i histograms and %i bins" % (wsOut, wsOut.id(), wsOut.getNumberHistograms(), wsOut.blocksize())
Output:
.. testoutput:: ExHasUB
ws is a MDHistoWorkspace
wsOut is a Workspace2D with 1 histograms and 3 bins
.. categories::
......@@ -14,4 +14,33 @@ columns ColumnX, ColumnY, and ColumnE respectively. If ColumnE is not
set the E vector will be filled with 1s. The type of the columns must be
convertible to C++ double.
**Example**
.. testcode:: ExConvertTabletoMatrix
t=WorkspaceFactory.createTable()
t.addColumn("double","A")
t.addColumn("double","B")
t.addColumn("double","BError")
t.addRow([1,2,1])
t.addRow([3,4,1])
t.addRow([5,6,1])
#add it to the Mantid workspace list
mtd.addOrReplace("myTable",t)
ws=ConvertTableToMatrixWorkspace(t,"A","B","BError")
print "%s is a %s and the Y values are:" % (ws,ws.id())
print ws.readY(0)
Output:
.. testoutput:: ExConvertTabletoMatrix
ws is a Workspace2D and the Y values are:
[ 2. 4. 6.]
.. categories::
......@@ -16,10 +16,49 @@ larger sample in the :ref:`algm-AbsorptionCorrection`
algorithm. The sample shape will also need to be defined using, e.g.,
the :ref:`algm-CreateSampleShape` algorithm. Shapes are
defined using XML descriptions that can be found
`here <HowToDefineGeometricShape>`__.
`here <http://www.mantidproject.org/HowToDefineGeometricShape>`__.
Internally, this works by attaching the XML string (after validating it)
to a property called "GaugeVolume" on the workspace's `Run <Run>`__
to a property called "GaugeVolume" on the workspace's `Run <http://www.mantidproject.org/Run>`__
object.
Usage
-----
**Example: A simple spherical sample with a cuboid guage volume**
.. testcode:: ExSimpleSpereWithCuboidGuage
#setup the sample shape
sphere = '''<sphere id="sample-sphere">
<centre x="0" y="0" z="0"/>
<radius val=".2" />
</sphere>'''
ws = CreateSampleWorkspace("Histogram",NumBanks=1,BankPixelWidth=1)
ws = ConvertUnits(ws,"Wavelength")
ws = Rebin(ws,Params=[1])
CreateSampleShape(ws,sphere)
SetSampleMaterial(ws,ChemicalFormula="V")
#setup the guage volume
cuboid = '''<cuboid id="shape">
<left-front-bottom-point x="0.01" y="-0.1" z="0.0" />
<left-front-top-point x="0.01" y="-0.1" z="0.02" />
<left-back-bottom-point x="-0.01" y="-0.1" z="0.0" />
<right-front-bottom-point x="0.01" y="0.1" z="0.0" />
</cuboid>'''
DefineGaugeVolume(ws,cuboid)
#restrict the number of wavelength points to speed up the example
wsOut = AbsorptionCorrection(ws,NumberOfWavelengthPoints=5)
print "The created workspace has one entry for each spectra: %i" % wsOut.getNumberHistograms()
Output:
.. testoutput:: ExSimpleSpereWithCuboidGuage
The created workspace has one entry for each spectra: 1
.. categories::
......@@ -12,4 +12,26 @@ Description
Workflow algorithm to determine chunking strategy for event nexus,
runinfo.xml, raw, or histo nexus files
Usage
-----
**Example**
.. testcode:: ExDeterminChuncking
ws=DetermineChunking("CNCS_7860_event.nxs",MaxChunkSize=0.0005)
print "A max chunck size of 0.0005 created %i chunks." % ws.rowCount()
#The algorithm can also use the SNS runinfo.xml file
ws2=DetermineChunking("CNCS_7860_runinfo.xml",MaxChunkSize=0.0010)
print "A max chunck size of 0.0010 created %i chunks." % ws2.rowCount()
Output:
.. testoutput:: ExDeterminChuncking
A max chunck size of 0.0005 created 11 chunks.
A max chunck size of 0.0010 created 6 chunks.
.. categories::
......@@ -12,4 +12,11 @@ Description
Simulates ISIS histogram DAE. It runs continuously until canceled and
listens to port 6789 for ISIS DAE commands.
Usage
-----
Listening to the fake service requires a bit more setup than is simple to provide in a usage example.
Email mantid-help@mantidproject.org if you need further details.
.. categories::
......@@ -22,4 +22,24 @@ Notable points:
by the provided SignalBackground parameter.
- Calculated Qlab follows the Busy, Levy 1967 convention.
Usage
-----
**Example**
.. testcode:: ExFindSXPeaksSimple
# create histogram workspace
ws=CreateSampleWorkspace()
wsPeaks = FindSXPeaks(ws)
print "Peaks found: " + str(wsPeaks.getNumberPeaks())
Output:
.. testoutput:: ExFindSXPeaksSimple
Peaks found: 174
.. categories::
......@@ -13,4 +13,37 @@ Determine if a workspace has a UB matrix on any of it's samples. Returns
True if one is found. Returns false if none can be found, or if the
workspace type is incompatible.
Usage
-----
**Example**
.. testcode:: ExHasUB
# create histogram workspace
ws=CreateSampleWorkspace()
returnVal = HasUB(ws)
print "Before SetUB does %s have a UB Matrix? %s" % (ws,returnVal)
SetUB(ws,1,1,1,90,90,90)
returnVal = HasUB(ws)
print "After SetUB does %s have a UB Matrix? %s" % (ws,returnVal)
#This python call to the workspace gives the same information
returnVal = ws.sample().hasOrientedLattice()
print "Using ws.sample().hasOrientedLattice() does %s have a UB Matrix? %s" % (ws,returnVal)
Output:
.. testoutput:: ExHasUB
Before SetUB does ws have a UB Matrix? False
After SetUB does ws have a UB Matrix? True
Using ws.sample().hasOrientedLattice() does ws have a UB Matrix? True
.. categories::
......@@ -10,7 +10,7 @@ Description
-----------
This algorithm is called on a regular interval by the
:ref:`algm-MonitorLiveData` algorithm. **It should not be
:ref:`algm-MonitorLiveData` algorithm. and the whole process is started by the :ref:`algm-StartLiveData` algorithm. **It should not be
necessary to call LoadLiveData directly.**
.. figure:: /images/LoadLiveData_flow.png
......@@ -93,4 +93,10 @@ Post-Processing Step
*PostProcessingScript* (same way as above), the
*AccumulationWorkspace* is processed into the *OutputWorkspace*
Usage
-----
LoadLiveData is not intended for usage directly, it is part of he process that is started using :ref:`algm-StartLiveData`.
.. categories::
......@@ -21,4 +21,9 @@ This algorithm simply calls :ref:`algm-LoadLiveData` at the given
For details on the way to specify the data processing steps, see:
`LoadLiveData <LoadLiveData#Description>`__.
Usage
-----
LoadLiveData is not intended for usage directly, it is part of he process that is started using :ref:`algm-StartLiveData`.
.. categories::
......@@ -12,6 +12,70 @@ Description
Uses the binary operation algorithms :ref:`algm-Multiply` or
:ref:`algm-Plus` to scale the input workspace by the amount requested.
This algorithm is provided as a simple, but less powerful, alternative
to the python `workspace algebra <Workspace_Algebra>`__ functionality.
to the python `workspace algebra <http://www.mantidproject.org/MatrixWorkspace_Attributes#Workspace_algebra>`__ functionality.
Usage
-----
**Example: Adding an offset**
.. testcode:: ExOffsetScale
ws = CreateSampleWorkspace(BankPixelWidth=1)
print "Every 10th bin value of " + ws.getName()
print ws.readY(0)[0:100:10]
# Add 2 using scale
wsOffset = Scale(ws,2,"Add")
print "Every 10th bin value of " + wsOffset.getName()
print wsOffset.readY(0)[0:100:10]
# Add 2 using the workspace operator overloads
wsOffset2 = ws + 2
print "Every 10th bin value of " + wsOffset2.getName()
print wsOffset2.readY(0)[0:100:10]
Output:
.. testoutput:: ExOffsetScale
Every 10th bin value of ws
[ 0.3 0.3 0.3 0.3 0.3 10.3 0.3 0.3 0.3 0.3]
Every 10th bin value of wsOffset
[ 2.3 2.3 2.3 2.3 2.3 12.3 2.3 2.3 2.3 2.3]
Every 10th bin value of wsOffset2
[ 2.3 2.3 2.3 2.3 2.3 12.3 2.3 2.3 2.3 2.3]
**Example: Multiplying by a value**
.. testcode:: ExOffsetScale
ws = CreateSampleWorkspace(BankPixelWidth=1)
print "Every 10th bin value of " + ws.getName()
print ws.readY(0)[0:100:10]
# Multiply by 10 using scale
wsScaled = Scale(ws,10,"Multiply")
print "Every 10th bin value of " + wsScaled.getName()
print wsScaled.readY(0)[0:100:10]
# Multiply by 10 using the workspace operator overloads
wsScaled2 = ws * 10
print "Every 10th bin value of " + wsScaled2.getName()
print wsScaled2.readY(0)[0:100:10]
Output:
.. testoutput:: ExOffsetScale
Every 10th bin value of ws
[ 0.3 0.3 0.3 0.3 0.3 10.3 0.3 0.3 0.3 0.3]
Every 10th bin value of wsScaled
[ 3. 3. 3. 3. 3. 103. 3. 3. 3. 3.]
Every 10th bin value of wsScaled2
[ 3. 3. 3. 3. 3. 103. 3. 3. 3. 3.]
.. categories::
......@@ -74,4 +74,7 @@ unique names for the *OutputWorkspace*.
Please note that you may be limited in how much simultaneous processing
you can do by your available memory and CPUs.
.. Usage examples need the fake services to be available in a test facility
.. Ticket #9671
.. categories::
Code/Mantid/docs/source/images/LoadLiveData_flow.png

32.6 KiB

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