redback.sed.RedbackTimeSeriesSource

class redback.sed.RedbackTimeSeriesSource(phase, wave, flux, **kwargs)[source]

Bases: TimeSeriesSource

__init__(phase, wave, flux, **kwargs)[source]

RedbackTimeSeriesSource is a subclass of sncosmo.TimeSeriesSource that adds the ability to return the flux density at a given time and wavelength, and changes the behaviour of the _flux method to better handle models with very low flux values.

Parameters:
  • phase – phase/time array

  • wave – wavelength array in Angstrom

  • spectra – spectra in erg/cm^2/s/A evaluated at all times and frequencies; shape (len(times), len(frequency_array))

  • kwargs – additional arguments

__call__(**kwargs)

Call self as a function.

Methods

__init__(phase, wave, flux, **kwargs)

RedbackTimeSeriesSource is a subclass of sncosmo.TimeSeriesSource that adds the ability to return the flux density at a given time and wavelength, and changes the behaviour of the _flux method to better handle models with very low flux values.

bandflux(band, phase[, zp, zpsys])

Flux through the given bandpass(es) at the given phase(s).

bandmag(band, magsys, phase)

Magnitude at the given phase(s) through the given bandpass(es), and for the given magnitude system(s).

flux(phase, wave)

The spectral flux density at the given phase and wavelength values.

get(name)

Get parameter of the model by name.

get_flux_density(time, wavelength)

Get the flux density at a given time and wavelength.

maxphase()

maxwave()

minphase()

minwave()

peakmag(band, magsys[, sampling])

Peak apparent magnitude in rest-frame bandpass.

peakphase(band_or_wave[, sampling])

Determine phase of maximum flux for the given band/wavelength.

set(**param_dict)

Set parameters of the model by name.

set_peakmag(m, band, magsys[, sampling])

Set peak apparent magnitude in rest-frame bandpass.

update(param_dict)

Set parameters of the model from a dictionary.

Attributes

param_names

List of parameter names.

param_names_latex

parameters

Parameter value array

bandflux(band, phase, zp=None, zpsys=None)[source]

Flux through the given bandpass(es) at the given phase(s).

Default return value is flux in photons / s / cm^2. If zp and zpsys are given, flux(es) are scaled to the requested zeropoints.

Parameters:
  • band (str or list_like) – Name(s) of bandpass(es) in registry.

  • phase (float or list_like, optional) – Phase(s) in days. Default is None, which corresponds to the full native phase sampling of the model.

  • zp (float or list_like, optional) – If given, zeropoint to scale flux to (must also supply zpsys). If not given, flux is not scaled.

  • zpsys (str or list_like, optional) – Name of a magnitude system in the registry, specifying the system that zp is in.

Returns:

bandflux – Flux in photons / s /cm^2, unless zp and zpsys are given, in which case flux is scaled so that it corresponds to the requested zeropoint. Return value is float if all input parameters are scalars, ~numpy.ndarray otherwise.

Return type:

float or ~numpy.ndarray

bandmag(band, magsys, phase)[source]

Magnitude at the given phase(s) through the given bandpass(es), and for the given magnitude system(s).

Parameters:
  • band (str or list_like) – Name(s) of bandpass in registry.

  • magsys (str or list_like) – Name(s) of ~sncosmo.MagSystem in registry.

  • phase (float or list_like) – Phase(s) in days.

Returns:

mag – Magnitude for each item in band, magsys, phase. The return value is a float if all parameters are not iterables. The return value is an ~numpy.ndarray if any are iterable.

Return type:

float or ~numpy.ndarray

flux(phase, wave)

The spectral flux density at the given phase and wavelength values.

Parameters:
  • phase (float or list_like, optional) – Phase(s) in days. Must be monotonically increasing. If None (default), the native phases of the model are used.

  • wave (float or list_like, optional) – Wavelength(s) in Angstroms. Must be monotonically increasing. If None (default), the native wavelengths of the model are used.

Returns:

flux – Spectral flux density values in ergs / s / cm^2 / Angstrom.

Return type:

float or ~numpy.ndarray

get(name)

Get parameter of the model by name.

get_flux_density(time, wavelength)[source]

Get the flux density at a given time and wavelength.

Parameters:
  • time – time in days

  • wavelength – wavelength in Angstrom

Returns:

flux density in erg/cm^2/s/A

property param_names

List of parameter names.

property parameters

Parameter value array

peakmag(band, magsys, sampling=1.0)

Peak apparent magnitude in rest-frame bandpass.

peakphase(band_or_wave, sampling=1.0)

Determine phase of maximum flux for the given band/wavelength.

This method generates the light curve in the given band/wavelength and finds the highest-flux point. It then finds the parabola that passes through this point and the two neighboring points, and returns the position of the peak of the parabola.

set(**param_dict)

Set parameters of the model by name.

set_peakmag(m, band, magsys, sampling=1.0)

Set peak apparent magnitude in rest-frame bandpass.

update(param_dict)

Set parameters of the model from a dictionary.