\(\renewcommand\AA{\unicode{x212B}}\)
LoadNexusLogs v1¶
Summary¶
Loads run logs (temperature, pulse charges, etc.) from a NeXus file and adds it to the run information in a workspace.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
Workspace |
InOut |
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, logs matching one of the patterns 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 |
See below |
Periods group |
Each group of class |
See below |
Time series |
Each group of class |
Time series in workspace run object Only these are affected by the OverwriteLogs algorithm property. |
SE logs |
Each group of class |
Workspace run object. Item prefixed
with |
Periods |
Each group of class |
|
Start and end times |
Groups |
start and end times in run object Existing values are always overwritten. |
Proton charge |
Group |
Proton charge in run object if it does not already exist |
Measurement information |
Group |
Run object items with name from
Nexus group prefixed with
|
Run title |
Entry |
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 (regular expression is supported
for blocking a series of logs with similar names), while loading all other sample log entries.
For both of these options, log entry names should be separated by a space.
Warning: AllowList
and BlockList
cannot be set at the same time.
NOTE: The pattern matching (globing) in BlockList
supports the following:
*
matches any sequence of zero or more characters?
matches any single character[SET]
matches any single character in the specified set ([0-9a-zA-Z_]
is the set of characters allowed in C identifiers)[!SET]
matches any character not in the specified setTo suppress the special syntactic significance of any of
[]*?!-\
, and match the character exactly, precede it with a backslash.All strings must be UTF-8 encoded
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