SpectrumManager (xsnap.SpectrumManager)#

class SpectrumManager(specs=None, tExplosion=None)#

Bases: object

Manage a collection of SpectrumFit objects for batch analysis and plotting.

specs#

Each entry is {'spec': SpectrumFit, 'instr': str}.

Type:

list[dict]

tExplosion#

Supernova time of explosion in MJD.

Type:

float or None

fluxes#

Combined flux DataFrames, keyed by ‘absorbed’/’unabsorbed’.

Type:

dict or None

counts#

Combined count-rate DataFrame.

Type:

pandas.DataFrame or None

lumin#

Combined luminosity DataFrame.

Type:

pandas.DataFrame or None

params#

Combined parameters DataFrame.

Type:

pandas.DataFrame or None

__init__(specs=None, tExplosion=None)#

Initialize of the SpectrumManager class

Parameters:
  • specs (SpectrumFit or array[tuple(SpectrumFit, str)], optional) – Collection of SpectrumFit objects, can be parsed singularly or an iterable of (SpectrumFit, instrument) pairs. Defaults to None.

  • tExplosion (float, optional) – Supernova time of explosion in MJD to override or set. Defaults to None.

clear()#

Clear all loaded SpectrumFit objects.

load(specs, instrument=None)#

Load one or many SpectrumFit instances, with optional instrument labels.

Parameters:
Returns:

selfSpectrumManager

The same SpectrumManager with new specs appended.

Raises:
plot_counts(scatter=True, log=True)#

Plot count-rate light curves for each model; one trace per instrument.

Parameters:
  • scatter (bool, optional) – If True, use scatter markers; otherwise lines. Defaults to True.

  • log (bool, optional) – If True, set y-axis to log scale. Defaults to True.

Returns:

Count rate light curve plotsdict[str, matplotlib.figure.Figure]

Mapping model: str → matplotlib.figure.Figure.

Data are grouped and labeled by instruments.

plot_flux(scatter=True, log=True)#

Plot flux light curves for each model and kind (‘absorbed’, ‘unabsorbed’).

Parameters:
  • scatter (bool, optional) – If True, use scatter markers; otherwise lines. Defaults to True.

  • log (bool, optional) – If True, set y-axis to log scale. Defaults to True.

Returns:
Flux light curve plots: dict[tuple(str, str), matplotlib.figure.Figure]

Mapping (model: str, kind: ‘absorbed’ | ‘unabsorbed’) → matplotlib.figure.Figure.

Data are grouped and labeled by instruments.

plot_lumin(scatter=True, log=True)#

Plot luminosity light curves for each model.

Parameters:
  • scatter (bool, optional) – If True, use scatter markers; otherwise lines. Defaults to True.

  • log (bool, optional) – If True, set y-axis to log scale. Defaults to True.

Returns:

Luminosity light curve plotsdict[str, matplotlib.figure.Figure]

Mapping model: str → matplotlib.figure.Figure.

Data are grouped and labeled by instruments.

plot_params(scatter=True, log=True)#

Plot fit parameter evolution vs. time for each model and parameter.

Parameters:
  • scatter (bool, optional) – If True, use scatter markers; otherwise lines. Defaults to True.

  • log (bool, optional) – If True, set y-axis to log scale. Defaults to True.

Returns:
Parameter evolution plots: dict[tuple(str, str), matplotlib.figure.Figure]

Mapping (model: str, parameter: str) → matplotlib.figure.Figure.

Data are grouped and labeled by instruments.

plot_phot(scatter=True, log=True)#

Plot photon-flux light curves for each model and kind.

Parameters:
  • scatter (bool, optional) – If True, use scatter markers; otherwise lines. Defaults to True.

  • log (bool, optional) – If True, set y-axis to log scale. Defaults to True.

Returns:

Photon flux light curve plots: dict[tuple(str, str), matplotlib.figure.Figure]

Mapping (model: str, kind: ‘absorbed’ | ‘unabsorbed’) → matplotlib.figure.Figure.

Data are grouped and labeled by instruments.