Table Of Contents

Previous topic

Use alternative language

Next topic

Header

Create an Elemental ID x-ray condition

Specifying the x-ray line in an ElementalIDXray condition is slightly different than other attributes, so this example shows how to do it. In microanalysis, there exists two common types of nomenclature for x-ray line: the one proposed by the IUPAC (e.g. K-L3) and the traditional Siegbahn notation (Ka1). HMSA specifications does not enforce one notation over the other and encourage the users to specify the x-ray line in both notations.

In a similar way as for alternative languages (see the example on Use alternative language), a new type is defined for x-ray lines: xrayline. The type takes two required arguments (the x-ray line and its notation) and an optional argument for the x-ray line express in the other notation. For example, we can specify the Ka1 line as follows:

from pyhmsa.type.xrayline import xrayline, NOTATION_SIEGBAHN
line = xrayline('Ka1', NOTATION_SIEGBAHN, 'K-L3')

The alternative value is automatically interpreted to be expressed in the IUPAC notation.

This new line object can then be used to create a new ElementalIDXray condition.

from pyhmsa.spec.condition.elementalid import ElementalIDXray
condition = ElementalIDXray(29, line, (8047.82, 'eV'))
print(condition) # Returns: <ElementalIDXray(atomic_number=29, energy=8047.82 eV, line=Ka1)>

Full source code

#!/usr/bin/env python

from pyhmsa.type.xrayline import xrayline, NOTATION_SIEGBAHN
line = xrayline('Ka1', NOTATION_SIEGBAHN, 'K-L3')

from pyhmsa.spec.condition.elementalid import ElementalIDXray
condition = ElementalIDXray(29, line, (8047.82, 'eV'))
print(condition) # Returns: <ElementalIDXray(atomic_number=29, energy=8047.82 eV, line=Ka1)>