\(\renewcommand\AA{\unicode{x212B}}\)

ConvertToDistribution v1

../_images/ConvertToDistribution-v1_dlg.png

ConvertToDistribution dialog.

Summary

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

See Also

ConvertFromDistribution

Properties

Name

Direction

Type

Default

Description

Workspace

InOut

MatrixWorkspace

Mandatory

The name of the workspace to convert.

Description

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. It cannot be an EventWorkspace.

Usage

Example - converting multiple peaks to distribution

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

print("Is the workspace a distribution? {}".format(ws_multi.isDistribution()))
print("The workspace has a level background of {} counts.".format(ws_multi.readY(0)[0]))
print("The largest of which is {} counts.\n".format(ws_multi.readY(0)[60]))

ConvertToDistribution(ws_multi)

print("Is the workspace a distribution? {}".format(ws_multi.isDistribution()))
print("The workspace has a level background of {} counts.".format(ws_multi.readY(0)[0]))
print("The largest of which is {} counts.".format(ws_multi.readY(0)[60]))

Output:

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

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

Categories: AlgorithmIndex | Transforms\Distribution

Source

C++ header: ConvertToDistribution.h

C++ source: ConvertToDistribution.cpp