Skip to content

Commit

Permalink
Fix Python usage examples to move them to v2 of the API
Browse files Browse the repository at this point in the history
Refs #8138
  • Loading branch information
martyngigg committed Oct 16, 2013
1 parent 7b82e2c commit fc678e6
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/AsymmetryCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Note: this algorithm does not perform any grouping; the grouping must be done vi
*WIKI*/
/*WIKI_USAGE*
'''Python'''
AsymmetryCalc("EmuData","OutWS","1.0","0,1,2,3,4","16,17,18,19,20")
OutWS = AsymmetryCalc("EmuData","1.0","0,1,2,3,4","16,17,18,19,20")
'''C++'''
IAlgorithm* alg = FrameworkManager::Instance().createAlgorithm("AsymmetryCalc");
Expand Down
4 changes: 4 additions & 0 deletions Code/Mantid/Framework/Algorithms/src/CreateCalFileByNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ This allows to isolate a particular sub-assembly of a particular leaf of the tre
*WIKI*/
/*WIKI_USAGE*
'''Python'''
GEM = LoadEmptyInstrument(Filename="GEM_Definition.xml") # Create test workspace. Normally just use reduced one
CreateCalFileByNames("GEM","output.cal","Bank1,Bank2,Module1")
'''C++'''
IAlgorithm* alg = FrameworkManager::Instance().createAlgorithm("LoadEmptyInstrument");
alg.setPropertyValue("Filename", "GEM_Definition.xml")
alg.execute()
IAlgorithm* alg = FrameworkManager::Instance().createAlgorithm("CreateCalFileByNames");
alg->setPropertyValue("InstrumentName", "GEM");
alg->setPropertyValue("GroupingFileName", "output.cal");
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/CrossCorrelate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ More details can be found [http://en.wikipedia.org/wiki/Cross-correlation here.]
*WIKI*/
/*WIKI_USAGE*
'''Python'''
CrossCorrelate("InputW","OutputW",2,3,75,1.6,2.2)
OutputW = CrossCorrelate("InputW",2,3,75,1.6,2.2)
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The main difference vs. using a Workspace2D is that the event lists from all the
*WIKI*/
/*WIKI_USAGE*
'''Python'''
DiffractionFocussing("InWS","OutWS","filename")
OutWS = DiffractionFocussing("InWS","filename")
'''C++'''
IAlgorithm* alg = FrameworkManager::Instance().createAlgorithm("DiffractionFocussing");
alg->setPropertyValue("InputWorkspace", "InWS");
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/Divide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Divide("w1","w2","output")
output = Divide("w1","w2")
w3 = w1 / w2
w1 /= w2 # Perform "in-place"
# Using a scalar
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/Exponential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ When acting on an event workspace, the output will be a Workspace2D, with the de
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Exponential("input","output")
output = Exponential("input")
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is then written into a [[CalFile|.cal file]] for every detector that contri
== Usage ==
'''Python'''
GetDetOffsetsMultiPeaks("InputW","OutputW",0.01,2.0,1.8,2.2,"output.cal")
OutputW,NumberPeaksFitted,Mask = GetDetOffsetsMultiPeaks("InputW",0.01,2.0,1.8,2.2,"output.cal")
*WIKI*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This is then written into a [[CalFile|.cal file]] for every detector that contri
/*WIKI_USAGE*
'''Python'''
GetDetOffsetsMultiPeaks("InputW","OutputW",0.01,2.0,1.8,2.2,"output.cal","offsets","mask")
offsets,mask = GetDetOffsetsMultiPeaks("InputW",0.01,2.0,1.8,2.2,"output.cal")
*WIKI_USAGE*/
#include "MantidAlgorithms/GetDetectorOffsets.h"
#include "MantidAPI/FileProperty.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The same syntax as for [[Rebin]]
*WIKI*/
/*WIKI_USAGE*
'''Python'''
InterpolatingRebin("InWS2","OutWS","x1,dx1,x2")
OutWS = InterpolatingRebin("InWS2","x1,dx1,x2")
*WIKI_USAGE*/
//----------------------------------------------------------------------
Expand Down
6 changes: 0 additions & 6 deletions Code/Mantid/Framework/Algorithms/src/Logarithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ 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.
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Logarithm("Input","output",[Filler],[is_Natural])
*WIKI_USAGE*/
#include "MantidAlgorithms/Logarithm.h"
#include "MantidAPI/WorkspaceProperty.h"

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/Minus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Minus algorithm will subtract the data values and calculate the correspondin
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Minus("w1","w2","output")
output = Minus("w1","w2")
w3 = w1 - w2
w2 -= w1 # Perform "in-place"
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/Multiply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Multiply("w1","w2","output")
output = Multiply("w1","w2")
w3 = w1 * w2
w1 *= w2 # Perform "in-place"
# Using a scalar
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/Plus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ For [[EventWorkspace]]s, the Event lists at each workspace index are concatenate
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Plus("w1","w2","output")
output = Plus("w1","w2")
w3 = w1 + w2
w1 += w2 # Perform "in-place"
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/Power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Defining the power algorithm as: <math> y = \left ( a^b \right ) </math>, we c
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Power("InputWorkspace","Exponent")
outputW = Power("inputW",3)
*WIKI_USAGE*/
//----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/Rebin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ If the input workspace contains data points, rather than histograms, then Rebin
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Rebin("InWS2","OutWS","x1,dx1,x2")
outputW = Rebin("inputW","x1,dx1,x2")
*WIKI_USAGE*/
//----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/Rebunch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The algorithm rebins data by adding together ''n_bunch'' successive bins.
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Rebunch("InWS, "OutWS", "3")
outputW = Rebunch("inputW, "3")
*WIKI_USAGE*/
//----------------------------------------------------------------------
// Includes
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/Algorithms/src/Regroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The difference between Rebin and Regroup is that in the former the data in the o
*WIKI*/
/*WIKI_USAGE*
'''Python'''
Regroup("InWS","OutWS","x1,dx1,x2")
outputW = Regroup("inputW","x1,dx1,x2")
*WIKI_USAGE*/
//----------------------------------------------------------------------
Expand Down

0 comments on commit fc678e6

Please sign in to comment.