Skip to content
Snippets Groups Projects
Commit 926ade5e authored by Owen Arnold's avatar Owen Arnold
Browse files

refs #5494. Extend wiki docs

parent a22e4ad2
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,23 @@ The following example creates a 2D MDHistoWorkspace called ''demo'' with 3 bins
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')
The following example creates a 1D sine function
import math
signals=[]
errors=[]
pi = 3.14159
extents = [-2*pi,2*pi]
nbins = [100]
dimensionality = 1
step = float((extents[1] - extents[0])/nbins[0])
for i in range(0, nbins[0]):
x = i*step;
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 [[ConvertToMDEvents]] which works on MatrixWorkspaces, and allows log values to be included in the dimensionality.
......
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