# lumispy.utils.axes module¶

lumispy.utils.axes._n_air(x)

Refractive index of air as a function of WL in nm. This analytical function is correct for the range 185-1700 nm. According to E.R. Peck and K. Reeder. Dispersion of air, J. Opt. Soc. Am. 62, 958-962 (1972).

lumispy.utils.axes.axis2eV(ax0)

Converts 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.axes.axis2invcm(ax0)

Converts 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.axes.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.axes.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.axes.eV2nm(x)

Converts energy (eV) to wavelength (nm) using wavelength-dependent refractive index of air.

lumispy.utils.axes.invcm2nm(x)

Converts wavenumber (cm$^{-1}$) to wavelength (nm).

lumispy.utils.axes.join_spectra(S, r=50, scale=True, average=False, kind='slinear')

Takes list of Signal1D objects and returns a single object with all spectra joined. Joins spectra at the center of the overlapping range. Scales spectra by a factor determined as average over the range center -/+ r pixels. Works both for uniform and non-uniform axes (FunctionalDataAxis is converted into a non-uniform DataAxis).

Parameters:
• S (list of Signal1D objects (with overlapping signal axes)) –

• r (int, optional) – Number of pixels left/right of center (default 50) defining the range over which to determine the scaling factor, has to be less than half of the overlapping pixels. Change the size of r or use average=True if the function induces a step in the intensity.

• scale (boolean, optional) – If True (default), the later spectra in the list are scaled by a factor determined over center -/+ r pixels. If False, spectra are joined without scaling, which will likely induce a step unless average=True.

• average (boolean, optional) – If True, the contribution of the two signals is continuously graded within the range defined by r instead of joining at the center of the range (default).

• kind (str, optional) – Interpolation method (default ‘slinear’) to use when joining signals with a uniform signal axes. See scipy.interpolate.interp1d for options.

Returns:

• A new Signal1D object containing the joined spectra (properties are copied

• from first spectrum).

Examples

>>> s1 = hs.signals.Signal1D(np.ones(32))
>>> s2 = hs.signals.Signal1D(np.ones(32)*2)
>>> s2.axes_manager.signal_axes[0].offset = 25
>>> lum.join_spectra([s1,s2],r=2)
<Signal1D, title: , dimensions: (|57)>

lumispy.utils.axes.nm2eV(x)

Converts wavelength (nm) to energy (eV) using wavelength-dependent refractive index of air.

lumispy.utils.axes.nm2invcm(x)

Converts wavelength (nm) to wavenumber (cm$^{-1}$).

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

Solves the grating equation. See 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.axes.var2eV(variance, factor, evaxis, ax0)

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

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

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