ComposedSpectralModel#
- class uvex_transients.models.core.base.ComposedSpectralModel(**overrides: Parameter | Quantity | float | int)[source]#
A
SpectralModelbuilt by pairing aLightcurvewith aSpectrum.\[L_\nu(\nu, t) = L_\mathrm{bol}(t) \cdot \frac{S(\nu)}{\int S(\nu')\,d\nu'}\]where \(L_\mathrm{bol}(t)\) is
_LIGHTCURVE_CLASS’s bolometric luminosity and the fraction is_SPECTRUM_CLASS’s shape, normalized (viaSpectrum.eval_normalization()) to integrate to 1 over \(\nu\). Because both halves are already exact on their own,_eval_bolometric()and_eval_spectrum()are closed-form combinations of the two components’ own primitives – unlikeSpectralModel’s generic defaults, neither ever falls back to numerical integration over frequency here.A concrete SED is defined just by naming the two component classes:
class MySED(ComposedSpectralModel): _LIGHTCURVE_CLASS = FREDLightcurve _SPECTRUM_CLASS = BlackbodySpectrum
At class-definition time,
__init_subclass__()merges_LIGHTCURVE_CLASS._DEFAULT_PARAMETERSand_SPECTRUM_CLASS._DEFAULT_PARAMETERSinto this subclass’s own_DEFAULT_PARAMETERS(any entries the subclass declares directly itself win, as overrides on top of that merge) – so from then on,MySEDbehaves exactly like any otherSpectralModelsubclass:MySED()orMySED(amplitude=..., temperature=...), one flat parameter namespace. Every parameter name must be unique across the two component classes, checked at class-definition time.Because every
SpectralModelmethod is a classmethod operating purely on**parameters(see the module docstring), no instance-level wiring of components is needed:_eval_bolometric(),_eval_spectrum(), and_eval()simply split the incomingparametersdict by name and call_LIGHTCURVE_CLASS’s/_SPECTRUM_CLASS’s own classmethods directly.See also
LightcurveThe time-only half of this composition.
SpectrumThe frequency-only half of this composition.
Methods
as_astropy_model([x_type, y_type, y_kind, ...])Build an
Modelof thisSpectralModelfor a given parameter set.as_source_spectrum(t, *[, redshift, ...])Build a
SourceSpectrumgiving the observed flux at one fixed time \(t\).eval(nu, t, **parameters)Evaluate the spectral luminosity at the given frequency and time.
eval_bolometric(t, **parameters)Evaluate the bolometric luminosity at the given time.
eval_bolometric_cgs(t, **parameters)Bolometric luminosity, taking and returning plain cgs numbers.
eval_bolometric_log(t, **parameters)Natural log of the bolometric luminosity, given physical-unit inputs.
eval_bolometric_log_cgs(t, **parameters)Natural log of the bolometric luminosity, taking and returning plain cgs numbers.
eval_cgs(nu, t, **parameters)Spectral luminosity, taking and returning plain cgs numbers.
eval_from_arrays(nu, t, *parameters)Positional-argument form of
eval().eval_log(nu, t, **parameters)Natural log of the spectral luminosity, given physical-unit inputs.
eval_log_cgs(nu, t, **parameters)Natural log of the spectral luminosity, taking and returning plain cgs numbers.
eval_spectrum(nu, t, **parameters)Evaluate the normalized spectral shape at the given frequency and time.
eval_spectrum_cgs(nu, t, **parameters)Return the normalized spectral shape as plain cgs numbers; see
eval_log_cgs().eval_spectrum_log(nu, t, **parameters)Natural log of the normalized spectral shape, given physical-unit inputs.
eval_spectrum_log_cgs(nu, t, **parameters)Natural log of the normalized spectral shape, taking and returning plain cgs numbers.
flux(nu, t, *[, redshift, ...])Evaluate the observed flux density at the given frequency and time.
flux_band(nu, throughput, t, *[, redshift, ...])Evaluate the throughput-weighted mean observed flux density over a band.
flux_band_cgs(nu, throughput, t, redshift, ...)Band-averaged observed flux density as plain cgs numbers; see
flux_band_log_cgs().flux_band_log(nu, throughput, t, *[, ...])Natural log of the band-averaged observed flux density, given physical-unit inputs.
flux_band_log_cgs(nu, throughput, t, ...[, ...])Natural log of the throughput-weighted mean flux density over a band, plain cgs numbers.
flux_bolometric(t, *[, redshift, ...])Evaluate the observed bolometric flux at the given time.
flux_bolometric_cgs(t, redshift, ...)Observed bolometric flux, taking and returning plain cgs numbers.
flux_bolometric_log(t, *[, redshift, ...])Natural log of the observed bolometric flux, given physical-unit inputs.
flux_bolometric_log_cgs(t, redshift, ...)Natural log of the observed bolometric flux, taking and returning plain cgs numbers.
flux_cgs(nu, t, redshift, luminosity_distance, *)Observed flux density, taking and returning plain cgs numbers.
flux_log(nu, t, *[, redshift, ...])Natural log of the observed flux density, given physical-unit inputs.
flux_log_cgs(nu, t, redshift, ...[, ...])Natural log of the observed flux density, taking and returning plain cgs numbers.
get(k[,d])items()keys()mag(nu, t, *[, redshift, ...])Evaluate the apparent AB magnitude at the given frequency and time.
mag_band(nu, throughput, t, *[, redshift, ...])Evaluate the apparent AB magnitude of the band-averaged flux density.
mag_band_cgs(nu, throughput, t, redshift, ...)Apparent AB magnitude of the band-averaged flux density.
mag_bandpass(bandpass, t, *[, redshift, ...])Evaluate the apparent AB magnitude of the flux averaged over bandpass.
mag_cgs(nu, t, redshift, luminosity_distance, *)Apparent AB magnitude: \(m_\mathrm{AB} = -2.5 \log_{10}(F_\nu / F_{\mathrm{AB},0})\).
pack_params_to_arrays(**parameters)Convert a dict of parameter values into an ordered sequence.
sample_parameters([size, rng, parameters])Draw random samples of some or all of this model's parameters.
simulate(nu, t[, size, rng])Draw random parameter realizations and evaluate the model at the given frequency and time.
simulate_photometry(t, exptime, detector, ...)Simulate noisy synthetic photometry of this model at given time(s), against a real detector.
unpack_params_from_arrays(*parameters)Convert an ordered sequence of parameter values back into a dict.
values()