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

LoadCanSAS1D v2

Summary

Load a file written in the canSAS 1-D data format

See Also

SaveCanSAS1D

Properties

Name

Direction

Type

Default

Description

Filename

Input

string

Mandatory

The name of the CanSAS1D file to load. Allowed extensions: [‘.xml’]

OutputWorkspace

Output

Workspace

Mandatory

The name to use for the output workspace

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 canSAS1d XML format specified by canSAS 1D Data Formats Working Group schema Version 1.1 and creates output workspace. There is a canSAS Wiki available which provides more information about the format.

If the file contains multiple SASentry elements a workspace group will be created and each SASentry will be one workspace in the group. Loading multiple SASdata elements is not supported.

Versions

This is version 2 of the algorithm, which meets version 1.1 of the canSAS1d specification.

You can load files using version 1.0 of the specification by using version 1 of LoadCanSAS1D.

Usage

Example - Save/Load “Roundtrip”

import os

# Create dummy workspace.
dataX = [0,1,2,3]
dataY = [9,5,7]
out_ws = CreateWorkspace(dataX, dataY, UnitX="MomentumTransfer")

file_path = os.path.join(config["defaultsave.directory"], "canSASData.xml")

# Do a "roundtrip" of the data.
SaveCanSAS1D(out_ws, file_path)
in_ws = LoadCanSAS1D(file_path)

print("Contents of the file = {}.".format(in_ws.readY(0)))

Output:

Contents of the file = [9. 5. 7.].

Categories: AlgorithmIndex | DataHandling\XML | SANS\DataHandling

Source

C++ header: LoadCanSAS1D2.h

C++ source: LoadCanSAS1D2.cpp