sambuca_core.spectra_operations

Contains functions for manipulating the (wavelength, value) tuples returned by the spectra readers.

sambuca_core.spectra_operations.spectra_apply_wavelength_mask(spectra, mask)[source]

Applies a wavelength mask to a spectra ((wavelengths, values) tuple). All values in the spectra that are not in the mask will be removed in the returned values. The input spectra is not modified.

Parameters:
  • spectra (tuple) – the (wavelengths, values) spectra tuple.
  • mask (array-like) – The wavelength values that should be retained.
Returns:

The masked tuple of (wavelengths, values).

sambuca_core.spectra_operations.spectra_find_common_wavelengths(*args)[source]

Finds the common subset of wavelengths for the given inputs. I could have called this intersect, but chose the name based on purpose.

Parameters:*args (array-like) – a vector of wavelength values, or a (wavelength, values) tuple.
Returns:
The common subset of wavelengths, which can be used as an
input to spectra_apply_wavelength_mask.
Return type:numpy.ndarray