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

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 or a total scattering pdf calculation is being performed. 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 - Set container details

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, ...)

Set container details

Currently the supported container shapes are HollowCylinder (for Cylinder shaped samples) and FlatPlateHolder (for Slab shaped samples). These container shapes are inferred from the sample so only a few container parameters need to be set. These container shapes support the PaalmanPingsMonteCarloAbsorption method available when focussing.

Example Input:

from isis_powder import SampleDetails

cylinder_obj = SampleDetails(height=4.0, radius=1.0, center=[0, 0, 0], shape='cylinder')
cylinder_obj.set_material(chemical_formula='Si')
cylinder_obj.set_container(radius=2.0, chemical_formula='V')

slab_obj = SampleDetails(height=4.0, width=4.0, thickness=2.0, angle=0.0, center=[0, 0, 0], shape='slab')
slab_obj.set_material(chemical_formula='Si')
slab_obj.set_container(front_thick=4.0, back_thick=4.0, chemical_formula='V')

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:

Either number_density or number_density_effective must be supplied if chemical_formula is not an element.

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.

This value is used to convert between different PDF types in Polaris.create_total_scattering_pdf.

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

Example Input:

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

number_density_effective

This can be used to supply a powder density. It is used in conjunction with number_density which contains the full crystallographic density.

This value is used in absorption\multiple scattering corrections and converting intensity into a differential cross section (if an absolute normalisation is performed).

If this parameter isn’t supplied then it is assumed to be equal to the number_density

Example Input:

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

packing_fraction

This is an alternative to using number_density_effective to specify a powder_density. This value is a fraction between 0.0 and 1.0 and if supplied then number_density_effective is calculated by multipling packing_fraction by number_density

Example Input:

sample_obj.set_material(number_density=0.231, packing_fraction=0.5, ...)

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