Skip to content

Commit

Permalink
refs #12694. Pylint and Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Aug 27, 2015
1 parent 0140fc4 commit 61ef7de
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
@@ -1,7 +1,6 @@
#pylint: disable=no-init,invalid-name
from mantid.kernel import *
from mantid.api import *
import mantid.simpleapi as ms
import numpy as np

class Replicate(PythonAlgorithm):
Expand All @@ -19,9 +18,12 @@ def summary(self):
return "This algorithm is used to replicate a cut of n dimensions to n+1 dimensions."

def PyInit(self):
self.declareProperty(IMDHistoWorkspaceProperty("InputWorkspace", "", Direction.Input), "Workspace to replicate to n+1 dimensions. Contains data to be replicated.")
self.declareProperty(IMDHistoWorkspaceProperty("ShapeWorkspace", "", Direction.Input), "Template to define shape of output. OutputWorkspace will have the same characteristics but hold different data.")
self.declareProperty(IMDHistoWorkspaceProperty("OutputWorkspace", "", Direction.Output), "Output replicated workspace")
self.declareProperty(IMDHistoWorkspaceProperty("InputWorkspace", "", Direction.Input),
"Workspace to replicate to n+1 dimensions. Contains data to be replicated.")
self.declareProperty(IMDHistoWorkspaceProperty("ShapeWorkspace", "", Direction.Input),
"Template to define shape of output. OutputWorkspace will have the same characteristics but hold different data.")
self.declareProperty(IMDHistoWorkspaceProperty("OutputWorkspace", "", Direction.Output),
"Output replicated workspace")

def _tile_flattened(self, source, n_replications):
source = source.flatten()
Expand Down
42 changes: 42 additions & 0 deletions Code/Mantid/docs/source/algorithms/Replicate-v1.rst
@@ -0,0 +1,42 @@
.. algorithm::

.. summary::

.. alias::

.. properties::

Description
-----------

This algorithm is used to replicate a n dimensional :ref:`MDHistoWorkspace <MDHistoWorkspace>` in a stack to make a n+1 dimensional :ref:`MDHistoWorkspace <MDHistoWorkspace>`. A *ShapeWorkspace* provides the shape, extents, names and units of the final *OutputWorkspace*, which is also a :ref:`MDHistoWorkspace <MDHistoWorkspace>`.

Validation
######################################

The *InputWorkspace* and *ShapeWorkspace*, are expected to match over the initial n dimensions of the *InputWorkspace*. Names and Units are not checked, and are automatically taken from the *ShapeWorkspace*. However, Extents (Min, Max), and number of bins in each dimension are checked in order. The algorithm will fail to continue if these are not seen to match.


Limitations
#####################

The current implementation of this algorithm will not handle dimensions that have been integrated out (have 1 bin) as though the dimensionality of the workspace is n-1.

Usage
-----

**Example - Replicating a slice:**

.. testcode:: ExampleSimple

print "Hello World"

Output:

.. testoutput:: ExampleSimple

Hello World

.. categories::

.. sourcelink::

0 comments on commit 61ef7de

Please sign in to comment.