\(\renewcommand\AA{\unicode{x212B}}\)
SaveSESANS v1¶
Summary¶
Save a file using the SESANS format
See Also¶
Properties¶
| Name | Direction | Type | Default | Description | 
|---|---|---|---|---|
| InputWorkspace | Input | Mandatory | The name of the workspace to save | |
| Filename | Input | string | Mandatory | The name to use when saving the file. Allowed extensions: [‘.ses’, ‘.sesans’] | 
| ThetaZMax | Input | number | Optional | The angular acceptance in the encoding direction | 
| ThetaZMaxUnit | Input | string | radians | |
| ThetaYMax | Input | number | Optional | The angular acceptance in the non-encoding direction | 
| ThetaYMaxUnit | Input | string | radians | |
| EchoConstant | Input | number | Optional | The spin echo length, in nanometers, probed by a 1A neutron | 
| Sample | Input | string | Sample name | |
| Orientation | Input | string | Z | Orientation of the instrument. Allowed values: [‘X’, ‘Y’, ‘Z’] | 
| OverrideSampleThickness | Input | number | Optional | The sample thickness in mm. If set, this value will be used instead of the thickness from the input workspace sample | 
Description¶
Saves the given workspace to a file which will be formatted in the SESANS data format. A workspace with a single spectrum is expected, where the X values are wavelength and the Y values are polarisation.
The sample thickness from the run metadata is used to normalise the polarisation data.
The OverrideSampleThickness parameter can be used to specify a different value for this if needed.
Usage¶
Example - Loading a file
import os
# Create dummy workspace with sample thickness metadata
dataX = [1,2,3,4,5]
dataY = [6,1,9,14]
dataE = [1,1,4,5]
out_ws = CreateWorkspace(dataX, dataY, dataE)
out_ws.setTitle("Dummy workspace")
out_ws.sample().setThickness(10)
file_path = os.path.join(config["defaultsave.directory"], "example.ses")
# Do a 'roundtrip' of the data
SaveSESANS(InputWorkspace=out_ws, Filename=file_path, ThetaZMax=1,ThetaYMax=1, EchoConstant=1, Sample="Sample")
LoadSESANS(Filename=file_path, OutputWorkspace="in_ws")
# Retrieve loaded workspace from ADS
in_ws = mtd["in_ws"]
print("Y values of loaded workspace = " + str(in_ws.readY(0)))
Output:
Y values of loaded workspace = [ 0.796338  0.        0.179365  0.130324]
Categories: AlgorithmIndex | DataHandling\Text
Source¶
C++ header: SaveSESANS.h
C++ source: SaveSESANS.cpp