lumispy.utils

axis2eV

Convert given signal axis to energy scale (eV) using wavelength dependent refractive index of air.

axis2invcm

Convert given signal axis to wavenumber scale (cm$^{-1}$).

com

Find the centroid (center of mass) of a peak.

data2eV

The intensity is converted from counts/nm (counts/µm) to counts/meV by doing a Jacobian transformation, see e.g. Mooney and Kambhampati, J.

data2invcm

The intensity is converted from counts/nm (counts/µm) to counts/cm$^{-1}$ by doing a Jacobian transformation, see e.g. Mooney and Kambhampati, J.

solve_grating_equation

Solve the grating equation.

var2eV

The variance is converted doing a squared Jacobian renormalization to match with the transformation of the data.

var2invcm

The variance is converted doing a squared Jacobian renormalization to match with the transformation of the data.

Module containing utility functions for LumiSpy.

lumispy.utils.axis2eV(ax0)

Convert given signal axis to energy scale (eV) using wavelength dependent refractive index of air. Assumes wavelength in units of nm unless the axis units are specifically set to µm.

lumispy.utils.axis2invcm(ax0)

Convert given signal axis to wavenumber scale (cm$^{-1}$). Assumes wavelength in units of nm unless the axis units are specifically set to µm.

lumispy.utils.com(spectrum_intensities, signal_axis, **kwargs)

Find the centroid (center of mass) of a peak.

Basically represents a weighted average of the spectrum based on the intensity at each pixel and its respective signal axis.

Parameters:
  • spectrum_intensities (array) – An array with the intensities of the spectrum.

  • signal_axis (hyperspy.axes.BaseDataAxis subclass) – A HyperSpy signal axis class containing an array with the wavelength/ energy for each intensity/signal value.

  • kwargs (dictionary) – For the scipy.interpolate.interp1d function.

Returns:

center_of_mass – The centroid of the spectrum.

Return type:

float

Examples

# Assume we have a spectrum with wavelengths and intensities >>> wavelengths = [200, 300, 400, 500, 600, 700] >>> intensities = [1, 2, 3, 2, 1, 0] >>> from hyperspy.axes import DataAxis >>> signal_axis = DataAxis(axis=wavelengths)

>>> center_of_mass = com(intensities, signal_axis)
>>> print(center_of_mass)  # Outputs: [400.0]
lumispy.utils.data2eV(data, factor, evaxis, ax0)

The intensity is converted from counts/nm (counts/µm) to counts/meV by doing a Jacobian transformation, see e.g. Mooney and Kambhampati, J. Phys. Chem. Lett. 4, 3316 (2013). Ensures that integrated signals are still correct.

lumispy.utils.data2invcm(data, factor, invcmaxis, ax0=None)

The intensity is converted from counts/nm (counts/µm) to counts/cm$^{-1}$ by doing a Jacobian transformation, see e.g. Mooney and Kambhampati, J. Phys. Chem. Lett. 4, 3316 (2013). Ensures that integrated signals are still correct.

lumispy.utils.solve_grating_equation(axis, gamma_deg, deviation_angle_deg, focal_length_mm, ccd_width_mm, grating_central_wavelength_nm, grating_density_gr_mm)

Solve the grating equation.

See https://horiba.com/uk/scientific/products/optics-tutorial/wavelength-pixel-position for equations.

Parameters:
  • axis (hyperspy.axis) – Axis in pixel units (no units) to convert to wavelength.

  • gamma_deg (float) – Inclination angle between the focal plane and the centre of the grating (found experimentally from calibration). In degree.

  • deviation_angle_deg (float) – Also known as included angle. It is defined as the difference between angle of diffraction (\(\beta\)) and angle of incidence (\(\alpha\)). Given by manufacturer specsheet. In degree.

  • focal_length_mm (float) – Given by manufacturer specsheet. In mm.

  • ccd_width_mm (float) – The width of the CDD. Given by manufacturer specsheet. In mm.

  • grating_central_wavelength_nm (float) – Wavelength at the centre of the grating, where exit slit is placed. In nm.

  • grating_density_gr_mm (int) – Grating density in gratings per mm.

Returns:

axis – HyperSpy axis object.

Return type:

hyperspy.axis

lumispy.utils.var2eV(variance, factor, evaxis, ax0)

The variance is converted doing a squared Jacobian renormalization to match with the transformation of the data.

lumispy.utils.var2invcm(variance, factor, invcmaxis, ax0=None)

The variance is converted doing a squared Jacobian renormalization to match with the transformation of the data.