AbsSpectrumContainer#

class quantarhei.spectroscopy.abscontainer.AbsSpectrumContainer(axis: Any = None)[source]#

Bases: Saveable

Container for a set of absorption spectra sharing a common frequency axis.

Parameters:

axis (FrequencyAxis, optional) – Shared frequency axis for all stored spectra. Can be set later via set_axis.

set_axis(axis: Any) None[source]#
set_spectrum(spect: Any, tag: Any = None) None[source]#

Store an absorption spectrum, checking axis compatibility.

Parameters:
  • spect (AbsSpectrum) – Spectrum object to store. Its frequency axis must match the container’s axis (or becomes the axis if none is set yet).

  • tag (str or None, optional) – Key under which to store the spectrum. If None, the current count value is used as the string key.

Raises:

Exception – If the spectrum’s frequency axis is incompatible with the container’s existing axis.

get_spectrum(tag: Any) Any[source]#

Return the spectrum identified by tag.

Parameters:

tag (str or int) – Key identifying the stored spectrum. Integer tags are converted to strings.

Returns:

AbsSpectrum – The stored spectrum corresponding to tag.

Raises:

Exception – If no spectrum is stored under tag.

get_spectra() list[Any][source]#

Return all stored spectra sorted by their string tags.

Returns:

list – List of stored spectra in tag-sorted order.