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

LoadSESANS v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Load a file using the SESANS format

See Also

SaveSESANS

Properties

Name

Direction

Type

Default

Description

Filename

Input

string

Mandatory

Name of the SESANS file to load. Allowed extensions: [‘.ses’, ‘.sesans’]

OutputWorkspace

Output

MatrixWorkspace

Mandatory

The name to use for the output workspace

Description

Loads the given file in the SESANS text format. The file begins with a number of compulsory headers, the first of which must be ‘FileFormatVersion’. There are four compulsory data columns - SpinEchoLength, Depolarisation, Depolarisation_error and Wavelength. The output workspace has X values of SpinEchoLength and Y values of depolarisation.

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", OverrideSampleThickness=True)
LoadSESANS(Filename=file_path, OutputWorkspace="in_ws")

# Retrieve loaded workspace from ADS
in_ws = mtd["in_ws"]
print("Y values of loaded workspace = {}".format(in_ws.readY(0)))

Output:

Y values of loaded workspace = [ ... ... ... ...]

Categories: AlgorithmIndex | DataHandling\Text

Source

C++ header: LoadSESANS.h

C++ source: LoadSESANS.cpp