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

LoadNexusMonitors v2

../_images/LoadNexusMonitors-v2_dlg.png

LoadNexusMonitors dialog.

Summary

Load all monitors from a NeXus file into a workspace.

Properties

Name Direction Type Default Description
Filename Input string Mandatory The name (including its full or relative path) of the NeXus file to attempt to load. The file extension must either be .nxs or .NXS. Allowed extensions: [‘.nxs’]
OutputWorkspace Output Workspace Mandatory The name of the output workspace in which to load the NeXus monitors.
NXentryName Input string   Optional: Name of the NXentry to load if it’s not the default.
LoadOnly Input string   If multiple repesentations exist, which one to load. Default is to load the one that is present, and Histogram if both are present. Allowed values: [‘’, ‘Events’, ‘Histogram’]

Description

This algorithm loads all monitors found in a NeXus file into a single Workspace2D (if there is no event data or if LoadOnly='Histogram') or into an EventWorkspace (if there is event monitor data or LoadOnly='Events'). 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 or ISIS format, so the loader is currently not generically applicable.

This version (v2) fixes a bug in the first version and now returns a group workspace when invoked from Python with a multiperiod input workspace. As a side-effect of the fix, the contained individual workspaces for each of the periods are named slightly differently.

Event monitor and histogram monitor

There are two types of monitors, event monitors and histograms monitors. Both of them are of class NXmonitor in NeXus file.

  • Event monitor must contain all of the following three fields:
    • event_index
    • event_time_offset
    • event_time_zero
  • Histogram monitor must contain
    • data
    • period_index
    • time_of_flight

Load NeXus file containing both event monitor and histogram monitor

For most files, the LoadOnly option can be set to an empty string (the default) and the correct form of the data will be loaded (i.e. events for event monitors and histograms for histogram monitors). In some NeXus files, both histograms and events are provided. In this case, if LoadOnly is not defined, then histogram monitors will be loaded and a warning will be outputted to the Log.

To suppress the warning, or to select which form of logs to load the user must use the LoadOnly option to specify what is desired.

ISIS event monitor

ISIS monitor of event mode may contain entry data. In this case, the monitor of event mode can be loaded in histogram mode.

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.

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

Output:

Number of monitors = 3

Categories: AlgorithmIndex | DataHandling\Nexus

Source

C++ header: LoadNexusMonitors2.h (last modified: 2021-03-31)

C++ source: LoadNexusMonitors2.cpp (last modified: 2021-03-31)