Calculations¶
This module contains the basic implementation of the matrix formalism as detailed in Drits and Tchoubar (1990) and Plançon (2001).
It was chosen to implement this using ‘loose’ function calls. The disadvantage
of this approach is that the functions are no longer bound to class instances,
which makes them less intuitive to use. The advantage is we can more easily
call these functions asynchronously (e.g. using Pool
)
Despite all this, most function calls in this module do expect to be passed a
DataObject
sub-class, which wraps all the data in a single object.
These DataObject
s map onto the different models used. As such this
module is also largely independent from the MVC framework used.
Drits, V.A., and Tchoubar, C., 1990. X-Ray Diffraction by Disordered Lamellar Structures: Theory and Applications to Microdivided Silicates and Carbons. Springer-Verlag, Berlin, Germany. Plançon, A., 2001. Order-disorder in clay mineral structures. Clay Miner 36, 1–14.
Atoms¶
Components¶
Phases and CSDS¶
Goniometer¶
Specimen¶
Statistics¶
Improve¶
Exceptions¶
-
exception
pyxrd.calculations.exceptions.
WrapException
[source]¶ A wrapped exception used by the
wrap_exceptions()
decorator.
Data Objects¶
The following classes are not meant to be used directly, rather you should create the corresponding model instances and retrieve the DataObject from them.
The rationale behind not using the model instances directly is that they are difficult to serialize or pickle (memory-)efficiently. This is mainly due to all of the boiler-plate code that takes care of references, saving, loading, calculating properties from other properties etc. A lot of this is not needed for the actual calculation. The data objects below, on the other hand, only contain the data needed to be able to calculate XRD patterns.
-
class
pyxrd.calculations.data_objects.
DataObject
(**kwargs)[source]¶ The base class for all DataObject instances.
The constructor takes any number of keyword arguments it will set as attributes on the instance.
-
class
pyxrd.calculations.data_objects.
AtomTypeData
(**kwargs)[source]¶ The DataObject describing an AtomType.
-
par_a
= None¶ a numpy array of a scattering factors
-
par_b
= None¶ a numpy array of b scattering factors
-
par_c
= None¶ the c scattering constant
-
debye
= None¶ the debye-waller temperature factor
-
-
class
pyxrd.calculations.data_objects.
AtomData
(**kwargs)[source]¶ The DataObject describing an Atom.
-
atom_type
= None¶ an
AtomTypeData
instance
-
pn
= None¶ the # of atoms projected to this z coordinate
-
default_z
= None¶ the default z coordinate
-
z
= None¶ the actual z coordinate
-
-
class
pyxrd.calculations.data_objects.
ComponentData
(**kwargs)[source]¶ The DataObject describing an Atom
-
volume
= None¶ the component volume
-
weight
= None¶ the component weight
-
d001
= None¶ the d-spacing of the component
-
default_c
= None¶ the default d-spacing of the component
-
delta_c
= None¶ the variation in d-spacing of the component
-
lattice_d
= None¶ the height of the silicate lattice (excluding the interlayer space)
-
-
class
pyxrd.calculations.data_objects.
CSDSData
(**kwargs)[source]¶ The DataObject describing the CSDS distribution.
-
average
= None¶ average CSDS
-
maximum
= None¶ maximum CSDS
-
minimum
= None¶ minimum CSDS
-
alpha_scale
= None¶ the alpha scale factor for the log-normal distribution
-
alpha_offset
= None¶ the alpha offset factor for the log-normal distribution
-
beta_scale
= None¶ the beta scale factor for the log-normal distribution
-
beta_offset
= None¶ the beta offset factor for the log-normal distribution
-
-
class
pyxrd.calculations.data_objects.
GonioData
(**kwargs)[source]¶ The DataObject describing the Goniometer setup.
-
min_2theta
= None¶ Lower 2-theta bound for calculated patterns
-
max_2theta
= None¶ Upper 2-theta bound for calculated patterns
-
steps
= None¶ The number of steps in between the lower and upper 2-theta bounds
-
has_soller1
= False¶ If the first soller slits are present
-
soller1
= None¶ The first soller slit size
-
has_soller2
= False¶ If the first soller slits are present
-
soller2
= None¶ The second soller slit size
-
divergence_mode
= 'FIXED'¶ The divergence slit mode
-
divergence
= None¶ The divergence size (degrees (fixed) or mm (auto))
-
mcr_2theta
= 0¶ The Bragg angle of the monochromator (or 0° if not present)
-
has_absorption_correction
= None¶ Flag indicating if intensities need to be corrected for absorption
-
absorption
= 45.0¶ The sample mass absorption coefficient (mg/cm²)
-
sample_surf_density
= 20.0¶ The sample surface density (cm²/g)
-
radius
= None¶ The goniometer radius
-
wavelength
= None¶ The goniometer wavelength
-
wavelength_distribution
= None¶ The goniometer wavelength distribution
-
sample_length
= None¶ The sample length
-
-
class
pyxrd.calculations.data_objects.
ProbabilityData
(**kwargs)[source]¶ The DataObject describing the layer stacking probabilities
-
valid
= None¶ Whether this probability is really a valid one
-
G
= None¶ The number of components this probability describes
-
W
= None¶ The weight fractions matrix
-
P
= None¶ The probabilities matrix
-
-
class
pyxrd.calculations.data_objects.
PhaseData
(**kwargs)[source]¶ The DataObject describing a phase
-
apply_lpf
= True¶ A flag indicating whether to apply Lorentz-polarization factor or not
-
apply_correction
= True¶ A flag indicating whether to apply machine corrections or not
-
components
= None¶ A list of
ComponentData
instances
-
probability
= None¶ A
ProbabilityData
instance
-
sigma_star
= None¶ The sigma start value
-
-
class
pyxrd.calculations.data_objects.
SpecimenData
(**kwargs)[source]¶ The DataObject describing a specimen
-
absorption
= None¶ The sample absorption
-
observed_intensity
= None¶ A numpy array with the observed intensities
-
total_intensity
= None¶ A numpy array with the calculated intensity
-
phase_intensities
= None¶ A nummpy array with the calculated phase profiles
-
-
class
pyxrd.calculations.data_objects.
MixtureData
(**kwargs)[source]¶ The DataObject describing a mixture
-
specimens
= None¶ A list of
SpecimenData
instances
-
fractions
= None¶ A numpy array with the phase fractions
-
bgshifts
= None¶ A numpy array with the specimen background shifts
-
scales
= None¶ A numpy array with the specimen absolute scales
-
parsed
= False¶ Whether this MixtureData object has been parsed (internal flag)
-
calculated
= False¶ Whether this MixtureData object has been calculated (internal flag)
-
optimized
= False¶ Whether this MixtureData object has been optimized (internal flag)
-
n
= 0¶ The number of specimens
-
m
= 0¶ The number of phases
-