redback.transient.transient.Spectrum

class redback.transient.transient.Spectrum(angstroms: ndarray, flux_density: ndarray, flux_density_err: ndarray, time: str = None, name: str = '', **kwargs)[source]

Bases: object

__init__(angstroms: ndarray, flux_density: ndarray, flux_density_err: ndarray, time: str = None, name: str = '', **kwargs) None[source]

A class to store spectral data.

Parameters:
  • angstroms – Wavelength in angstroms.

  • flux_density – flux density in ergs/s/cm^2/angstrom.

  • flux_density_err – flux density error in ergs/s/cm^2/angstrom.

  • time – Time of the spectrum. Could be a phase or time since burst. Only used for plotting.

  • name – Name of the spectrum.

__call__(**kwargs)

Call self as a function.

Methods

__init__(angstroms, flux_density, ...[, ...])

A class to store spectral data.

plot_data([axes, filename, outdir, save, ...])

Plots the Transient data and returns Axes.

plot_residual(model[, filename, outdir, ...])

plot_spectrum(model[, filename, outdir, ...])

Attributes

xlabel

xlabel used in plotting functions :rtype: str

ylabel

ylabel used in plotting functions :rtype: str

plot_data(axes: Axes = None, filename: str = None, outdir: str = None, save: bool = True, show: bool = True, color: str = 'k', **kwargs) Axes[source]

Plots the Transient data and returns Axes.

Parameters:
  • axes – Matplotlib axes to plot the lightcurve into. Useful for user specific modifications to the plot.

  • filename – Name of the file to be plotted in.

  • outdir – The directory in which to save the file in.

  • save – Whether to save the plot. (Default value = True)

  • show – Whether to show the plot. (Default value = True)

  • color – Color of the data.

  • kwargs – Additional keyword arguments to pass in the Plotter methods.

Available in the online documentation under at redback.plotting.Plotter. print(Transient.plot_data.__doc__) to see all options! :return: The axes with the plot.

plot_residual(model: callable, filename: str = None, outdir: str = None, axes: Axes = None, save: bool = True, show: bool = True, posterior: DataFrame = None, model_kwargs: dict = None, **kwargs: None) Axes[source]
Parameters:
  • model – The model used to plot the lightcurve.

  • filename – The output filename. Otherwise, use default which starts with the name attribute and ends with *lightcurve.png.

  • axes – Axes to plot in if given.

  • save – Whether to save the plot.

  • show – Whether to show the plot.

  • posterior – Posterior distribution to which to draw samples from. Is optional but must be given.

  • outdir – Out directory in which to save the plot. Default is the current working directory.

  • model_kwargs – Additional keyword arguments to be passed into the model.

  • kwargs – Additional keyword arguments to pass in the Plotter methods.

Available in the online documentation under at redback.plotting.Plotter. print(Transient.plot_residual.__doc__) to see all options! :return: The axes.

plot_spectrum(model: callable, filename: str = None, outdir: str = None, axes: Axes = None, save: bool = True, show: bool = True, random_models: int = 100, posterior: DataFrame = None, model_kwargs: dict = None, **kwargs: None) Axes[source]
Parameters:
  • model – The model used to plot the lightcurve.

  • filename – The output filename. Otherwise, use default which starts with the name attribute and ends with *lightcurve.png.

  • axes – Axes to plot in if given.

  • save – Whether to save the plot.

  • show – Whether to show the plot.

  • random_models – Number of random posterior samples plotted faintly. (Default value = 100)

  • posterior – Posterior distribution to which to draw samples from. Is optional but must be given.

  • outdir – Out directory in which to save the plot. Default is the current working directory.

  • model_kwargs – Additional keyword arguments to be passed into the model.

  • kwargs – Additional keyword arguments to pass in the Plotter methods.

Available in the online documentation under at redback.plotting.Plotter. print(Transient.plot_lightcurve.__doc__) to see all options! :return: The axes.

property xlabel: str

xlabel used in plotting functions :rtype: str

Type:

return

property ylabel: str

ylabel used in plotting functions :rtype: str

Type:

return