Skip to content

Commit

Permalink
Add usage example to MaskBinsFromTable re #10052
Browse files Browse the repository at this point in the history
Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Sep 2, 2014
1 parent 21f5f73 commit 1908094
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion Code/Mantid/docs/source/algorithms/MaskBinsFromTable-v1.rst
Expand Up @@ -12,7 +12,47 @@ Description
Masks bins in a workspace. The user specified masking parameters,
such as spectra, xmin and xmax are given via a TableWorkspace.

It calls algorithm MaskBins underneath.
It calls algorithm MaskBins underneath.
If DetectorIDsList column exists it will convert this list to a list of spectra before calling MaskBins.

The table may have several rows, in which case it calls Maskbins for each row.


Usage
-----

**Masking of a small workspace**

.. testcode:: exMaskBinsFromTableSimple

# Create workspace with 10 bins of width 10
ws = CreateSampleWorkspace(BankPixelWidth=1, Xmax=100, BinWidth=10)

# Create table workspace with masking information in it
mask_info = CreateEmptyTableWorkspace()
mask_info.addColumn("str", "SpectraList")
mask_info.addColumn("double", "XMin")
mask_info.addColumn("double", "XMax")
mask_info.addRow(["", 16.0, 32.0]) # 1st mask: SpectraList=ALL, Xmin=16, XMax=32
mask_info.addRow(["", 71.5, 79.0]) # 2nd mask: SpectraList=ALL, Xmin=71.5, XMax=79


# Mask a range of X-values
wsMasked = MaskBinsFromTable(ws,MaskingInformation=mask_info)

# Show Y values in workspaces
print "Before masking:", ws.readY(0)
print "After masking:",wsMasked.readY(0)


Output:

.. testoutput:: exMaskBinsFromTableSimple

Before masking: [ 0.3 0.3 0.3 0.3 0.3 10.3 0.3 0.3 0.3 0.3]
After masking: [ 0.3 0. 0. 0. 0.3 10.3 0.3 0. 0.3 0.3]



Related Algorithms
------------------
Expand Down

0 comments on commit 1908094

Please sign in to comment.