Skip to content

Commit

Permalink
Re #6709 the rest of the algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
NickDraper committed Mar 15, 2013
1 parent d1afc81 commit baf143f
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 87 deletions.
15 changes: 3 additions & 12 deletions Code/Mantid/Framework/DataHandling/src/LoadIsawDetCal.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
/*WIKI*
Moves the detectors in an instrument using the origin and 2 vectors of the rotated plane from an ISAW DetCal file.
==Usage==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
LoadIsawDetCal("SNAP_4111","SNAP.DetCal")
Expand All @@ -16,12 +12,7 @@ Moves the detectors in an instrument using the origin and 2 vectors of the rotat
alg->setPropertyValue("InputWorkspace", "SNAP_4111");
alg->setPropertyValue("Filename", "SNAP.DetCal");
alg->execute();
*WIKI*/
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions Code/Mantid/Framework/MDAlgorithms/src/AndMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ Perform the And boolean operation on two MDHistoWorkspaces.
The & operation is performed element-by-element.
A signal of 0.0 means "false" and any non-zero signal is "true".
== Usage ==
*WIKI*/
/*WIKI_USAGE*
C = A & B
A &= B
See [[MDHistoWorkspace#Boolean_Operations|this page]] for examples on using boolean operations.
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDAlgorithms/AndMD.h"
#include "MantidKernel/System.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/*WIKI*
Takes two arrays of signal and error values, as well as information describing the dimensionality and extents, and creates a MDHistoWorkspace (histogrammed multi-dimensional workspace). The ''SignalInput'' and ''ErrorInput'' arrays must be of equal length and have a length that is equal to the product of all the comma separated arguments provided to '''NumberOfBins'''. The order in which the arguments are specified to each of the properties (for those taking multiple arguments) is important, as they are assumed to match by the order they are declared. For example, specifying '''Names'''='A,B' and '''Units'''='U1,U2' will generate two dimensions, the first with a name of ''A'' and units of ''U1'' and the second with a name of ''B'' and units of ''U2''. The same logic applies to the '''Extents''' inputs. Signal and Error inputs are read in such that, the first entries in the file will be entered across the first dimension specified, and the zeroth index in the other dimensions. The second set of entries will be entered across the first dimension and the 1st index in the second dimension, and the zeroth index in the others.
== Usage ==
== Alternatives ==
A very similar algorithm to this is [[ImportMDHistoWorkspace]], which takes it's input signal and error values from a text file rather than from arrays. Another alternative is to use [[CnvrtToMD]] which works on MatrixWorkspaces, and allows log values to be included in the dimensionality.
[[Category:MDAlgorithms]]
*WIKI*/
/*WIKI_USAGE*
The following example creates a 2D MDHistoWorkspace called ''demo'' with 3 bins in each dimension and and extents spanning from -1 to 1 in each dimension. The first dimension is called A, and has units of U, the second is called B and has units of T.
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',OutputWorkspace='demo')
Expand All @@ -23,13 +28,7 @@ The following example creates a 1D sine function
signals.append(math.sin(x))
errors.append(math.cos(x))
CreateMDHistoWorkspace(SignalInput=signals,ErrorInput=errors,Dimensionality=dimensionality,Extents=extents,NumberOfBins=nbins,Names='x',Units='dimensionless',OutputWorkspace='demo')
== Alternatives ==
A very similar algorithm to this is [[ImportMDHistoWorkspace]], which takes it's input signal and error values from a text file rather than from arrays. Another alternative is to use [[CnvrtToMD]] which works on MatrixWorkspaces, and allows log values to be included in the dimensionality.
[[Category:MDAlgorithms]]
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDAlgorithms/CreateMDHistoWorkspace.h"
#include "MantidKernel/ArrayProperty.h"
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/MDAlgorithms/src/DivideMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ The error of <math> f = a / b </math> is propagated with <math> df^2 = f^2 * (da
* '''[[MDEventWorkspace]]'s'''
** This operation is not supported, as it is not clear what its meaning would be.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
C = A / B
C = A / 123.4
A /= B
A /= 123.4
See [[MDHistoWorkspace#Arithmetic_Operations|this page]] for examples on using arithmetic operations.
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDAlgorithms/DivideMD.h"
#include "MantidKernel/System.h"
Expand Down
8 changes: 3 additions & 5 deletions Code/Mantid/Framework/MDAlgorithms/src/EqualToMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ For two MDHistoWorkspaces, the operation is performed element-by-element. Only t
For a MDHistoWorkspace and a scalar, the operation is performed on each element of the output.
== Usage ==
See [[MDHistoWorkspace#Boolean_Operations|this page]] for examples on using boolean operations.
*WIKI*/

/*WIKI_USAGE*
See [[MDHistoWorkspace#Boolean_Operations|this page]] for examples on using boolean operations.
*WIKI_USAGE*/
#include "MantidMDAlgorithms/EqualToMD.h"
#include "MantidKernel/System.h"

Expand Down
7 changes: 3 additions & 4 deletions Code/Mantid/Framework/MDAlgorithms/src/GreaterThanMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ For two MDHistoWorkspaces, the operation is performed element-by-element.
For a MDHistoWorkspace and a scalar, the operation is performed on each element of the output.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
# Compare two workspaces, element-by-element
C = A < B
# Compare a workspace and a number, element-by-element
C = A < 123.4
See [[MDHistoWorkspace#Boolean_Operations|this page]] for examples on using boolean operations.
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDAlgorithms/GreaterThanMD.h"
#include "MantidKernel/System.h"
Expand Down
8 changes: 3 additions & 5 deletions Code/Mantid/Framework/MDAlgorithms/src/LessThanMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ The output workspace has a signal of 0.0 to mean "false" and a signal of 1.0 to
For two MDHistoWorkspaces, the operation is performed element-by-element.
For a MDHistoWorkspace and a scalar, the operation is performed on each element of the output.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
# Compare two workspaces, element-by-element
C = A > B
# Compare a workspace and a number, element-by-element
C = A > 123.4
See [[MDHistoWorkspace#Boolean_Operations|this page]] for examples on using boolean operations.
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDAlgorithms/LessThanMD.h"
#include "MantidKernel/System.h"
Expand Down
8 changes: 3 additions & 5 deletions Code/Mantid/Framework/MDAlgorithms/src/MinusMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ Subtract two [[MDHistoWorkspace]]'s or a MDHistoWorkspace and a scalar.
** The number of events in the output MDEventWorkspace is that of the LHS and RHS workspaces put together.
* '''[[MDEventWorkspace]] - Scalar or MDHistoWorkspace'''
** This is not possible.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
C = A - B
C = A - 123.4
A -= B
A -= 123.4
See [[MDHistoWorkspace#Arithmetic_Operations|this page]] for examples on using arithmetic operations.
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDAlgorithms/MinusMD.h"
#include "MantidKernel/System.h"
Expand Down
7 changes: 3 additions & 4 deletions Code/Mantid/Framework/MDAlgorithms/src/MultiplyMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ The error of <math> f = a * b </math> is propagated with <math>df^2 = f^2 * (da^
** Every element of the MDHistoWorkspace is multiplied by the scalar.
* '''[[MDEventWorkspace]]'s'''
** This operation is not supported, as it is not clear what its meaning would be.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
C = A * B
C = A * 123.4
A *= B
A *= 123.4
See [[MDHistoWorkspace#Arithmetic_Operations|this page]] for examples on using arithmetic operations.
*WIKI*/
*WIKI_USAGE*/

#include "MantidKernel/System.h"
#include "MantidMDAlgorithms/MultiplyMD.h"
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/MDAlgorithms/src/NotMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ The not operation is performed element-by-element.
Any 0.0 signal is changed to 1.0 (meaning true).
Any non-zero signal is changed to 0.0 (meaning false).
== Usage ==
*WIKI*/
/*WIKI_USAGE*
B = ~A
A = ~A
See [[MDHistoWorkspace#Boolean_Operations|this page]] for examples on using boolean operations.
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDAlgorithms/NotMD.h"
#include "MantidKernel/System.h"
Expand Down
8 changes: 3 additions & 5 deletions Code/Mantid/Framework/MDAlgorithms/src/OrMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
Perform the Or boolean operation on two MDHistoWorkspaces.
The || operation is performed element-by-element.
A signal of 0.0 means "false" and any non-zero signal is "true".
== Usage ==
*WIKI*/
/*WIKI_USAGE*
C = A | B
A |= B
See [[MDHistoWorkspace#Boolean_Operations|this page]] for examples on using boolean operations.
*WIKI*/

*WIKI_USAGE*/
#include "MantidMDAlgorithms/OrMD.h"
#include "MantidKernel/System.h"

Expand Down
8 changes: 3 additions & 5 deletions Code/Mantid/Framework/MDAlgorithms/src/PlusMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ See [[CloneMDWorkspace]] for details, but note that a file-backed [[MDEventWorks
Also, be aware that events added to a MDEventWorkspace are currently added '''in memory''' and are not cached to file until [[SaveMD]]
or another algorithm requiring it is called. The workspace is marked as 'requiring file update'.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
C = A + B
C = A + 123.4
A += B
A += 123.4
See [[MDHistoWorkspace#Arithmetic_Operations|this page]] for examples on using arithmetic operations.
*WIKI*/
*WIKI_USAGE*/

#include "MantidAPI/IMDEventWorkspace.h"
#include "MantidKernel/System.h"
Expand Down
7 changes: 3 additions & 4 deletions Code/Mantid/Framework/MDAlgorithms/src/WeightedMeanMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Takes two MDHistoWorkspaces and calculates the weighted mean for each bin. See [[WeightedMean]] for more details on the algorithm workings. Both inputs must be MDHistoWorkspaces, the algorithm will not run with MDEventWorkspaces.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
The following utilises [[WeightedMean]] and [[WeightedMeanMD]] to inspect the same data.
import math
Expand Down Expand Up @@ -37,8 +37,7 @@ The following utilises [[WeightedMean]] and [[WeightedMeanMD]] to inspect the sa
# Produce the weithed mean as a 1D MD workspace. Contents sould be identical to the output created above.
mean_md = WeightedMeanMD(LHSWorkspace=md_1,RHSWorkspace=md_2)
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDAlgorithms/WeightedMeanMD.h"
#include "MantidMDEvents/MDHistoWorkspaceIterator.h"
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/MDAlgorithms/src/XorMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Perform the Xor (exclusive-or) boolean operation on two MDHistoWorkspaces.
The xor operation is performed element-by-element.
A signal of 0.0 means "false" and any non-zero signal is "true".
== Usage ==
*WIKI*/
/*WIKI_USAGE*
C = A ^ B
A ^= B
See [[MDHistoWorkspace#Boolean_Operations|this page]] for examples on using boolean operations.
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDAlgorithms/XorMD.h"
#include "MantidKernel/System.h"
Expand Down
13 changes: 6 additions & 7 deletions Code/Mantid/Framework/MDEvents/src/ImportMDEventWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ The usage example below shows demo files with both of these formats.
Comments are denoted by lines starting with '''#'''. There is no multi-line comment.
== Usage ==
== Alternatives ==
Other alternatives to importing/creating MDWorkspaces are [[ImportMDHistoWorkspace]], [[CreateMDHistoWorkspace]] and [[CreateMDWorkspace]]
*WIKI*/
/*WIKI_USAGE*
The following example creates a 2D MDEventWorkspace called ''demo'' with 10 * 2 bins.
Expand Down Expand Up @@ -84,12 +88,7 @@ The equivalent with run numbers and detector ids specified is:
2.7 1.10 1 19 -0.3 1
2.8 1.00 1 20 -0.2 1
2.9 0.90 1 20 -0.1 1
== Alternatives ==
Other alternatives to importing/creating MDWorkspaces are [[ImportMDHistoWorkspace]], [[CreateMDHistoWorkspace]] and [[CreateMDWorkspace]]
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDEvents/ImportMDEventWorkspace.h"
#include "MantidKernel/System.h"
Expand Down
15 changes: 7 additions & 8 deletions Code/Mantid/Framework/MDEvents/src/ImportMDHistoWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ The Names, Units, Extents and NumberOfBins inputs are all linked by the order th
Signal and Error inputs are read in such that, the first entries in the file will be entered across the first dimension specified, and the zeroth index in the other dimensions. The second set of entries will be entered across the first dimension and the 1st index in the second dimension, and the zeroth index in the others.
== Usage ==
== Alternatives ==
A very similar algorithm to this is [[CreateMDHistoWorkspace]], which takes it's input signal and error values from arrays rather than a text file. Another alternative is to use [[ConvertToMD]] which works on MatrixWorkspaces, and allows log values to be included in the dimensionality.
[[Category:MDAlgorithms]]
*WIKI*/
/*WIKI_USAGE*
The following call will create an MDHistoWorkspace called ''demo'' with 3 dimensions with 2 bins in each dimension. Each dimension will
span from -1 to 1 in units of T.
Expand All @@ -29,13 +34,7 @@ And here's the corresponding contents of ''demo.txt'':
6 6.1
7 7.1
8 8.1
== Alternatives ==
A very similar algorithm to this is [[CreateMDHistoWorkspace]], which takes it's input signal and error values from arrays rather than a text file. Another alternative is to use [[ConvertToMD]] which works on MatrixWorkspaces, and allows log values to be included in the dimensionality.
[[Category:MDAlgorithms]]
*WIKI*/
*WIKI_USAGE*/

#include "MantidMDEvents/ImportMDHistoWorkspace.h"
#include "MantidAPI/FileProperty.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""*WIKI*
== Usage ==
== Source Code ==
The source code for the Python Algorithm may be viewed at: [http://trac.mantidproject.org/mantid/browser/trunk/Code/Mantid/Framework/PythonAPI/PythonAlgorithms/OSIRISDiffractionReduction.py OSIRISDiffractionReduction.py]
Expand All @@ -8,6 +7,7 @@
*WIKI*"""


from MantidFramework import *
from mantidsimple import *

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""*WIKI*
This algorithms writes a cal file with the selection column set to the masking status of the workspaces provided. The offsets and grouping details of the cal file are not completed, so you would normally use MargeCalFiles afterwards to import these values from another file.
== Usage ==
*WIKI*"""
"""*WIKI_USAGE*
Example:
#Load up two workspaces and mask some data
ws1=Load("GEM38370")
Expand Down Expand Up @@ -32,8 +33,7 @@
MergeCalFiles(UpdateFile = dataDir+"mask.cal", MasterFile=dataDir+"offsets_2006_cycle064.cal", \
OutputFile=dataDir+"resultCal.cal", MergeOffsets=False, MergeSelections=True,MergeGroups=False)
*WIKI*"""
*WIKI_USAGE*"""
import sys
from mantid.kernel import *
from mantid.api import *
Expand Down

0 comments on commit baf143f

Please sign in to comment.