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 |
Facility |
Input |
string |
The facility where the data was measured. If not set, the facility is determined from the instrument |
|
Instrument |
Input |
string |
The instrument used to measure the data. If not set, the instrument name is taken from the input workspace |
|
RunNumber |
Input |
string |
The run number of the sample measurement. If not set, the run_number log of the input workspace is used |
|
SamplePosition |
Input |
string |
The name of the sample changer position, e.g. AT or 1CT. If not set, the positions recorded in the SamplePos log of the input workspace during the selected time range are used |
|
BlankRunNumber |
Input |
string |
The run number of the blank measurement. Optional. |
|
SampleTransmissionRunNumber |
Input |
string |
The run number of the sample transmission measurement. Optional. |
|
BlankTransmissionRunNumber |
Input |
string |
The run number of the blank transmission measurement. Optional. |
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.
Measurement metadata#
To help identify the measurement, the following entries are added to the file header after the mandatory SESANS headers:
Header |
Value |
|---|---|
Facility |
The |
Instrument |
The |
Run_number |
The |
Sample_position |
The |
Blank_run_number |
The |
Sample_transmission_run_number |
The |
Blank_transmission_run_number |
The |
Reduction_software |
Always |
Software_version |
The version of Mantid used to save the file |
Reduction_date |
The date and time (UTC, ISO 8601) at which the file was saved |
The Facility, Instrument, Run_number, Sample_position and
blank and transmission run number entries are omitted if no value can be determined.
The time range used for Sample_position is from the start to the end of the run, unless the workspace has
been filtered by time, for example using FilterByTime. The position at the start of the time
range is included, but positions logged earlier are not. Repeated positions are only listed once, so a sample that
stayed in one position gives a single value. For older data, the SamplePos log may contain a number rather
than the name of the position.
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.y(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