Skip to content

Commit

Permalink
Re #6709 several algorithms changed to new format
Browse files Browse the repository at this point in the history
  • Loading branch information
NickDraper committed Mar 15, 2013
1 parent a58d83d commit 4a06128
Show file tree
Hide file tree
Showing 23 changed files with 89 additions and 105 deletions.
5 changes: 3 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/AsymmetryCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ The output workspace contains one set of data for the time of flight, the asymme
Note: this algorithm does not perform any grouping; the grouping must be done via the GroupDetectors algorithm or when the NeXus file is loaded auto_group must be set to true.
==Usage==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
AsymmetryCalc("EmuData","OutWS","1.0","0,1,2,3,4","16,17,18,19,20")
Expand All @@ -25,7 +26,7 @@ Note: this algorithm does not perform any grouping; the grouping must be done vi
alg->execute();
Workspace* ws = FrameworkManager::Instance().getWorkspace("OutWS");
*WIKI*/
*WIKI_USAGE*/

//----------------------------------------------------------------------
// Includes
Expand Down
32 changes: 16 additions & 16 deletions Code/Mantid/Framework/Algorithms/src/CaltoDspacemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@ This is the inverse of the DspacemaptoCal algorithm. The detector offset file c
:<math> d = \frac{h}{m_N} \frac{t.o.f.}{L_{tot} sin \theta} (1+ \rm{offset})</math>
==Usage==
'''Python'''
LoadEmptyInstrument("POWGEN_Definition.xml","POWGEN")
CaltoDspacemap("POWGEN","PG3.cal", "PG3.dat")
'''C++'''
IAlgorithm* alg1 = FrameworkManager::Instance().createAlgorithm("LoadEmptyInstrument");
alg1->setPropertyValue("Filename", "POWGEN_Definition.xml");
alg1->setProperty<MatrixWorkspace_sptr>("OutputWorkspace", "POWGEN");
alg1->execute();
IAlgorithm* alg2 = FrameworkManager::Instance().createAlgorithm("DspacemaptoCal");
alg2->setProperty<MatrixWorkspace_sptr>("InputWorkspace", "POWGEN");
alg2->setPropertyValue("CalibrationFile", "PG3.cal");
alg2->setPropertyValue("DspacemapFile", "PG3.dat");
alg2->execute();
== Additional Property Information ==
{| border="1" cellpadding="5" cellspacing="0"
Expand All @@ -40,6 +24,22 @@ This is the inverse of the DspacemaptoCal algorithm. The detector offset file c
|}
*WIKI*/
/*WIKI_USAGE*
'''Python'''
LoadEmptyInstrument("POWGEN_Definition.xml","POWGEN")
CaltoDspacemap("POWGEN","PG3.cal", "PG3.dat")
'''C++'''
IAlgorithm* alg1 = FrameworkManager::Instance().createAlgorithm("LoadEmptyInstrument");
alg1->setPropertyValue("Filename", "POWGEN_Definition.xml");
alg1->setProperty<MatrixWorkspace_sptr>("OutputWorkspace", "POWGEN");
alg1->execute();
IAlgorithm* alg2 = FrameworkManager::Instance().createAlgorithm("DspacemaptoCal");
alg2->setProperty<MatrixWorkspace_sptr>("InputWorkspace", "POWGEN");
alg2->setPropertyValue("CalibrationFile", "PG3.cal");
alg2->setPropertyValue("DspacemapFile", "PG3.dat");
alg2->execute();
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
7 changes: 3 additions & 4 deletions Code/Mantid/Framework/Algorithms/src/CreateCalFileByNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ The group number is assigned based on a descent in the instrument tree assembly.
If two assemblies are parented, say Bank1 and module1, and both assembly names
are given in the GroupNames, they will get assigned different grouping numbers.
This allows to isolate a particular sub-assembly of a particular leaf of the tree.
==Usage==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
CreateCalFileByNames("GEM","output.cal","Bank1,Bank2,Module1")
Expand All @@ -23,9 +23,8 @@ This allows to isolate a particular sub-assembly of a particular leaf of the tre
alg->setPropertyValue("GroupingFileName", "output.cal");
alg->setPropertyValue("GroupNames", "Bank1,Bank2,Module1");
alg->execute();
*WIKI_USAGE*/

*WIKI*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
7 changes: 3 additions & 4 deletions Code/Mantid/Framework/Algorithms/src/CreateDummyCalFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Offsets in the file are all sets to zero and all detectors are selected. Overwri
Detectors will be assigned to group one when using AlignDetector or DiffractionFocussing algorithms.
==Usage==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
CreateDummyCalFile("SNAP_4111","output.cal")
Expand All @@ -18,9 +19,7 @@ Detectors will be assigned to group one when using AlignDetector or DiffractionF
alg->setPropertyValue("InputWorkspace", "SNAP_4111");
alg->setPropertyValue("CalFilename", "output.cal");
alg->execute();
*WIKI*/
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
Creates a 2D workspace that contains a single value and an optional error value. This is useful if, for example, there is a need to multiply (or divide etc) a workspace by a single value.
=== Usage ===
*WIKI*/
/*WIKI_USAGE*
LoadRaw("C:/Data/testfile.raw","rawspace")
CreateSingleValuedWorkspace("scalar", "3")
Multiply("rawspace", "scalar", "rawspace")
*WIKI*/
*WIKI_USAGE*/
//------------------------
//Includes
//------------------------
Expand Down
9 changes: 4 additions & 5 deletions Code/Mantid/Framework/Algorithms/src/CrossCorrelate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ This is use in powder diffraction experiments when trying to estimate the offset
More details can be found [http://en.wikipedia.org/wiki/Cross-correlation here.]
==Usage==
'''Python'''
CrossCorrelate("InputW","OutputW",2,3,75,1.6,2.2)
*WIKI*/
/*WIKI_USAGE*
'''Python'''
CrossCorrelate("InputW","OutputW",2,3,75,1.6,2.2)
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*WIKI*
Moves the detectors in an instrument to optimize the maximum intensity of each detector using gsl_multimin_fminimizer_nmsimplex. Only bin data close to peak you wish to maximize.
==Usage==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
DiffractionEventCalibrateDetectors(InputWorkspace=SNAP_4307, Params="1.9308,0.0002,2.1308", LocationOfPeakToOptimize=2.0308, MaxIterations=100, DetCalFilename="./SNAP_4307.DetCal")
Expand All @@ -16,9 +15,7 @@ Moves the detectors in an instrument to optimize the maximum intensity of each d
alg->setPropertyValue("MaxIterations", "100");
alg->setPropertyValue("DetCalFilename", "./SNAP_4307.DetCal");
alg->execute();
*WIKI*/
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
7 changes: 3 additions & 4 deletions Code/Mantid/Framework/Algorithms/src/DiffractionFocussing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ The algorithm can be used with an [[EventWorkspace]] input, and will create an E
The main difference vs. using a Workspace2D is that the event lists from all the incoming pixels are simply appended in the grouped spectra; this means that you can rebin the resulting spectra to finer bins with no loss of data. In fact, it is unnecessary to bin your incoming data at all; binning can be performed as the very last step.
==Usage==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
DiffractionFocussing("InWS","OutWS","filename")
'''C++'''
Expand All @@ -31,9 +32,7 @@ The main difference vs. using a Workspace2D is that the event lists from all the
alg->setPropertyValue("GroupingFileName", "filename");
alg->execute();
Workspace* ws = FrameworkManager::Instance().getWorkspace("OutWS");
*WIKI*/
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/Divide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
{{BinaryOperation|verb=divided|prep=by|symbol=<math>\div</math>}}
{{BinaryOperationFooterMultiply|verb=divided|prep=by|symbol=<math>\div</math>}}
== Usage ==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Divide("w1","w2","output")
w3 = w1 / w2
Expand All @@ -17,7 +19,7 @@ The usage of basic workspace mathematical operations has been specially simplifi
//w1 and w2 are workspaces
workspace_sptr output = w1 / w2;
*WIKI*/
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
11 changes: 3 additions & 8 deletions Code/Mantid/Framework/Algorithms/src/DspacemaptoCal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ The detector offset file created by this algorithm are in the form created by th
:<math> d = \frac{h}{m_N} \frac{t.o.f.}{L_{tot} sin \theta} (1+ \rm{offset})</math>
==Usage==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
LoadEmptyInstrument("POWGEN_Definition.xml","POWGEN")
CreateCalFileByNames("POWGEN","PG3.cal","Group1,Group2,Group3,Group4")
Expand All @@ -26,12 +26,7 @@ The detector offset file created by this algorithm are in the form created by th
alg3->setPropertyValue("DspacemapFile", "PG3_D1370_dspacemap_2010_09_12.dat");
alg3->setPropertyValue("CalibrationFile", "PG3.cal");
alg3->execute();
*WIKI*/
*WIKI_USAGE*/
#include "MantidAlgorithms/AlignDetectors.h"
#include "MantidAlgorithms/DspacemaptoCal.h"
#include "MantidAPI/FileProperty.h"
Expand Down
5 changes: 3 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/Exponential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ The algorithm will apply the exponential function (i.e. <math>e^y</math>) to the
The units of the workspace are not updated, so the user must take care in the use of such output workspaces.
When acting on an event workspace, the output will be a Workspace2D, with the default binning from the original workspace.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Exponential("input","output")
*WIKI*/
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ This algorithm requires a workspace that is both in d-spacing, but has also been
The algorithm iterates over each spectrum in the workspace and fits a [[Gaussian]] function to the reference peak. The fit is used to calculate the centre of the fitted peak, and the offset is then calculated as:
This is then written into a [[CalFile|.cal file]] for every detector that contributes to that spectrum. All of the entries in the cal file are initially set to both be included, but also to all group into a single group on [[DiffractionFocussing]]. The [[CreateCalFileByNames]] algorithm can be used to alter the grouping in the cal file.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
GetDetOffsetsMultiPeaks("InputW","OutputW",0.01,2.0,1.8,2.2,"output.cal")
GetDetOffsetsMultiPeaks("InputW","OutputW",0.01,2.0,1.8,2.2,"output.cal")
*WIKI*/
*WIKI_USAGE*/
#include "MantidAlgorithms/GetDetOffsetsMultiPeaks.h"
#include "MantidAlgorithms/GSLFunctions.h"
#include "MantidAPI/FileProperty.h"
Expand Down
9 changes: 4 additions & 5 deletions Code/Mantid/Framework/Algorithms/src/GetDetectorOffsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ The algorithm iterates over each spectrum in the workspace and fits a [[Gaussian
This is then written into a [[CalFile|.cal file]] for every detector that contributes to that spectrum. All of the entries in the cal file are initially set to both be included, but also to all group into a single group on [[DiffractionFocussing]]. The [[CreateCalFileByNames]] algorithm can be used to alter the grouping in the cal file.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
GetDetOffsetsMultiPeaks("InputW","OutputW",0.01,2.0,1.8,2.2,"output.cal","offsets","mask")
*WIKI*/
GetDetOffsetsMultiPeaks("InputW","OutputW",0.01,2.0,1.8,2.2,"output.cal","offsets","mask")
*WIKI_USAGE*/
#include "MantidAlgorithms/GetDetectorOffsets.h"
#include "MantidAPI/FileProperty.h"
#include "MantidAPI/FunctionFactory.h"
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/Algorithms/src/InterpolatingRebin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ The same syntax as for [[Rebin]]
;0,100,10000,200,20000
:From 0 rebin in steps of 100 to 10,000 then steps of 200 to 20,000
== Usage ==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
InterpolatingRebin("InWS2","OutWS","x1,dx1,x2")
*WIKI*/
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
9 changes: 4 additions & 5 deletions Code/Mantid/Framework/Algorithms/src/Logarithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ Some values in a workspace can normally be equal to zero. Logarithm is not calcu
When acting on an event workspace, the output will be a Workspace2D, with the default binning from the original workspace.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Logarithm("Input","output",[Filler],[is_Natural])
Logarithm("Input","output",[Filler],[is_Natural])
*WIKI*/
*WIKI_USAGE*/
#include "MantidAlgorithms/Logarithm.h"
#include "MantidAPI/WorkspaceProperty.h"

Expand Down
5 changes: 3 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/Minus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
The Minus algorithm will subtract the data values and calculate the corresponding [[Error Values|error values]] for two compatible workspaces.
=== Usage ===
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Minus("w1","w2","output")
w3 = w1 - w2
Expand All @@ -15,7 +16,7 @@ The usage of basic workspace mathematical operations has been specially simplifi
//w1 and w2 are workspaces
Workspace output = w1 - w2;
*WIKI*/
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/Multiply.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*WIKI*
{{BinaryOperation|verb=multiplied|prep=by|symbol=<math>\times</math>}}
== Usage ==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Multiply("w1","w2","output")
w3 = w1 * w2
Expand All @@ -15,7 +16,7 @@ The usage of basic workspace mathematical operations has been specially simplifi
//w1 and w2 are workspaces
Workspace output = w1 * w2;
*WIKI*/
*WIKI_USAGE*/
// Includes
//----------------------------------------------------------------------
//----------------------------------------------------------------------
Expand Down
7 changes: 3 additions & 4 deletions Code/Mantid/Framework/Algorithms/src/Plus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
For [[EventWorkspace]]s, the Event lists at each workspace index are concatenated to create the output event list at the same workspace index. Note that in some cases, these event lists might be from different detectors; this is not checked against and the event lists will be concatenated anyway. This may or may not be your desired behavior. If you wish to merge different EventWorkspaces while matching their detectors together, use the [[MergeRuns]] algorithm.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Plus("w1","w2","output")
w3 = w1 + w2
Expand All @@ -15,8 +15,7 @@ The usage of basic workspace mathematical operations has been specially simplifi
//w1 and w2 are workspaces
Workspace output = w1 + w2;
*WIKI*/
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/Algorithms/src/Power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ When acting on an event workspace, the output will be a Workspace2D, with the de
Defining the power algorithm as: <math> y = \left ( a^b \right ) </math>, we can describe the error as:
<math>s_{y} = by\left ( s_{a}/a \right )</math>, where <math>s_{y}</math> is the error in the result ''y'' and <math>s_{a}</math> is the error in the input ''a''.
== Usage ==
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Power("InputWorkspace","Exponent")
*WIKI*/
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Expand Down

0 comments on commit 4a06128

Please sign in to comment.