Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
Filename | Input | string | Mandatory | A NeXus file. Allowed values: [‘.hdf’, ‘.h5’, ‘’] |
Dictionary | Input | string | Mandatory | A Dictionary for controlling NeXus loading. Allowed values: [‘.txt’, ‘.dic’, ‘’] |
OutputWorkspace | Output | Workspace | Mandatory |
This algorithm is a flexible NeXus file loader. Data loading is driven by a dictionary. Correspondingly the algorithm takes as arguments: a filename, a path to a dictionary file and an output workspace name.
The dictionary itself is a list of key=value pairs, one per line. Normally dictionary entries take the form key-path-into-Nexus-file. The default action is to store the data found at path-into-NeXus-file under key key in the Run information of the result workspace. But some keys are interpreted specially:
Please note that the dimensions on the MDHistoWorkspace are inverted when compared with the ones in the NeXus file. This is a fix which allows to efficiently transfer the NeXus data in C storage order into the MDHistoWorkspace which has fortran storage order.
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.
Example - Load AMOR Nexus file from SINQ/PSI:
import os
dictionary_path = os.path.join(config["instrumentDefinition.directory"], "nexusdictionaries")
wsOut = LoadFlexiNexus(Filename='amor2013n000366.hdf',
Dictionary=os.path.join(dictionary_path, 'amor.dic'))
num_dims = wsOut.getNumDims()
print("This has loaded a MD Workspace with {} dimensions".format(num_dims))
print("Name Bins Min Max")
for dim_index in range(num_dims):
dim = wsOut.getDimension(dim_index)
print("{} {} {:.2f} {:.2f}".format(dim.name,
dim.getNBins(), dim.getMinimum(), dim.getMaximum()))
Output:
This has loaded a MD Workspace with 3 dimensions
Name Bins Min Max
z 360 32471.45 194590.44
y 256 -95.00 94.26
x 128 -86.00 84.66
Categories: Algorithms | DataHandling\Nexus
C++ source: LoadFlexiNexus.cpp (last modified: 2017-08-14)
C++ header: LoadFlexiNexus.h (last modified: 2016-06-07)