uvex_transients.models.core.base.ComposedSpectralModel.as_source_spectrum#
- classmethod ComposedSpectralModel.as_source_spectrum(t: PhysicalInput, *, redshift: PhysicalInput | None = None, luminosity_distance: Quantity | None = None, angular_diameter_distance: Quantity | None = None, proper_distance: Quantity | None = None, cosmology: FLRW | None = None, ebv: float | Quantity | FloatArray | None = None, dust_law: str | None = None, exposure: Quantity | None = None, **parameters: ParameterValue) SourceSpectrum#
Build a
SourceSpectrumgiving the observed flux at one fixed time \(t\).With exposure it is instead the flux averaged over an exposure that starts at \(t\).
A thin wrapper around
as_astropy_model(): fixest(so the result is a function of wavelength alone, the shapesynphotrequires), and fixesx_type/y_type/y_kindto wavelength-in/photon-out, in Angstrom – becauseSourceSpectrumalways samples its wrapped model in wavelength space, and always treats the model’s raw return value as already being expressed insynphot’s internalPHOTLAM(photon-count flux density per unit wavelength, not the energy-flux \(F_\lambda\) one might expect) –__call__()does not consult a wrapped model’s declared output units to convert.Requires an observed (diluted) flux – at least one of
redshift/the distance keywords – since aSourceSpectrumis meant to be a real per-area flux forDetectorto consume, not a rest-frame luminosity.Foreground (e.g. Milky Way) dust attenuation is optional: pass an already-resolved
ebv(seeresolve_ebv()for turning a dust map and sky position into one, as a separate prior step) and it’s folded into the native photon flux for you, inside this method’s own evaluation kernel, before the result is wrapped as aSourceSpectrum– applied here rather than throughsynphot’s own spectrum-composition operators (spectrum * extinction), and resolved tolog_attenuation()’s callable form (viaattenuation_callable()) internally, right here, rather than something a caller ever has to build. Doing it here rather than by composing twoModelinstances is what letsebvstay vector-valued (e.g. one row per event) without resurrectingsynphot’sn_models=1restriction, exactly like every other parameter here (seemodel_class_from_kernel()) – the attenuation is just one more array multiplied in via plain NumPy broadcasting, not a second composed model.- Parameters:
t (
array-likeorQuantity) – Observed time since explosion, either aQuantitywith time units or an already unit-stripped cgs (seconds) value. May carry leading batch axes, broadcastable againstparameters.redshift (
array-likeorQuantity, optional) – Exactly one ofredshiftor the three distance keywords must be given; the rest are derived from it usingcosmology. Seeas_astropy_model().luminosity_distance (
Quantity, optional) – Seeredshiftabove.angular_diameter_distance (
Quantity, optional) – Seeredshiftabove.proper_distance (
Quantity, optional) – Seeredshiftabove.cosmology (
FLRW, optional) – Seeredshiftabove.ebv (
float,Quantity, orarray-like, optional) – Already-resolved, dimensionless E(B-V) (seeresolve_ebv()).None(the default) applies no dust attenuation.dust_law (
str, optional) – Passed through toget_dust_law(); the configured default (config["physics.default_dust_law"]) is almost always the right choice.exposure (
Quantity, optional) – Length of an exposure that starts att, scalar or broadcastable againstt. If given, the spectrum is the mean flux density over the exposure, \(E^{-1}\int_t^{t+E} F\,dt'\), where the source is taken to be off before the explosion (\(t'<0\)) so that an exposure that starts before it is diluted by the part with no source. This is what a detector that counts photons over the exposure measures, and differs from the flux attwhen the source changes appreciably during the exposure. The integral is the quadrature of ~uvex_transients.models._utils.exposure_average_nodes, which evaluates the model that many times.None(the default) gives the flux att.**parameters – This model’s parameter values, either
Quantityor already unit-stripped cgs values (seeeval_log_cgs()). May carry leading batch axes.
- Returns:
Callable as
spectrum(wave), returning the observed flux density att, or its mean over the exposure.- Return type:
SourceSpectrum- Raises:
ValueError – If none of
redshift/luminosity_distance/angular_diameter_distance/proper_distanceis given.