Table of Contents
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. | |
Transmission | Input | MatrixWorkspace | The transmission workspace. Optional. If given, will be saved at TransmissionSpectrum | |
TransmissionCan | Input | MatrixWorkspace | The transmission workspace of the Can. Optional. If given, will be saved at TransmissionSpectrum |
Saves the given MatrixWorkspace to a file in 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.1 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.
This is version 2 of the algorithm, which meets version 1.1 of the canSAS 1-D specification.
You can export data to files using version 1.0 of the specification by using version 1 of SaveCanSAS1D.
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 = " + str(in_ws.readY(0)) + "."
Output:
Contents of the file = [ 9. 5. 7.].
Categories: Algorithms | DataHandling | XML | SANS