hyperspy.misc.eels package

Submodules

hyperspy.misc.eels.base_gos module

class hyperspy.misc.eels.base_gos.GOSBase

Bases: object

get_parametrized_energy_axis(k1, k2, n)
get_parametrized_qaxis(k1, k2, n)
get_qaxis_and_gos(ienergy, qmin, qmax)
read_elements()

hyperspy.misc.eels.eelsdb module

This module provides tools to interact with The EELS Database.

hyperspy.misc.eels.eelsdb.eelsdb(spectrum_type=None, title=None, author=None, element=None, formula=None, edge=None, min_energy=None, max_energy=None, resolution=None, min_energy_compare='gt', max_energy_compare='lt', resolution_compare='lt', max_n=-1, monochromated=None, order=None, order_direction='ASC')

Download spectra from the EELS Data Base.

Parameters:
  • spectrum_type ({'coreloss', 'lowloss', 'zeroloss', 'xrayabs'}, optional) –
  • title (string) – Search spectra titles for a text string.
  • author (string, optional) – Search authors for a text string.
  • element (string or list of strings, optional) – Filter for the presence of one or more element. Each string must correspond with a valid element symbol.
  • formula (string) – Chemical formula of the sample.
  • edge ({'K', 'L1', 'L2,3', 'M2,3', 'M4,5', 'N2,3', 'N4,5' 'O2,3', 'O4,5'}, optional) – Filter for spectra with a specific class of edge.
  • max_energy (min_energy,) – Minimum and maximum energy in eV.
  • resolution (float, optional) – Energy resolution in eV.
  • resolution_compare ({"lt", "eq", "gt"}, optional, default "lt") – “lt” to search for all spectra with resolution less than resolution. “eq” for equal, “gt” for greater than.
  • max_energy_compare (min_energy_compare,) – “lt” to search for all spectra with min/max energy less than min_energy`max_energy`. “eq” for equal, “gt” for greater than. Deafault values are “gt”/”lt” for min_energy`max_energy` respectively.
  • monochromated (bool or None (default)) –
  • max_n (int, default -1) – Maximum number of spectra to return. -1 to return all.
  • order (string) – Key to sort results by. Valid keys are: * “spectrumType”, * “spectrumMin”, * “spectrumMax”, * “stepSize”, * “spectrumFormula”, * “spectrumElement”, * “spectrumUpload”, * “source_purity”, * “spectrumEdges”, * “microscope”, * “guntype”, * “beamenergy”, * “resolution”, * “monochromated”, * “acquisition_mode”, * “convergence”, * “collection”, * “probesize”, * “beamcurrent”, * “integratetime”, * “readouts”, * “detector”, * “darkcurrent”, * “gainvariation”, * “calibration”, * “zeroloss_deconv”, * “thickness”, * “deconv_fourier_log”, * “deconv_fourier_ratio”, * “deconv_stephens_deconvolution”, * “deconv_richardson_lucy”, * “deconv_maximum_entropy”, * “deconv_other”, * “assoc_spectra”, * “ref_freetext”, * “ref_doi”, * “ref_url”, * “ref_authors”, * “ref_journal”, * “ref_volume”, * “ref_issue”, * “ref_page”, * “ref_year”, * “ref_title”, * “otherURLs”
  • order_direction ({"ASC", "DESC"}) – Sorting order direction.
Returns:

spectra – A list containing all the spectra matching the given criteria if any.

Return type:

list

hyperspy.misc.eels.effective_angle module

hyperspy.misc.eels.effective_angle.effective_angle(E0, E, alpha, beta)

Calculates the effective collection angle

Parameters:
  • E0 (float) – electron beam energy in keV
  • E (float) – energy loss in eV
  • alpha (float) – convergence angle in mrad
  • beta (float) – collection angle in mrad
Returns:

float

Return type:

effective collection angle in mrad

Notes

Code translated to Python from Egerton (second edition) page 420

hyperspy.misc.eels.hartree_slater_gos module

class hyperspy.misc.eels.hartree_slater_gos.HartreeSlaterGOS(element_subshell)

Bases: hyperspy.misc.eels.base_gos.GOSBase

Read Hartree-Slater Generalized Oscillator Strenght parametrized from files.

Parameters:element_subshell ({str, dict}) – Usually a string, for example, ‘Ti_L3’ for the GOS of the titanium L3 subshell. If a dictionary is passed, it is assumed that Hartree Slater GOS was exported using GOS.as_dictionary, and will be reconstructed.
readgosfile()

Read the GOS files of the element subshell from the location defined in Preferences.

get_qaxis_and_gos(ienergy, qmin, qmax)

given the energy axis index and qmin and qmax values returns the qaxis and gos between qmin and qmax using linear interpolation to include qmin and qmax in the range.

as_dictionary()

Export the GOS as a dictionary that can be saved.

energy_axis

array – The tabulated energy axis

qaxis

array – The tabulated qaxis

energy_onset

float – The energy onset for the given element subshell as obtained from iternal tables.

as_dictionary(fullcopy=True)

Export the GOS as a dictionary

integrateq(onset_energy, angle, E0)
readgosfile()

hyperspy.misc.eels.hydrogenic_gos module

class hyperspy.misc.eels.hydrogenic_gos.HydrogenicGOS(element_subshell)

Bases: hyperspy.misc.eels.base_gos.GOSBase

Computes the K and L GOS using R. Egerton’s routines.

Parameters:element_subshell (str) – For example, ‘Ti_L3’ for the GOS of the titanium L3 subshell
parametrize_GOS()

Parametrize the GOS to speed up the calculation.

get_qaxis_and_gos(ienergy, qmin, qmax)

Given the energy axis index and qmin and qmax values returns the qaxis and gos between qmin and qmax using linear interpolation to include qmin and qmax in the range.

energy_axis

array – The tabulated energy axis

qaxis

array – The tabulated qaxis

energy_onset

float – The energy onset for the given element subshell as obtained from iternal tables.

Notes

The Hydrogeninc GOS are calculated using R. Egerton’s SIGMAK3 and SIGMAL3 routines that has been translated from Matlab to Python by I. Iyengar. See http://www.tem-eels.ca/ for the original code.

gosfuncK(E, qa02)
gosfuncL(E, qa02)
integrateq(onset_energy, angle, E0)

hyperspy.misc.eels.tools module

hyperspy.misc.eels.tools.eels_constant(s, zlp, t)
Calculate the constant of proportionality (k) in the relationship

between the EELS signal and the dielectric function. dielectric function from a single scattering distribution (SSD) using the Kramers-Kronig relations.

$S(E)=

rac{I_{0}t}{pi a_{0}m_{0}v^{2}}lnleft[1+left( rac{eta}

{ heta_{E}}

ight)^{2} ight]Im( rac{-1}{epsilon(E)})=

kIm(

rac{-1}{epsilon(E)})$

zlp: {number, BaseSignal}
If the ZLP is the same for all spectra, the intengral of the ZLP can be provided as a number. Otherwise, if the ZLP intensity is not the same for all spectra, it can be provided as i) a Signal of the same dimensions as the current signal containing the ZLP spectra for each location ii) a Signal of signal dimension 0 and navigation_dimension equal to the current signal containing the integrated ZLP intensity.
t: {None, number, BaseSignal}
The sample thickness in nm. If the thickness is the same for all spectra it can be given by a number. Otherwise, it can be provided as a Signal with signal dimension 0 and navigation_dimension equal to the current signal.

k: Signal instance

hyperspy.misc.eels.tools.estimate_variance_parameters(noisy_signal, clean_signal, mask=None, pol_order=1, higher_than=None, return_results=False, plot_results=True, weighted=False)

Find the scale and offset of the Poissonian noise

By comparing an SI with its denoised version (i.e. by PCA), this plots an estimation of the variance as a function of the number of counts and fits a polynomy to the result.

Parameters:
  • clean_SI (noisy_SI,) –
  • mask (numpy bool array) – To define the channels that will be used in the calculation.
  • pol_order (int) – The order of the polynomy.
  • higher_than (float) – To restrict the fit to counts over the given value.
  • return_results (Bool) –
  • plot_results (Bool) –
Returns:

  • Dictionary with the result of a linear fit to estimate the offset
  • and scale factor

hyperspy.misc.eels.tools.power_law_perc_area(E1, E2, r)
hyperspy.misc.eels.tools.ratio(edge_A, edge_B)
hyperspy.misc.eels.tools.rel_std_of_fraction(a, std_a, b, std_b, corr_factor=1)

Module contents