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

SaveSESANS v1

../_images/SaveSESANS-v1_dlg.png

SaveSESANS dialog.

Summary

Save a file using the SESANS format

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace 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’]

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

Usage

Example - Loading a file

import os

# Create dummy workspace
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")

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 (last modified: 2020-03-20)

C++ source: SaveSESANS.cpp (last modified: 2020-04-07)