pyEELSMODEL.misc package
Submodules
pyEELSMODEL.misc.data_simulator module
- pyEELSMODEL.misc.data_simulator.make_circular_mask(xco, yco, Rin, Rout, shape)
- pyEELSMODEL.misc.data_simulator.make_rectangular_mask(xco, yco, width, height, shape)
- pyEELSMODEL.misc.data_simulator.simulate_data()
Small function which simulates a typical STEM-EELS map.
pyEELSMODEL.misc.hs_gdos module
- pyEELSMODEL.misc.hs_gdos.dsigma_dE_HS(energy_axis, Z, ek, E0, beta, alpha, filename, q_steps=100)
Calculates the cross section from the Hartree-Slater cross sections from Rez. They are not used since they are not open-access.
- pyEELSMODEL.misc.hs_gdos.dsigma_dE_from_GOSarray(energy_axis, rel_energy_axis, ek, E0, beta, alpha, q_axis, GOSmatrix, q_steps=100, swap_axes=False)
Calculates the cross section from the GOS array. The integral over q-axis is done on a logarithmic scale. Note the speed of the calculation is not super-fast and could be improved by a better implementation of the interpolation and integration.
- Parameters:
energy_axis (1d numpy array) – The energy axis on which the cross section is calculated. [eV]
rel_energy_axis (1d numpy array) – The energy axis on which the GOS table is calculated. [eV]
ek (float) – The onset energy of the calculated edge [eV]
E0 (float) – The acceleration voltage of the incoming electrons [V]
alpha (float) – The convergence angle of the incoming probe [rad]
beta – The collection angle of the outgoing electrons [rad]
q_axis (1d numpy array) – The momentum on which the GOS table are calculated. [kg m /s]?
GOSmatrix (2d numpy array) – The GOS
q_steps (uint) – The number of q points used to numerically calculate the integral over the q direction. (default: 100)
swap_axes (boolean) – The two GOS tables from Segger and Zhang have different axes. So for one, the energy axis is the first one and for the other it is the q-axis. Hence by swapping the axes we can use the same function for both. (default: False)
- Returns:
dsigma_dE – The calculated cross section in m^2
- Return type:
1d numpy array
- pyEELSMODEL.misc.hs_gdos.dsigma_dE_from_GOSarray_approx(energy_axis, rel_energy_axis, E0, beta, GOSmatrix, swap_axes=False)
Calculates the cross section by using the approximation shown in https://doi.org/10.1016/0304-3991(89)90197-6, see Eq. 3
- pyEELSMODEL.misc.hs_gdos.dsigma_dE_from_GOSarray_bound(energy_axis, free_energies, ek, E0, beta, alpha, q_axis, GOSmatrix, q_steps=100)
Calculates the cross section from the GOS array. The integral over q-axis is done on a logarithmic scale. This is a new method which is able to take the bounded states into account. Provided by Zezhong Zhang.
- Parameters:
energy_axis (1d numpy array) – The energy axis on which the cross section is calculated. [eV]
free_energies (1d numpy array) – The energy axis on which the GOS table is calculated without the onset energy [eV]
ek (float) – The onset energy of the calculated edge [eV]
E0 (float) – The acceleration voltage of the incoming electrons [V]
alpha (float) – The convergence angle of the incoming probe [rad]
beta – The collection angle of the outgoing electrons [rad]
q_axis (1d numpy array) – The momentum on which the GOS table are calculated. [kg m /s]?
GOSmatrix (2d numpy array) – The GOS
q_steps (uint) – The number of q points used to numerically calculate the integral over the q direction. (default: 100)
swap_axes (boolean) – The two GOS tables from Segger and Zhang have different axes. So for one, the energy axis is the first one and for the other it is the q-axis. Hence by swapping the axes we can use the same function for both. (default: False)
- Returns:
dsigma_dE – The calculated cross section in m^2
- Return type:
1d numpy array
- pyEELSMODEL.misc.hs_gdos.get_powerLaw_extrapolation(rel_energy_axis, q_axis, GOSmatrix, E0, beta, alpha, q_steps=100, swap_axes=False)
If the energy axis for the cross section extends the range of calculated GOS then the last two point are used to extrapolate a power-law from.
- Parameters:
rel_energy_axis (float) – The energy from which the GOS should be interpolated
q (float) – The q from the GOS should be interpolated
E_axis (numpy array) – The energy axis on which the GOS is calculated
q_axis (numpy array) – The q axis on which the GOS is calculated
swap_axes (boolean) – Indicates if the axes for q and E should be swapped. There is a difference between the GOS from Segger and Zhang.
- Returns:
A (float) – The amplitude of the power-law
r (float) – The power of the power-law
- pyEELSMODEL.misc.hs_gdos.getgosenergy(info2_1, info2_2, n)
- pyEELSMODEL.misc.hs_gdos.getgosq(info1_1, info1_2, n)
- pyEELSMODEL.misc.hs_gdos.getinterpolatedgos(E, q, E_axis, q_axis, GOSmatrix, swap_axes=False)
Gets the interpolated value of the GOS from the E and q value.
- Parameters:
E (float) – The energy from which the GOS should be interpolated
q (float) – The q from the GOS should be interpolated
E_axis (numpy array) – The energy axis on which the GOS is calculated
q_axis (numpy array) – The q axis on which the GOS is calculated
swap_axes (boolean) – Indicates if the axes for q and E should be swapped. There is a difference between the GOS from Segger and Zhang.
- Return type:
interpolated GOS matrix
- pyEELSMODEL.misc.hs_gdos.getinterpolatedq(q, GOSarray, q_axis)
Gets the interpolated value of the GOS array as a function of q. Usefull for the bounded states
- Parameters:
q (float) – The q from the GOS should be interpolated
GOSarray – dddd
q_axis (numpy array) – The q axis on which the GOS is calculated
- Return type:
interpolated GOS matrix
- pyEELSMODEL.misc.hs_gdos.linear_interpolation(x, y, x1)
- pyEELSMODEL.misc.hs_gdos.powerlaw(x, A, r)
pyEELSMODEL.misc.hydrogen_gdos module
- pyEELSMODEL.misc.hydrogen_gdos.convergence_correction_factor(alpha, beta, theta_sampling)
geometric correction factor for convergent beam in STEM #BY ZEZHONG Reference:
Kohl, H. “A simple procedure for evaluating effective scattering cross-sections in STEM.” Ultramicroscopy 16.2 (1985): 265-268.
- Parameters:
alpha (float) – incident beam convergence angle in rad
beta (float) – collection angle in rad
theta_sampling (np.array) – scattering angle in rad
- Returns:
correction factor for each scattering angle
- Return type:
np.array
- pyEELSMODEL.misc.hydrogen_gdos.correction_factor_kohl(alpha, beta, theta, min_alpha=1e-06)
STILL NEEDS TO BE VALIDATED Calculates the correction factor when using a convergent probe. For probes having is convergence angle smaller than min_alpha no correction is applied. Ultramicroscopy 16 (1985) 265-268: https://doi.org/10.1016/0304-3991(85)90081-6
- alphafloat
Convergence angle in radians
- betafloat
Collection angle in radians
- thetafloat
The angle for which the correction factor should be calculated
- min_alphafloat
Minimum convergence angle for which the correction is applied
- corr_factorfloat
correction factor used in the integration
- pyEELSMODEL.misc.hydrogen_gdos.dsigma_dE_hydrogenic(energy_axis, Z, ek, E0, beta, alpha, shell='K', q_steps=100)
Calculates the differential cross section for a given energy axis. It uses the approximation of a convergent beam (alpha).
- energy_axisnumpy array
The energy in eV
- Zint
Atomic number
- ek: float
The energy of the edge onset
- E0: float
Energy of the incoming electron in eV
- beta: float
Collection angle in radians
- alpha: float
Convergence angle in radians (NOT YET IMPLEMENTED)
- shell: string
Should be “K” or “L” to indicate which edge to calculate
- q_steps: int
The number of calculations for every energy which is used to integrate over in q-space
- dsigma_dE: numpy_array
The differential energy cross section
- pyEELSMODEL.misc.hydrogen_gdos.gdos_k(E, qa0sq, Z)
Calculates the hydrogenic GDOS for the k edge of an atom with atomic number Z.
- Parameters:
E (float) – The energy in eV.
qa0sq (float) – The q*a0**2 value (derived from momentum)
Z (int) – Atomic number
- Return type:
GDOS
- pyEELSMODEL.misc.hydrogen_gdos.gdos_l(E, qa0sq, Z)
Calculates the hydrogenic GDOS for the l edge of an atom with atomic number Z.
- Parameters:
E (float) – The energy in eV.
qa0sq (float) – The q*a0**2 value (derived from momentum)
Z (int) – Atomic number
- Return type:
GDOS
- pyEELSMODEL.misc.hydrogen_gdos.get_EK()
- pyEELSMODEL.misc.hydrogen_gdos.get_IE1()
- pyEELSMODEL.misc.hydrogen_gdos.get_IE3()
- pyEELSMODEL.misc.hydrogen_gdos.get_XU()
- pyEELSMODEL.misc.hydrogen_gdos.get_qmin_max(E, E0, beta, alpha=1e-09, return_q=False)
Returns the minimum and maximum q vector over which to integrate to get the cross section.
pyEELSMODEL.misc.make_element_hdf5 module
pyEELSMODEL.misc.pdf_maker module
- class pyEELSMODEL.misc.pdf_maker.PDF(orientation='P', unit='mm', format='A4')
Bases:
FPDFClass which makes a pdf, this is useful when wanting to have some information used on a procedure you applied to the data. For instance, the FastAlignZeroLoss class can generate a file with the relevant information which can be checked if everything went fine.
- add_figure(fig)
- get_figname()
- get_savename()
- get_time_name()
- intitialize(path)
pyEELSMODEL.misc.physical_constants module
Definition of the physical constants used with its units.
- pyEELSMODEL.misc.physical_constants.R()
Rydberg constant in eV
- pyEELSMODEL.misc.physical_constants.T(E0, m=9.11e-31)
The effective incident energy in eV
:param E0:energy in eV? :param m:mass in kg :return:
- pyEELSMODEL.misc.physical_constants.Zs_k(Z)
Corrects for the screening of the electrons for the k shell. :param Z: The number of protons :return: Corrected Z value
- pyEELSMODEL.misc.physical_constants.a0()
Bohr radius in m
- pyEELSMODEL.misc.physical_constants.c()
Speed of light in m/s
- pyEELSMODEL.misc.physical_constants.characteristic_angle(E, E0, use_rel=True)
- pyEELSMODEL.misc.physical_constants.e()
Electron charge in C
- pyEELSMODEL.misc.physical_constants.gamma(E0, m=9.11e-31)
The formula works for energies of the electron which are not to close to the speed of light?
- Parameters:
E0 – Energy incoming electron (eV) m: mass of the particle (kg) electron mass as default
- Returns:
gamma: float
- pyEELSMODEL.misc.physical_constants.h(unit='J')
- pyEELSMODEL.misc.physical_constants.hbar(unit='J')
- pyEELSMODEL.misc.physical_constants.joule_to_eV(J)
- pyEELSMODEL.misc.physical_constants.m0()
Rest mass in kg
- pyEELSMODEL.misc.physical_constants.speed_electron(E0)
Relativistic speed of electron