lightcurvelynx.models.static_sed_model
Models that generate a constant SED or bandflux at all times.
Classes
A StaticSEDModel randomly selects an SED at each evaluation and computes |
|
A StaticBandfluxModel randomly selects a mapping of bandfluxes at each evaluation |
Module Contents
- class StaticSEDModel(sed_values, weights=None, **kwargs)[source]
Bases:
lightcurvelynx.models.physical_model.SEDModelA StaticSEDModel randomly selects an SED at each evaluation and computes the flux from that SED at all time steps.
Parameterized values include:
dec - The object’s declination in degrees. [from BasePhysicalModel]
distance - The object’s luminosity distance in pc. [from BasePhysicalModel]
ra - The object’s right ascension in degrees. [from BasePhysicalModel]
redshift - The object’s redshift. [from BasePhysicalModel]
t0 - The t0 of the zero phase, date. [from BasePhysicalModel. Not used.]
- sed_values
A list of SEDs from which to sample. Each SED is represented as a two row numpy-array where the first row is wavelength and the second is flux value, or as an instance of the SED class.
- Type:
list of numpy.ndarray or SED
- Parameters:
sed_values (list of SED objects) – A single SED or a list of SEDs from which to sample.
weights (numpy.ndarray, optional) – A length N array indicating the relative weight from which to select an SED at random. If None, all SEDs will be weighted equally.
- classmethod from_file(sed_file, **kwargs)[source]
Load a static SED from a file containing a two column array where the first column is wavelength (in angstroms) and the second column is flux (in nJy).
- Parameters:
sed_file (str or Path) – The path to the SED file to load.
**kwargs (dict) – Additional keyword arguments to pass to the StaticSEDModel constructor.
- Returns:
An instance of StaticSEDModel with the loaded SED data.
- Return type:
- classmethod from_synphot(sp_model, waves=None, **kwargs)[source]
Generate the spectrum from a given synphot model.
References
synphot (ascl:1811.001)
- Parameters:
sp_model (synphot.SourceSpectrum) – The synphot model to generate the spectrum from.
waves (numpy.ndarray, optional) – A length N array of wavelengths (in angstroms) at which to sample the SED. If None, the SED will be sampled at the wavelengths defined in the synphot model.
**kwargs (dict) – Additional keyword arguments to pass to the StaticSEDModel constructor.
- Returns:
An instance of StaticSEDModel with the generated SED data.
- Return type:
- minwave(graph_state=None)[source]
Get the minimum wavelength of the model.
- Parameters:
graph_state (GraphState, optional) – An object mapping graph parameters to their values. Not used for this model.
- Returns:
minwave – The minimum wavelength of the model (in angstroms) or None if the model does not have a defined minimum wavelength.
- Return type:
float or None
- maxwave(graph_state=None)[source]
Get the maximum wavelength of the model.
- Parameters:
graph_state (GraphState, optional) – An object mapping graph parameters to their values. Not used for this model.
- Returns:
maxwave – The maximum wavelength of the model (in angstroms) or None if the model does not have a defined maximum wavelength.
- Return type:
float or None
- compute_sed(times, wavelengths, graph_state)[source]
Draw effect-free observer frame flux densities.
- Parameters:
times (numpy.ndarray) – A length T array of observer frame timestamps in MJD.
wavelengths (numpy.ndarray, optional) – A length N array of observer frame wavelengths (in angstroms).
graph_state (GraphState) – An object mapping graph parameters to their values.
- Returns:
flux_density – A length T x N matrix of observer frame SED values (in nJy).
- Return type:
numpy.ndarray
- class StaticBandfluxModel(bandflux_values, weights=None, **kwargs)[source]
Bases:
lightcurvelynx.models.physical_model.BandfluxModelA StaticBandfluxModel randomly selects a mapping of bandfluxes at each evaluation and uses that at all time steps.
Parameterized values include:
dec - The object’s declination in degrees. [from PhysicalModel]
distance - The object’s luminosity distance in pc. [from PhysicalModel]
ra - The object’s right ascension in degrees. [from PhysicalModel]
redshift - The object’s redshift. [from PhysicalModel]
t0 - The t0 of the zero phase, date. [from PhysicalModel. Not used.]
- bandflux_values
A list of bandflux mappings from which to sample. Each mapping is represented as a dictionary where the key is the filter name and the value is the bandflux (in nJy).
- Type:
list of dict
- Parameters:
bandflux_values (dict or list) – A single bandflux mapping or a list of bandflux mappings from which to sample. Each mapping is represented as a dictionary where the key is the filter name and the value is the bandflux (in nJy).
weights (numpy.ndarray, optional) – A length N array indicating the relative weight from which to select a model at random. If None, all models will be weighted equally.
- compute_bandflux(times, filter, state, rng_info=None)[source]
Evaluate the model at the passband level for a single, given graph state.
- Parameters:
times (numpy.ndarray) – A length T array of observer frame timestamps in MJD.
filter (str) – The name of the filter.
state (GraphState) – An object mapping graph parameters to their values with num_samples=1.
rng_info (numpy.random._generator.Generator, optional) – A given numpy random number generator to use for this computation. If not provided, the function uses the node’s random number generator.