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

refs #10693. Doctest and better docs

parent 726ebd85
No related branches found
No related tags found
No related merge requests found
...@@ -196,7 +196,6 @@ class CutMD(DataProcessorAlgorithm): ...@@ -196,7 +196,6 @@ class CutMD(DataProcessorAlgorithm):
def __verify_projection_input(self, projection_table): def __verify_projection_input(self, projection_table):
if isinstance(projection_table, ITableWorkspace): if isinstance(projection_table, ITableWorkspace):
column_names = set(projection_table.getColumnNames()) column_names = set(projection_table.getColumnNames())
logger.warning(str(column_names))
if not column_names == set([Projection.u, Projection.v, 'type']): if not column_names == set([Projection.u, Projection.v, 'type']):
if not column_names == set([Projection.u, Projection.v, 'offsets', 'type']): if not column_names == set([Projection.u, Projection.v, 'offsets', 'type']):
if not column_names == set([Projection.u, Projection.v, Projection.w, 'offsets', 'type']): if not column_names == set([Projection.u, Projection.v, Projection.w, 'offsets', 'type']):
......
.. algorithm::
.. summary::
.. alias::
.. properties::
Description
-----------
This algorithm performs slicing of multiDimensional data according to a chosen projection, and binning choice. The algorithm uses :ref:`algm-BinMD` or
:ref:`algm-SliceMD` to achieve the binning of the data. The choice of child algorithm used for the slicing is controlled by the NoPix option.
The synax is similar to that used by `Horace <http://horace.isis.rl.ac.uk/Manipulating_and_extracting_data_from_SQW_files_and_objects#cut_sqw>`__.
Usage
-----
**Example - Contrived example using projections:**
.. testcode:: Example4D
to_cut = CreateMDWorkspace(Dimensions=4, Extents=[-1,1,-1,1,-1,1,-10,10], Names="H,K,L,E", Units="U,U,U,V")
# Add two fake peaks so that we can see the effect of the basis transformation
FakeMDEventData(InputWorkspace='to_cut', PeakParams=[10000,-0.5,0,0,0,0.1])
FakeMDEventData(InputWorkspace='to_cut', PeakParams=[10000,0.5,0,0,0,0.1])
SetUB(Workspace=to_cut, a=1, b=1, c=1, alpha=90, beta=90, gamma=90)
SetSpecialCoordinates(InputWorkspace=to_cut, SpecialCoordinates='HKL')
projection = CreateEmptyTableWorkspace()
# Correct number of columns, and names
projection.addColumn("double", "u")
projection.addColumn("double", "v")
projection.addColumn("double", "w")
projection.addColumn("double", "offsets")
projection.addColumn("str", "type")
projection.addRow([1,-1, 0, 0, "r"])
projection.addRow([1, 1, 0, 0, "r"])
projection.addRow([0, 0, 1, 0, "r"])
# Apply the cut
out_md = CutMD(to_cut, Projection=projection, P1Bin=[0.1], P2Bin=[0.1], P3Bin=[0.1], P4Bin=[-5,5], NoPix=True)
print 'number of dimensions', out_md.getNumDims()
print 'number of dimensions not integrated', len(out_md.getNonIntegratedDimensions())
dim_dE = out_md.getDimension(3)
print 'min dE', dim_dE.getMaximum()
print 'max dE', dim_dE.getMinimum()
Output:
.. testoutput:: Example4D
number of dimensions 4
number of dimensions not integrated 3
min dE 5.0
max dE -5.0
.. categories::
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