\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
The LoadNexusProcessed algorithm will read the given Nexus Processed data file containing a Mantid Workspace. The data is placed in the named workspace. LoadNexusProcessed may be invoked by LoadNexus if it is given a Nexus file of this type.
Name | Direction | Type | Default | Description |
---|---|---|---|---|
Filename | Input | string | Mandatory | The name of the Nexus file to read, as a full or relative path. Allowed extensions: [‘.nxs’, ‘.nx5’, ‘.xml’] |
OutputWorkspace | Output | Workspace | Mandatory | The name of the workspace to be created as the output of the algorithm. A workspace of this name will be created and stored in the Analysis Data Service. For multiperiod files, one workspace may be generated for each period. Currently only one workspace can be saved at a time so multiperiod Mantid files are not generated. |
SpectrumMin | Input | number | 1 | Number of first spectrum to read. |
SpectrumMax | Input | number | Optional | Number of last spectrum to read. |
SpectrumList | Input | int list | List of spectrum numbers to read. | |
EntryNumber | Input | number | 0 | 0 indicates that every entry is loaded, into a separate workspace within a group. A positive number identifies one entry to be loaded, into one workspace |
LoadHistory | Input | boolean | True | If true, the workspace history will be loaded |
FastMultiPeriod | Input | boolean | True | For multiperiod workspaces. Copy instrument, parameter and x-data rather than loading it directly for each workspace. Y, E and log information is always loaded. |
The algorithm LoadNexusProcessed will read a Nexus data file created by SaveNexusProcessed v1 and place the data into the named workspace. The file name can be an absolute or relative path and should have the extension .nxs, .nx5 or .xml.
Warning
Using XML format can be extremely slow for large data sets and generate very large files.
The optional parameters can be used to control which spectra are loaded into the workspace. If SpectrumMin and SpectrumMax are given, then only that range to data will be loaded. A specific list of spectra to load can also be given (SpectrumList). Filtering of spectra is supported when loading into workspaces of type Workspace2Ds and also EventWorkspaces.
A Mantid Nexus file may contain several workspace entries each labelled with an integer starting at 1. By default the highest number workspace is read, earlier ones can be accessed by setting the EntryNumber.
If the saved data has a reference to an XML file defining instrument geometry this will be read.
The log data in the Nexus file (NX_LOG sections) is loaded as TimeSeriesProperty data within the workspace. Time is stored as seconds from the Unix epoch. Only floating point logs are stored and loaded at present.
The Child Algorithms used by LoadMuonNexus are:
Example
import os
#Create an absolute path by joining the proposed filename to a directory
#os.path.expanduser("~") used in this case returns the home directory of the current user
savePath = os.path.expanduser("~")
wsPath = os.path.join(savePath, "LoadNexusProcessedTest.nxs")
ws = CreateSampleWorkspace(WorkspaceType="Histogram", NumBanks=2, BankPixelWidth=1, BinWidth=10, Xmax=50)
SaveNexusProcessed(ws, wsPath)
wsOutput = LoadNexusProcessed(wsPath)
print(CompareWorkspaces(ws,wsOutput, CheckInstrument=False)[0])
os.remove(wsPath)
Output:
True
Categories: AlgorithmIndex | DataHandling\Nexus
C++ header: LoadNexusProcessed.h (last modified: 2021-03-31)
C++ source: LoadNexusProcessed.cpp (last modified: 2021-03-31)