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

Description

The LoadNexusLogs algorithm loads the sample logs from the given NeXus file. The logs are visible from MantidPlot 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.

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 MantidPlot 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: Algorithms | DataHandling\Logs | DataHandling\Nexus

Source

C++ source: LoadNexusLogs.cpp (last modified: 2017-09-28)

C++ header: LoadNexusLogs.h (last modified: 2017-12-11)