SetSample v1

../_images/SetSample-v1_dlg.png

SetSample dialog.

Summary

Set properties of the sample and its environment for a workspace

Properties

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

Description

Set properties of the sample & its environment on a workspace.

The 3 arguments to this algorithm Environment, Geometry & Material are all expected to be dictionaries specifying multiple parameters that relate to the respective argument.

Environment

Specifies the sample enviorment kit to be used. There are two required keywords:

  • Name: The name of the predefined kit
  • Container: The id of the container within the predefined kit

See 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:

  • check the instrument name on the input workspace:
    • if this is a known instrument at a known facility (is in Facilities.xml) then use these as FACILITY & INSTRUMENT respectively
    • else use the default facility and instrument as FACILITY & INSTRUMENT respectively
  • append .xml to the given kit name
  • find the current list of directories containing instrument definition files (see Instrument Definition Directories for the default directory list)
  • for each (INSTDIR) in turn:
    • construct a test path INSTDIR/sampleenvironments/FACILITY/INSTRUMENT/CRYO-01.xml
    • if this file exists then select this as the kit file and the search stops
    • otherwise if the file does not exist continue onto the next INSTDIR

Geometry

Specifies the shape of the sample. This can be specified in 1 of 2 ways:

  • if an environment is specified that already knows the geometry of the sample then the fields of the known geometry container be customized. See Sample Environment concept page for further details
  • a full definition of the shape.

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
  • Cylinder: Height, Radius, Center, Axis (X=0, Y=1, Z=2)
  • HollowCylinder: Height, InnerRadius, OuterRadius, Center, Axis(X=0, Y=1, Z=2)
  • CSG: Value is a string containing any generic shape as detailed in How To Define Geometric Shape

The Center key is expected to be a list of three values indicating the [X,Y,Z] position of the center.

Material

Specifies the composition of the sample using properties from the SetSampleMaterial v1 algorithm. Please see the algorithm documentation for the supported keywords.

Usage

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 defintion
SetSample(ws, Environment={'Name': 'CRYO-01', 'Container': '8mm'},
          Material={'ChemicalFormula': '(Li7)2-C-H4-N-Cl6'})

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 differnet height for sample
SetSample(ws, Environment={'Name': 'CRYO-01', 'Container': '8mm'},
          Geometry={'Height': 4.0},
          Material={'ChemicalFormula': '(Li7)2-C-H4-N-Cl6'})

Example - Override complete sample geometry

# A fake host workspace, replace this with your real one.
ws = CreateSampleWorkspace()
# Use geometry from environment but set differnet 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.], 'Axis':1},
          Material={'ChemicalFormula': '(Li7)2-C-H4-N-Cl6'})

Categories: Algorithms | Sample

Source

C++ source: SetSample.cpp

C++ header: SetSample.h