\(\renewcommand\AA{\unicode{x212B}}\)

LoadNXcanSAS v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Loads an HDF5 NXcanSAS file into a MatrixWorkspace.

See Also

LoadCanSAS1D, SaveNXcanSAS

Properties

Name

Direction

Type

Default

Description

Filename

Input

string

Mandatory

The name of the NXcanSAS file to read, as a full or relative path. Allowed extensions: [‘.nxs’, ‘.h5’]

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.

LoadTransmission

Input

boolean

False

Load the transmission related data from the file if it is present (optional, default False).

Description

Loads the given file, which should be in the NXcanSAS format specified by NXcanSAS Data Formats Working Group schema http://cansas-org.github.io/NXcanSAS/classes/contributed_definitions/NXcanSAS.html and creates an output workspace. The current loader is optimized to work with NXcanSAS data which was saved using the SaveNXcanSAS v1 algorithm.

If the file contains transmission workspaces then they can be loaded into separate workspaces.

Usage

Example

import os

# Create a example workspace with units of momentum transfer
ws = CreateSampleWorkspace("Histogram",NumBanks=1,BankPixelWidth=1)
ws = ConvertUnits(ws,Target="MomentumTransfer")
LoadInstrument(ws,False,InstrumentName="SANS2D")

# Save the file
file_name = "test_file_for_nxcansas"
SaveNXcanSAS(ws,file_name)

# Load the file back
ws_loaded = LoadNXcanSAS(file_name)

#remove the file we created
alg = ws_loaded.getHistory().lastAlgorithm()
filePath = alg.getPropertyValue("Filename")
os.remove(filePath)

Categories: AlgorithmIndex | DataHandling\Nexus

Source

C++ header: LoadNXcanSAS.h

C++ source: LoadNXcanSAS.cpp