Sample¶
Definition of a sample, corresponding to a multilayer.
A multilayer a series of horizontal layers deposited on a substrate.
A multilayer may also have no layer and simply be considered as a substrate.
The substrate composition, and the composition, thickness and mass thickness
of each layer are defined by the Sample
class.
-
stratagemtools.sample.
CONC_UNKNOWN
= None¶ Flag when the composition of an element is unknown.
-
stratagemtools.sample.
CONC_DIFF
= '?'¶ Flag when the composition of an element should be calculated by difference.
-
stratagemtools.sample.
composition_from_formula
(formula)¶ Calculates the composition (expressed in weight fractions) of a chemical formula.
Example:
>>> composition_from_formula('Al2O3') ... {8: 0.4707492883573059, 13: 0.5292507116426941}
Parameters: formula ( str
) – a valid chemical formulaReturns: composition (expressed in weight fractions). The keys of the dict
are atomic numbers and the values, weight fractions.Return type: dict
-
class
stratagemtools.sample.
Layer
(composition, thickness_m=None, mass_thickness_kg_m2=None, density_kg_m3=None)¶ Object to store a layer definition. Once created a layer object is immutable.
-
is_composition_known
()¶ Returns whether the composition is known, i.e. contains no
CONC_UNKNOWN
orCONC_DIFF
flag.Return type: bool
-
composition
¶ Returns a copy of the composition
dict
. The composition, and any other parameters, cannot be modified.Returns: composition (expressed in weight fractions). The keys of the dict
are atomic numbers and the values, weight fractions.Return type: dict
-
-
class
stratagemtools.sample.
Sample
(composition, density_kg_m3=None)¶ Object to store a multilayer sample definition.
Parameters: - composition (
dict
) – composition of the substrate asdict
where the keys are atomic numbers and the values, weight fractions. If the weight fraction is not known, set it toCONC_UNKNOWN
, if the weight fraction should be calculated by difference, set it toCONC_DIFF
. - density_kg_m3 (
float
) –mass density in kilograms per cubic meter (optional). If the composition is known, the density will be automatically calculated based on:
\[\frac{1}{\rho} = \sum \frac{w_i}{\rho_i}\]where \(w_i\) and \(\rho_i\) are respectively the weight fraction and mass density of element \(i\).
-
add_layer
(composition, thickness_m=None, mass_thickness_kg_m2=None, density_kg_m3=None)¶ Adds a layer below the previously added layer, or if no layer was added on top of the substrate.
Parameters: - composition (
dict
) – composition of the layer asdict
where the keys are atomic numbers and the values, weight fractions. If the weight fraction is not known, set it toCONC_UNKNOWN
, if the weight fraction should be calculated by difference, set it toCONC_DIFF
. - thickness_m (
float
) – thickness of the layer in meters (optional). If the mass_thickness_kg_m2 and density_kg_m3 are known, the thickness will be automatically calculated. - mass_thickness_kg_m2 (
float
) – mass thickness of the layer in kilograms per square meter (optional). The mass thickness is defined as the thickness times the density. If thickness_m and density_kg_m3 are known the mass thickness will be automatically calculated. - density_kg_m3 (
float
) –mass density in kilograms per cubic meter (optional). If the composition is known, the density will be automatically calculated based on:
\[\frac{1}{\rho} = \sum \frac{w_i}{\rho_i}\]where \(w_i\) and \(\rho_i\) are respectively the weight fraction and mass density of element \(i\).
Returns: a layer
Return type: - composition (
-
pop_layer
(index)¶ Removes the layer at index.
Parameters: index ( int
) – index of the layer to be removed
-
get_layer
(index)¶ Returns the layer at index. Index 0 is the first layer of the multilayer, while index -1 is the last layer, the first one above the substrate.
Parameters: index ( int
) – index of the layerReturns: a layer Return type: Layer
-
composition
¶ Returns the a copy of the composition of the substrate. The composition, and any other parameters, cannot be modified.
Returns: composition (expressed in weight fractions). The keys of the dict
are atomic numbers and the values, weight fractions.Return type: dict
-
substrate
¶ Returns the “layer” of the substrate, a
Layer
object corresponding to the composition and density of the substrate.Return type: Layer
-
layers
¶ Returns a copy of layers of this sample. It cannot be modified. The layers are ordered from top to bottom.
Return type: tuple
- composition (