ISIS Powder Diffraction Scripts - SampleDetails Reference

Introduction

The sample details object holds the user defined properties of the current sample if absorption corrections are required whilst focusing. Only specific instruments support sample absorption corrections. This can be determined from visiting the instrument reference: Instrument Reference. If the instrument has a set_sample_details method it supports sample absorption corrections.

Before you can use absorption corrections you will need to: - Create SampleDetails Object - Setting the material

Optionally you may also:

Create SampleDetails Object

This method assumes you are familiar with the concept of objects in Python. If not more details can be read here: A quick introduction to objects

For more details on any of the parameters set here see: Set Sample.

Two geometries are currently supported - cylinder and slab.

To create a cylindrical SampleDetails object the following parameters of the sample geometry are required:

  • shape - The sample shape (in this case a cylinder)
  • center - List of x, y, z positions of the sample
  • height - Cylinder height
  • radius - Cylinder radius

To create a slab SampleDetails object the following parameters of the sample geometry are required:

  • shape - The sample shape (in this case a slab)
  • center - List of x, y, z positions of the sample
  • thickness - Slab thickness
  • width - Slab width
  • height - Slab height
  • angle - Slab angle

Example

from isis_powder import SampleDetails

cylinder_height = 3.0
cylinder_radius = 2.0
cylinder_position = [0.0, 0.0, 0.2]
sample_obj = SampleDetails(height=cylinder_height, radius=cylinder_radius,
                           center=cylinder_position, shape="cylinder")

slab_thickness = 1.0
slab_obj = SampleDetails(thickness=slab_thickness, shape="slab")

angle

The angle in degrees between the positive beam axis and the normal to the face perpendicular to the beam axis when not rotated, increasing in the anti-clockwise sense. Rotation is performed about the vertical axis of the instrument’s frame of reference.

Example Input:

sample_obj = SampleDetails(angle=45, ...)

center

The center of the sample as defined by X, Y and Z co-ordinates. This co-ordinates must be numeric.

Example Input:

sample_obj = SampleDetails(center=[-1.0, 0.0, 1.0], ...)

height

The height of the sample cylinder in cm. This must be a number which is greater than 0.

Example Input:

sample_obj = SampleDetails(height=5.0, ...)

radius

The radius of the sample cylinder in cm. This must be a number which is greater than 0.

Example Input:

sample_obj = SampleDetails(radius=5.0, ...)

shape

The shape of the sample. Allowed values are currently cylinder and slab.

Example Input:

sample_obj = SampleDetails(shape="cylinder", ...)

thickness

The thickness of the slab sample in cm. This must be greater than 0. In the case of HRPD, allowed values are 0.2, 0.5, 1.0, 1.5

Example Input:

sample_obj = SampleDetails(thickness=1.0, ...)

width

The width of the slab sample in cm. This must be greater than 0.

Example Input:

sample_obj = SampleDetails(width=1.0, ...)

Setting the material

Having successfully defined the geometry (see: Create SampleDetails Object) we now must set the material of the sample.

This can only be set once per object without explicitly calling the reset method or constructing a new object (which is preferred) see: Changing sample properties

The following properties are required to set the sample material:

Example

sample_obj.set_material(chemical_formula="V")
# OR
sample_obj.set_material(chemical_formula="VNb", number_density=123)

chemical_formula

The chemical formula of this material. Isotopes can be defined by the ratios as well. For example V 95.1% Nb 4.9% can be expressed as V0.951 Nb0.049.

See: SetSampleMaterial for more details.

Example Input:

sample_obj.set_material(chemical_formula="V")
# Or
sample_obj.set_material(chemical_formula="V0.951 Nb0.049", ...)

number_density

This parameter defines the number density of the property. When chemical_formula defines an element this can automatically be calculated by Mantid.

If chemical_formula is not an element the user must enter this value.

Example Input:

sample_obj.set_material(number_density=0.123, ...)

Setting material properties

Advanced material properties can be optionally set instead of letting Mantid calculate them. For more details see: SetSampleMaterial This can only be set once per object without explicitly calling the reset method or constructing a new object (which is preferred) see: Changing sample properties

These properties are:

Example

sample_obj.set_material_properties(absorption_cross_section=123,
                                   scattering_cross_section=456)

absorption_cross_section

The absorption cross section for the sample in barns to use whilst calculating absorption corrections.

scattering_cross_section

The scattering cross section for the sample in barns to use whilst calculating absorption corrections.

Changing sample properties

Warning

This method is not recommended for changing multiple samples. Instead it is recommended you create a new sample details object if you need to change properties mid way through a script. See Create SampleDetails Object and A quick introduction to objects.

Note: The geometry of a sample cannot be changed without creating a new sample details object

Once you have set a material by calling set_material or set the properties by calling set_material_properties you will not be able to change (or set) these details without first resetting the object. This is to enforce the sample properties being set only once so that users are guaranteed of the state.

To change the chemical material or its advanced properties all reset_sample_material. This will reset all details (i.e advanced properties and chemical properties).

sample_obj.reset_sample_material()

Category: Techniques