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

ExtractMonitors v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Separates the monitors and/or detectors into separate workspaces.

See Also

ExtractMonitorWorkspace

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

A workspace with detectors and monitors

DetectorWorkspace

Output

MatrixWorkspace

The output workspace with detectors only

MonitorWorkspace

Output

MatrixWorkspace

The output workspace with monitors only

Description

This algorithm takes a workspace that contains monitors and detectors, and outputs two workspaces, one with only detectors and one with only the monitors. The workspaces are linked such that a call to getMonitorWorkspace on the new detector workspace will return the new monitor workspace.

The algorithm can also output only the detector workspace without monitors, or the monitors on their own.

Usage

Note

To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.

Example - ExtractMonitorsExample

ws = Load('ENGINX00213855.nxs')

ExtractMonitors(InputWorkspace = ws,
                DetectorWorkspace = 'Detectors',
                MonitorWorkspace = 'Monitors')

detector_ws = mtd['Detectors']
monitor_ws = mtd['Monitors']

# Detector histograms
print("Number of spectra in input workspace: {0}".format(ws.getNumberHistograms()))
# Detector histograms (spectra missing detectors generate warnings)
print("Number of spectra in detector workspace: {0}".format(detector_ws.getNumberHistograms()))
# Monitor histograms
print("Number of spectra in monitor workspace: {0}".format(monitor_ws.getNumberHistograms()))
# Check if the first spectrum in the detector workspace is a monitor
print("Detector workspace isMonitor for spectrum 0: {0}".format(detector_ws.getDetector(0).isMonitor()))
# Check if the first spectrum in the monitor workspace is a monitor
print("Monitor workspace isMonitor for spectrum 0: {0}".format(monitor_ws.getDetector(0).isMonitor()))
# See the monitor workspace is set
print("Name of monitor workspace: {0}".format(detector_ws.getMonitorWorkspace().name()))

Output:

Number of spectra in input workspace: 2513
Number of spectra in detector workspace: 2500
Number of spectra in monitor workspace: 2
Detector workspace isMonitor for spectrum 0: False
Monitor workspace isMonitor for spectrum 0: True
Name of monitor workspace: Monitors

Categories: AlgorithmIndex | Utility\Workspaces

Source

Python: ExtractMonitors.py