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

LoadNexusLogs v1

../_images/LoadNexusLogs-v1_dlg.png

LoadNexusLogs dialog.

Summary

Loads run logs (temperature, pulse charges, etc.) from a NeXus file and adds it to the run information in a workspace.

Properties

Name Direction Type Default Description
Workspace InOut MatrixWorkspace Mandatory The name of the workspace that will be filled with the logs.
Filename Input string Mandatory Path to the .nxs file to load. Can be an EventNeXus or a histogrammed NeXus. Allowed extensions: [‘.nxs’, ‘.n*’]
OverwriteLogs Input boolean True If true then some existing logs will be overwritten, if false they will not.
NXentryName Input string   Entry in the nexus file from which to read the logs
AllowList Input str list   If specified, only these logs will be loaded from the file (each separated by a comma).
BlockList Input str list   If specified, these logs will NOT be loaded from the file (each separated by a comma).

Description

The LoadNexusLogs algorithm loads the sample logs from the given NeXus file. The logs are visible from MantidWorkbench if you right-click on a workspace and select “Sample Logs…”.

If you use LoadEventNexus or LoadISISNexus, calling this algorithm is not necessary, since it called as a child algorithm.

Data loaded from Nexus File

Not all of the nexus file is loaded. This section tells you what is loaded and where it goes in the workspace. Items missing from the Nexus file are simply not loaded.

Description of Data Found in Nexus file Placed in Workspace (Workspace2D)
Log group Each group of class IXrunlog or IXselog or with name "DASLogs" or "framelog" (henceforth referred as [LOG]) See below
Periods group Each group of class IXperiods (henceforth referred as [PERIODS]) See below
Time series Each group of class NXlog or NXpositioner within [LOG] Time series in workspace run object Only these are affected by the OverwriteLogs algorithm property.
SE logs Each group of class IXseblock within [LOG] Workspace run object. Item prefixed with selog_, if name is already in use.
Periods Each group of class IXperiods and name "periods" within [PERIODS] nperiods item in run object, if it does not already exist
Start and end times Groups "start_time" and "end time" start and end times in run object Existing values are always overwritten.
Proton charge Group "proton_charge", if it exists, else integration of proton charge time series Proton charge in run object if it does not already exist
Measurement information Group "measurement" of class NXcollection Run object items with name from Nexus group prefixed with measurement_ Existing values are always overwritten.
Run title Entry "title" Title in run object if it exists

If the nexus file has a "proton_log" group, then this algorithm will do some event filtering to allow SANS2D files to load.

The AllowList option skips loading of the entire sample log, and loads only log entries specified in the list. This can be useful if only particular log entries are needed. Likewise, the BlockList option will skip loading log entries specified in the list, while loading all other sample log entries that are not found in the list. For both of these options, log entry names should be separated by a space. Both AllowList and BlockList cannot be set at the same time.

Usage

As described above, normal usage of this algorithm is not necessary. however, at SNS there are preNeXus files available. The following uses this mechanism and then adds the logs.

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 = LoadEventPreNexus("CNCS_7860_neutron_event.dat")
# Five logs are already present
print("Number of original logs = {}".format(len(ws.getRun().keys())))
phase_log = "Phase1"
# Try to get a log that doesn't exist yet
try:
    log = ws.getRun().getLogData(phase_log)
except RuntimeError:
    print("{} log does not exist!".format(phase_log))
LoadNexusLogs(ws, "CNCS_7860_event.nxs")
print("Number of final logs = {}".format(len(ws.getRun().keys())))
# Try getting the log again
try:
    log = ws.getRun().getLogData(phase_log)
    print("{} log size = {}".format(phase_log, log.size()))
except RuntimeError:
    print("{} log does not exist!".format(phase_log))

Output:

Number of original logs = 5
Phase1 log does not exist!
Number of final logs = 44
Phase1 log size = 46

Categories: AlgorithmIndex | DataHandling\Logs | DataHandling\Nexus

Source

C++ header: LoadNexusLogs.h

C++ source: LoadNexusLogs.cpp