SaveNexus v1


SaveNexus dialog.


The SaveNexus algorithm will write the given Mantid workspace to a NeXus file. SaveNexus currently just invokes SaveNexusProcessed.


Name Direction Type Default Description
InputWorkspace Input Workspace Mandatory Name of the workspace to be saved
Filename Input string Mandatory The name of the Nexus file to write, as a full or relative path. Allowed extensions: [‘.nxs’, ‘.nx5’, ‘.xml’]
Title Input string   A title to describe the saved workspace
WorkspaceIndexMin Input number 0 Number of first WorkspaceIndex to read, only for single period data. Not yet implemented
WorkspaceIndexMax Input number Optional Number of last WorkspaceIndex to read, only for single period data. Not yet implemented.
WorkspaceIndexList Input int list   List of WorkspaceIndex numbers to read, only for single period data. Not yet implemented
Append Input boolean False Determines whether .nxs file needs to be over written or appended


The algorithm SaveNexus will write a Nexus data file from 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. Both the extensions nxs and nx5 will generate HDF5 files.

The optional parameters can be used to control which spectra are saved into the file (not yet implemented). If WorkspaceIndexMin and WorkspaceIndexMax are given, then only that range to data will be saved.

A Mantid Nexus file may contain several workspace entries each labelled with an integer starting at 1. If the file already contains n workspaces, the new one will be labelled n+1.

In the future it may be possible to write other Nexus file types than the one supported by SaveNexusProcessed.

Time series data

TimeSeriesProperty data within the workspace will be saved as NXlog sections in the Nexus file. Only floating point logs are stored and loaded at present.


import os
# Create a file path in the user home directory
filePath = os.path.expanduser('~/SavedNexusFile.nxs')

# Create a workspace
# Save it in Nexus format

Categories: AlgorithmIndex | DataHandling\Nexus


C++ header: SaveNexus.h

C++ source: SaveNexus.cpp