Steady-State Spectra API (pymorgan.steadyState)#
Spectrum & SpectrumSeries (pymorgan.steadyState.dataset)#
Steady-state spectra: Spectrum and SpectrumSeries.
These mirror the design of pymorgan.oneD.Dataset1D: a thin object over
the raw arrays, formats resolved through a loader registry, and presentation
driven by the shared pymorgan.settings.Settings. A Spectrum
can be plotted on its own, overlaid as part of a SpectrumSeries, or
fed into pymorgan.oneD.Dataset1D.plot_spectra() as a steady-state overlay.
- class pymorgan.steadyState.dataset.SpectrumKind(*values)[source]#
Bases:
StrEnumKind of steady-state measurement: absorption, emission or excitation.
- ABSORPTION = 'absorption'#
- EMISSION = 'emission'#
- EXCITATION = 'excitation'#
- class pymorgan.steadyState.dataset.Spectrum(x, y, kind=SpectrumKind.ABSORPTION, *, x_units='nm', label=None, source=None)[source]#
Bases:
objectA single steady-state spectrum (one X-Y trace plus metadata).
- Parameters:
kind (SpectrumKind | str)
x_units (str)
label (str | None)
source (str | None)
- classmethod from_file(path, kind=SpectrumKind.ABSORPTION, *, data_type='csv', x_units=None, label=None)[source]#
Load a spectrum from
pathusing the loader fordata_type.
- normalized()[source]#
Alias for
normalised().- Return type:
- to_stimulated_emission()[source]#
Return the stimulated-emission spectrum
F_stim = F_spont * x^4.Defined for emission spectra on a wavelength axis. The
x^4factor converts a spontaneous-emission line shape to the stimulated-emission cross-section used when overlaying on transient spectra.- Return type:
- class pymorgan.steadyState.dataset.SpectrumSeries(spectra=None)[source]#
Bases:
objectAn ordered collection of
Spectrumobjects, plotted as an overlay.- Parameters:
spectra (Iterable[Spectrum] | None)
- classmethod from_files(paths, kind=SpectrumKind.ABSORPTION, *, data_type='csv', x_units=None, labels=None)[source]#
Load several spectra into a series.
- Parameters:
- Return type:
- add(spectrum)[source]#
Append a spectrum and return
self(chainable).- Parameters:
spectrum (Spectrum)
- Return type:
- normalized()[source]#
Alias for
normalised().- Return type:
- pymorgan.steadyState.dataset.load_spectrum(path, kind=SpectrumKind.ABSORPTION, *, data_type='csv', x_units=None, label=None)[source]#
Convenience wrapper for
Spectrum.from_file().
- pymorgan.steadyState.dataset.plot_steady_state(abs_spectrum=None, em_spectrum=None, ax=None, *, settings=None, label_style=None, plot_mode=None, normalise=False, normalize=None, **kwargs)[source]#
Plot steady-state absorption and/or emission spectra.
When both absorption and emission are provided, plot_mode determines the layout: -
SteadyStatePlotMode.DOUBLE_Y(default): Absorption on the primary (left) Y-axis,Emission on a twin (right) Y-axis (via
ax.twinx()) sharing the same X-axis.SteadyStatePlotMode.NORMALISED: Both spectra normalised to their maximum (1.0) on a single shared Y-axis.
If only one spectrum is provided, it is drawn on a single axis.
- Returns:
The axis (or tuple of (primary_ax, twin_ax)) the spectra were drawn into.
- Return type:
matplotlib.axes.Axes or tuple[matplotlib.axes.Axes, matplotlib.axes.Axes]
- Parameters:
Steady-State Loader Registry (pymorgan.steadyState.registry)#
Loader registry for steady-state spectra (absorption / emission).
A loader maps a file path to (x, y, x_units) where x and y are
1-D arrays (spectral axis and signal) and x_units is a best-guess unit
string for the spectral axis ("nm", "cm^{-1}", "eV") or None.
New formats are added with register_spectrum_loader().
- pymorgan.steadyState.registry.register_spectrum_loader(*names)[source]#
Register a steady-state loader under one or more data-type names.
- pymorgan.steadyState.registry.get_spectrum_loader(name)[source]#
Return the loader registered for
nameor raiseKeyError.
- pymorgan.steadyState.registry.available_spectrum_loaders()[source]#
Return the sorted list of registered data-type names.
- pymorgan.steadyState.registry.read_xy(path)[source]#
Read a two-column X-Y text file with an auto-detected delimiter.
The delimiter is detected per line among whitespace, tab, comma and semicolon, so space-, tab- and comma-separated files all parse. Lines that are blank, start with
#or do not parse as numbers (e.g. a header) are skipped; the last such header line is used to guess the spectral-axis unit.