ISIS Powder Diffraction Scripts - SampleDetails Reference¶
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.
Optionally you may also:
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
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")
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.
sample_obj = SampleDetails(angle=45, ...)
The center of the sample as defined by X, Y and Z co-ordinates. This co-ordinates must be numeric.
sample_obj = SampleDetails(center=[-1.0, 0.0, 1.0], ...)
The height of the sample cylinder in cm. This must be a number which is greater than 0.
sample_obj = SampleDetails(height=5.0, ...)
The radius of the sample cylinder in cm. This must be a number which is greater than 0.
sample_obj = SampleDetails(radius=5.0, ...)
The shape of the sample. Allowed values are currently cylinder and slab.
sample_obj = SampleDetails(shape="cylinder", ...)
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
sample_obj = SampleDetails(thickness=1.0, ...)
The width of the slab sample in cm. This must be greater than 0.
sample_obj = SampleDetails(width=1.0, ...)
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.
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')
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.
sample_obj.set_material(chemical_formula="V") # OR sample_obj.set_material(chemical_formula="VNb", number_density=123)
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.
sample_obj.set_material(chemical_formula="V") # Or sample_obj.set_material(chemical_formula="V0.951 Nb0.049", ...)
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.
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
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
sample_obj.set_material(number_density=0.231, packing_fraction=0.5, ...)
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:
The absorption cross section for the sample in barns to use whilst calculating absorption corrections.
The scattering cross section for the sample in barns to use whilst calculating absorption corrections.
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).