sncosmo.Model¶
- class sncosmo.Model(source, effects=None, effect_names=None, effect_frames=None)[source]¶
An observer-frame model, composed of a Source and zero or more effects.
- Parameters:
- source
Source
or str The model for the spectral evolution of the source. If a string is given, it is used to retrieve a
Source
from the registry.- effectslist of
PropagationEffect
List of
PropagationEffect
instances to add.- effect_nameslist of str
Names of effects (same length as
effects
). The names are used to label the parameters.- effect_frameslist of str
The frame that each effect is in (same length as
effects
). Must be one of {‘rest’, ‘obs’}.
- source
Notes
The Source and PropagationEffects are copied upon instanciation.
Examples
>>> model = sncosmo.Model(source='hsiao')
Methods
__init__
(source[, effects, effect_names, ...])add_effect
(effect, name, frame)Add a PropagationEffect to the model.
bandflux
(band, time[, zp, zpsys])Flux through the given bandpass(es) at the given time(s).
bandfluxcov
(band, time[, zp, zpsys])Like bandflux(), but also returns model covariance on values.
bandmag
(band, magsys, time)Magnitude at the given time(s) through the given bandpass(es), and for the given magnitude system(s).
bandoverlap
(band[, z])Return True if model dispersion range fully overlaps the band.
color
(band1, band2, magsys, time)band1 - band2 color at the given time(s) through the given pair of bandpasses, and for the given magnitude system.
flux
(time, wave)The spectral flux density at the given time and wavelength values.
get
(name)Get parameter of the model by name.
maxtime
()Maximum observer-frame time at which the model is defined.
maxwave
()Maximum observer-frame wavelength of the model.
mintime
()Minimum observer-frame time at which the model is defined.
minwave
()Minimum observer-frame wavelength of the model.
set
(**param_dict)Set parameters of the model by name.
set_source_peakabsmag
(absmag, band, magsys)Set the amplitude of the source component of the model according to the desired absolute magnitude in the specified band.
set_source_peakmag
(m, band, magsys[, sampling])Set the amplitude of the source component of the model according to a peak apparent magnitude.
source_peakabsmag
(band, magsys[, sampling, ...])Peak absolute magnitude of the source in rest-frame bandpass.
source_peakmag
(band, magsys[, sampling])Peak apparent magnitude of source in a rest-frame bandpass.
update
(param_dict)Set parameters of the model from a dictionary.
Attributes
effect_names
Names of propagation effects (list of str).
effects
List of constituent propagation effects.
param_names
List of parameter names.
parameters
Parameter value array
source
The Source instance.