orsopy.utils package

Submodules

orsopy.utils.chemical_formula module

A simple class to resolve and store chemical formula strings.

class orsopy.utils.chemical_formula.Formula(string, sort=True, strict=False)[source]

Bases: list

Evaluate strings for element chemical formula.

elements = 'A[cglmrstu]|B[aehikr]?|C[adeflmorsu]?|D[bsy]{0,1}|E[rsu]|F[emr]?|G[ade]|H[efgosx]?|I[nr]?|Kr?|L[airu]|M[dgnot]|N[abdeiop]?|Os?|P[abdmortu]?|R[abefghnu]|S[bcegimnr]?|T[abcehilm]|Uu[bhopqst]|U|V|W|Xe|Yb?|Z[nr]'
isotopes = '(A[cglmrstu]|B[aehikr]?|C[adeflmorsu]?|D[bsy]{0,1}|E[rsu]|F[emr]?|G[ade]|H[efgos]?|I[nr]?|Kr?|L[airu]|M[dgnot]|N[abdeiop]?|Os?|P[abdmortu]?|R[abefghnu]|S[bcegimnr]?|T[abcehilm]|Uu[bhopqst]|U|V|W|Xe|Yb?|Z[nr])\\[[1-9][0-9]{0,2}\\]'
parse_string(string)[source]
static split_groups(string)[source]
parse_group(group, case_sensitive=True)[source]
merge_same()[source]
index(item, **kwargs)[source]

Return first index of value.

Raises ValueError if the value is not present.

orsopy.utils.density_resolver module

Specifies the abstract base class for resolving layer densities from formula strings.

class orsopy.utils.density_resolver.MaterialResolver[source]

Bases: ABC

comment = None
resolve_item(name)[source]

Optional method for resolving names directly ot Layer or SubStack compatible class.

Returns such object or None if name cannot be resolved.

Return type:

Optional[dict]

abstract resolve_formula(formula)[source]

Resolves the density of a given chemical formula from the database. If not possible raises ValueError.

The returned value is the number density in 1/nm³.

Return type:

float

abstract resolve_elemental(formula)[source]

Estimates the density of a material from its individual elements by averaging the bulk element densities.

The returned value is the number density in 1/nm³.

Return type:

float

orsopy.utils.resolver_slddb module

Implementation of DensityResolver using SLD DB queries.

class orsopy.utils.resolver_slddb.ResolverSLDDB[source]

Bases: MaterialResolver

comment = ''
resolve_item(name)[source]

Optional method for resolving names directly ot Layer or SubStack compatible class.

Returns such object or None if name cannot be resolved.

resolve_formula(formula)[source]

Resolves the density of a given chemical formula from the database. If not possible raises ValueError.

The returned value is the number density in 1/nm³.

Return type:

float

resolve_elemental(formula)[source]

Estimates the density of a material from its individual elements by averaging the bulk element densities.

The returned value is the number density in 1/nm³.

Return type:

float