Skip to content

Commit

Permalink
Refs #9580. Adding 18 and 28.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Jun 6, 2014
1 parent 193130c commit 1237dc4
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
Expand Up @@ -13,6 +13,46 @@ This algorithm reads in an old SNS reduction ROI file and converts it
into a Mantid mask workspace. It will save that mask to a Mantid mask
file.

The file format of the ROI file looks like: bank1\_0\_0 bank1\_0\_1 ...
The file format of the ROI file looks like:
::

bank1_0_0
bank1_0_1
...

Usage
-----

.. include:: ../usagedata-note.txt

.. testcode:: Ex

# Run converter
inst_name = "CNCS"
ConvertSnsRoiFileToMask("cncs_roi.txt", inst_name, ".")

# To test, load data and mask
ws = Load("CNCS_7860_event.nxs")
mask_file = inst_name + "_Mask.xml"
mask = LoadMask(inst_name, mask_file)
MaskDetectors(ws, MaskedWorkspace=mask)

# Check to see that only first 2 pixels are not masked
print "Is detector 0 masked:", ws.getDetector(0).isMasked()
print "Is detector 1 masked:", ws.getDetector(1).isMasked()
print "Is detector 2 masked:", ws.getDetector(2).isMasked()

Output:

.. testoutput:: Ex

Is detector 0 masked: False
Is detector 1 masked: False
Is detector 2 masked: True

.. testcleanup:: Ex

import os
os.remove(os.path.join(".", mask_file))

.. categories::
20 changes: 19 additions & 1 deletion Code/Mantid/docs/source/algorithms/LoadNexusMonitors-v1.rst
Expand Up @@ -10,11 +10,29 @@ Description
-----------

This algorithm loads all monitors found in a NeXus file into a single
`Workspace2D <Workspace2D>`__. The algorithm assumes that all of the
`Workspace2D <http://www.mantidproject.org/Workspace2D>`_. The algorithm
assumes that all of the
monitors are histograms and have the same bin boundaries. **NOTE:** The
entry is assumed to be in SNS format, so the loader is currently not
generically applicable. It is also written for single entry files and
will need tweaking to handle period data where the monitors are
different.

Usage
-----

.. include:: ../usagedata-note.txt

.. testcode:: Ex

ws = LoadNexusMonitors("CNCS_7860_event.nxs")
# CNCS has 3 monitors
print "Number of monitors =", ws.getNumberHistograms()

Output:

.. testoutput:: Ex

Number of monitors = 3

.. categories::
File renamed without changes.
2 changes: 2 additions & 0 deletions Test/AutoTestData/UsageData/cncs_roi.txt
@@ -0,0 +1,2 @@
bank1_0_0
bank1_0_1

0 comments on commit 1237dc4

Please sign in to comment.