sncosmo.Source

class sncosmo.Source[source]

An abstract base class for transient models.

A “transient model” in this case is the spectral time evolution of a source, as defined in the rest-frame of the transient: Source subclass instances define a spectral flux density (in, e.g., erg / s / cm^2 / Angstrom) as a function of phase and wavelength, where phase and wavelength are in the source’s rest-frame. (The Model class wraps a Source instance and takes care of redshift and time dilation.) This two-dimensional spectral surface can be a function of any number of parameters that alter its amplitude or shape. Different subclasses will have different parameters.

This is an abstract base class – You can’t create instances of this class. Instead, you must work with subclasses such as TimeSeriesSource. Subclasses must define (at minimum):

  • __init__()

  • _param_names (list of str)

  • _parameters (numpy.ndarray)

  • _flux(ndarray, ndarray)

  • minphase()

  • maxphase()

  • minwave()

  • maxwave()

abstract __init__()[source]

Methods

__init__()

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.

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.

parameters

Parameter value array