SaveCanSAS1D v1

../_images/SaveCanSAS1D-v1_dlg.png

SaveCanSAS1D dialog.

Summary

Save a MatrixWorkspace to a file in the canSAS 1-D format

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory The input workspace, which must be in units of Q
Filename Input string Mandatory The name of the xml file to save. Allowed extensions: [‘.xml’]
RadiationSource Input string Spallation Neutron Source The type of radiation used. Allowed values: [‘Spallation Neutron Source’, ‘Pulsed Reactor Neutron Source’, ‘Reactor Neutron Source’, ‘Synchrotron X-ray Source’, ‘Pulsed Muon Source’, ‘Rotating Anode X-ray’, ‘Fixed Tube X-ray’, ‘neutron’, ‘x-ray’, ‘muon’, ‘electron’]
Append Input boolean False Selecting append allows the workspace to be added to an existing canSAS 1-D file as a new SASentry
Process Input string   Text to append to Process section
DetectorNames Input string   Specify in a comma separated list, which detectors to store information about; where each name must match a name given for a detector in the [[IDF|instrument definition file (IDF)]]. IDFs are located in the instrument sub-directory of the MantidPlot install directory.
Geometry Input string Disc The geometry type of the collimation. Allowed values: [‘Cylinder’, ‘Flat plate’, ‘Disc’]
SampleHeight Input number 0 The height of the collimation element in mm. If specified as 0 it will not be recorded.
SampleWidth Input number 0 The width of the collimation element in mm. If specified as 0 it will not be recorded.
SampleThickness Input number 0 The thickness of the sample in mm. If specified as 0 it will not be recorded.

Description

Saves the given MatrixWorkspace to a file in the canSAS 1-D format.

The canSAS 1-D Format

The canSAS 1-D standard for reduced 1-D SAS data is implemented using XML files. A single file can contain SAS data from a single experiment or multiple experiments.

Version 1.0 of the canSAS 1-D schema can be used to validate files of this format.

There is a canSAS Wiki available which provides more information about the format.

Versions

This is version 1 of the algorithm, which meets version 1.0 of the canSAS 1-D specification.

You can export data to files using version 1.1 of the specification by using version 2 of SaveCanSAS1D.

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, Version=1)
in_ws = LoadCanSAS1D(file_path)

print "Contents of the file = " + str(in_ws.readY(0)) + "."

Output:

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

Categories: Algorithms | DataHandling\XML | SANS\DataHandling

Source

C++ source: SaveCanSAS1D.cpp

C++ header: SaveCanSAS1D.h