Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | InOut | MatrixWorkspace | Mandatory | A workspace whose sample properties will be updated |
Geometry | Input | Dictionary | A dictionary of geometry parameters for the sample. | |
Material | Input | Dictionary | A dictionary of material parameters for the sample. See SetSampleMaterial for all accepted parameters | |
Environment | Input | Dictionary | A dictionary of parameters to configure the sample environment |
Set properties of the sample & its environment on a workspace.
The 3 arguments to this algorithm Environment
, Geometry
and
Material are all expected to be
dictionaries specifying multiple parameters that relate to the
respective argument.
Note
Contrary to the xml forms of defining the geometry which are in metres, dict versions are in centimetres.
Specifies the sample environment kit to be used. There are two required keywords:
Name
: The name of the predefined kitContainer
: The id of the container within the predefined kitSee Sample Environment concept page for further details on how the creating a definition file.
The name of a kit is must be unique for a given instrument. The following
procedure is used when trying to find a named definition, e.g CRYO-01
:
FACILITY
& INSTRUMENT
respectivelyFACILITY
& INSTRUMENT
respectively.xml
to the given kit nameINSTDIR
) in turn:INSTDIR/sampleenvironments/FACILITY/INSTRUMENT/CRYO-01.xml
INSTDIR
Specifies the shape of the sample. This can be specified in 1 of 2 ways:
For defining the full shape a key called Shape
specifying the desired shape is
expected along with additional keys specifying the values (all values are assumed to
be in centimeters):
FlatPlate
: Width, Height, Thick, Center, AngleCylinder
: Height, Radius, CenterHollowCylinder
: Height, InnerRadius, OuterRadius, CenterCSG
: Value is a string containing any generic shape as detailed in
How To Define Geometric ShapeThe Center
key is expected to be a list of three values indicating the [X,Y,Z]
position of the center. The reference frame of the defined instrument is used to
set the coordinate system for the shape.
The Angle
argument for a flat plate shape is expected to be in degrees and is defined as
the angle between the positive beam axis and the normal to the face perpendicular to the
beam axis when it is not rotated, increasing in an anti-clockwise sense. The rotation is
performed about the vertical axis of the instrument’s reference frame.
Specifies the composition of the sample using properties from the SetSampleMaterial v1 algorithm. Please see the algorithm documentation for the supported keywords.
The following example uses a test file called CRYO-01.xml
in the
[INSTALLDIR]/instrument/sampleenvironments/TEST_LIVE/ISIS_Histogram/
directory.
Example - Container with preset cylinderical sample geometry
# A fake host workspace, replace this with your real one.
ws = CreateSampleWorkspace()
# Use geometry as is from environment definition
SetSample(ws, Environment={'Name': 'CRYO-01', 'Container': '8mm'},
Material={'ChemicalFormula': '(Li7)2-C-H4-N-Cl6',
'SampleNumberDensity': 0.1})
Example - Override height of preset cylinder sample
# A fake host workspace, replace this with your real one.
ws = CreateSampleWorkspace()
# Use geometry from environment but set different height for sample
SetSample(ws, Environment={'Name': 'CRYO-01', 'Container': '8mm'},
Geometry={'Height': 4.0},
Material={'ChemicalFormula': '(Li7)2-C-H4-N-Cl6',
'SampleNumberDensity': 0.1})
Example - Override complete sample geometry
# A fake host workspace, replace this with your real one.
ws = CreateSampleWorkspace()
# Use geometry from environment but set different height for sample
SetSample(ws, Environment={'Name': 'CRYO-01', 'Container': '8mm'},
Geometry={'Shape': 'HollowCylinder', 'Height': 4.0,
'InnerRadius': 0.8, 'OuterRadius': 1.0,
'Center': [0.,0.,0.]},
Material={'ChemicalFormula': '(Li7)2-C-H4-N-Cl6',
'SampleNumberDensity': 0.1})
Categories: Algorithm Index | Sample
C++ source: SetSample.cpp (last modified: 2019-02-13)
C++ header: SetSample.h (last modified: 2019-01-08)