Skip to content

Commit

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

/// Summary of algorithms purpose
virtual const std::string summary() const {return "Makes a histogram workspace a distribution i.e. divides 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
38 changes: 34 additions & 4 deletions Code/Mantid/docs/source/algorithms/ConvertToDistribution-v1.rst
Expand Up @@ -9,13 +9,43 @@
Description
-----------

Makes a histogram workspace a distribution i.e. divides by the bin
width.
Makes a histogram workspace a distribution i.e. divides by the bin width.

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

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

Usage
-----

**Example - converting multiple peaks to distribution**

.. testcode:: ConvertToDistribution

ws_multi = CreateSampleWorkspace("Histogram", "Multiple Peaks")

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

print "The workspace has a level backgound of " + str(ws_multi.readY(0)[0]) + " counts."
print "The largest of which is " + str(ws_multi.readY(0)[60]) + " counts."

ConvertToDistribution(ws_multi)

print "Is the workspace a distribution? " + str(ws_multi.isDistribution())
print "The workspace has a level backgound of " + str(ws_multi.readY(0)[0]) + " counts."
print "The largest of which is " + str(ws_multi.readY(0)[60]) + " counts."

Output:

.. testoutput:: ConvertToDistribution

Is the workspace a distribution? False
The workspace has a level backgound of 0.3 counts.
The largest of which is 8.3 counts.

Is the workspace a distribution? True
The workspace has a level backgound of 0.0015 counts.
The largest of which is 0.0415 counts.

.. categories::

0 comments on commit a91c737

Please sign in to comment.