SaveMD v1

../_images/SaveMD-v1_dlg.png

SaveMD dialog.

Summary

Save a MDEventWorkspace or MDHistoWorkspace to a .nxs file.

Properties

Name Direction Type Default Description
InputWorkspace Input IMDWorkspace Mandatory An input MDEventWorkspace or MDHistoWorkspace.
Filename Input string   The name of the Nexus file to write, as a full or relative path. Optional if UpdateFileBackEnd is checked. Allowed extensions: [‘.nxs’]
UpdateFileBackEnd Input boolean False Only for MDEventWorkspaces with a file back end: check this to update the NXS file on disk to reflect the current data structure. Filename parameter is ignored.
MakeFileBacked Input boolean False For an MDEventWorkspace that was created in memory: This saves it to a file AND makes the workspace into a file-backed one.

Description

Save an MDEventWorkspace or a MDHistoWorkspace to a .nxs file. The workspace’s current box structure and entire list of events is preserved. The resulting file can be loaded via LoadMD.

If you specify MakeFileBacked, then this will turn an in-memory workspace to a file-backed one. Memory will be released as it is written to disk.

If you specify UpdateFileBackEnd, then any changes (e.g. events added using the PlusMD algorithm) will be saved to the file back-end.

Usage

ws = CreateMDHistoWorkspace(SignalInput='1,2,3,4,5,6,7,8,9', ErrorInput='1,1,1,1,1,1,1,1,1', Dimensionality='2',
                            Extents='-1,1,-1,1', NumberOfBins='3,3', Names='A,B', Units='U,T')
import os
savefile = os.path.join(config["default.savedirectory"], "mdhws.nxs")
SaveMD(ws, Filename=savefile, Version=1)
print("File created: {}".format(os.path.exists(savefile)))

Output:

File created: True

Categories: AlgorithmIndex | MDAlgorithms\DataHandling

Source

C++ source: SaveMD.cpp (last modified: 2019-07-17)

C++ header: SaveMD.h (last modified: 2018-10-05)