lumispy.utils.signals module
- lumispy.utils.signals.com(spectrum_intensities, wavelengths)
Finds the centroid (center of mass) of a peak in the spectrum from the wavelength (or pixel number) and the intensity at each pixel value. :param spectrum_intensities: An array with the intensities of the spectrum. :type spectrum_intensities: array :param wavelengths: An array with the wavelength for each intensity value. :type wavelengths: array
- Returns
center_of_mass – The centroid of the spectrum.
- Return type
Examples
# Assume we have a spectrum with wavelengths and intensities >>> wavelengths = [200, 300, 400, 500, 600, 700] >>> intensities = [1, 2, 3, 2, 1, 0]
>>> center_of_mass = com(wavelengths, intensities) >>> print(center_of_mass) # Outputs: 450.0