Skip to content

Commit

Permalink
Add usage to ConvertFromDistribution. Refs #9585.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Jun 5, 2014
1 parent a91c737 commit 4ab3117
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
Expand Up @@ -49,16 +49,14 @@ class DLLExport ConvertFromDistribution : public API::Algorithm
virtual ~ConvertFromDistribution() {}
/// Algorithm's name
virtual const std::string name() const { return "ConvertFromDistribution"; }
///Summary of algorithms purpose
virtual const std::string summary() const {return "Converts a histogram workspace from a distribution i.e. multiplies by the bin width.";}

/// Summary of algorithms purpose
virtual const std::string summary() const { return "Converts a histogram workspace from a distribution i.e. multiplies by the bin width."; }
/// Algorithm's version
virtual int version() const { return (1); }
/// Algorithm's category for identification
virtual const std::string category() const { return "Transforms\\Distribution"; }

private:

/// Initialisation code
void init();
///Execution code
Expand Down
35 changes: 31 additions & 4 deletions Code/Mantid/docs/source/algorithms/ConvertFromDistribution-v1.rst
Expand Up @@ -9,13 +9,40 @@
Description
-----------

Converts a histogram workspace from a distribution i.e. multiplies by
the bin width to take out the bin width dependency.
Converts a histogram workspace from a distribution i.e. multiplies by the bin width to take out the bin width dependency.
This algorithm is often used with :ref:`ConvertToDistribution <algm-ConvertToDistribution-v1>`.

Restrictions on the input workspace
###################################

The workspace to convert must contain histogram data which is flagged as
being a distribution.
The workspace to convert must contain histogram data which is flagged as being a distribution.

Usage
-----

**Example - converting a workspace to and from a distribution**

.. testcode:: ConvertFromDistribution

# By default it is not a distribution.
ws_multi = CreateSampleWorkspace("Histogram", "Multiple Peaks")

# Convert to a distribution for demonstration purposes.
# If your data is already distributed then this is not required.
ConvertToDistribution(ws_multi)

print "Is the workspace a distribution? " + str(ws_multi.isDistribution())

# Convert back to the initial workspace state.
ConvertFromDistribution(ws_multi)

print "Is the workspace a distribution? " + str(ws_multi.isDistribution())

Output:

.. testoutput:: ConvertFromDistribution

Is the workspace a distribution? True
Is the workspace a distribution? False

.. categories::

0 comments on commit 4ab3117

Please sign in to comment.