lightcurvelynx.utils.extrapolate
Functions for extrapolating flux past the end of a model’s range of valid phases or wavelengths using flux = f(time, wavelengths).
Classes
The base class for the flux extrapolation methods. |
|
Extrapolate by zero padding the results. |
|
Extrapolate using a constant value in nJy. |
|
Extrapolate using the last valid value along the desired axis. |
|
Linear decay of the flux using the last valid point(s) down to zero. |
|
Linear decay of the converted magnitude using the last valid point(s) with a fixed decay |
|
Exponential decay of the flux using the last valid point(s) down to zero. |
|
Linear extrapolation based on a linear fit to the last few points. |
|
Linear extrapolation based on a linear fit to the coverted magnitude of the last few points. |
Module Contents
- class FluxExtrapolationModel[source]
Bases:
abc.ABCThe base class for the flux extrapolation methods.
- extrapolate_time(last_times, last_fluxes, query_times)[source]
Extrapolate along the time axis.
- Parameters:
last_times (float or np.ndarray) – A length T1 array of the last valid times (in days) at which the fluxes were predicted.
last_fluxes (numpy.ndarray) – A length T1 x W array of the last valid flux values at each wavelength at the last valid times (in nJy).
query_times (numpy.ndarray) – A length T2 array of the query times (in days) at which to extrapolate.
- Returns:
flux – A T2 x W matrix of extrapolated values.
- Return type:
numpy.ndarray
- extrapolate_wavelength(last_waves, last_fluxes, query_waves)[source]
Extrapolate along the wavelength axis.
- Parameters:
last_waves (float or np.ndarray) – A length W1 array of the last valid wavelengths (in AA) at which the fluxes were predicted.
last_fluxes (numpy.ndarray) – A length T x W1 array of the last valid flux values at each time at the last valid wavelength (in nJy).
query_waves (numpy.ndarray) – A length W2 array of the query wavelengths (in AA) at which to extrapolate.
- Returns:
flux – A T x W2 matrix of extrapolated values.
- Return type:
numpy.ndarray
- class ZeroPadding[source]
Bases:
FluxExtrapolationModelExtrapolate by zero padding the results.
- class ConstantPadding(value=0.0)[source]
Bases:
FluxExtrapolationModelExtrapolate using a constant value in nJy.
- class LastValue[source]
Bases:
FluxExtrapolationModelExtrapolate using the last valid value along the desired axis.
- class LinearDecay(decay_width=100.0)[source]
Bases:
FluxExtrapolationModelLinear decay of the flux using the last valid point(s) down to zero.
- class LinearDecayOnMag(decay_rate=0.02, mag_thres=40.0)[source]
Bases:
FluxExtrapolationModelLinear decay of the converted magnitude using the last valid point(s) with a fixed decay rate down to a specific magnitude threshold. This is generally used for extrapolating in the time axis.
- decay_rate[source]
The rate of the decay region in days. The magnitude is linearly decreased to the mag_thres over this range.
- Type:
float or np.ndarray
- class ExponentialDecay(rate)[source]
Bases:
FluxExtrapolationModelExponential decay of the flux using the last valid point(s) down to zero.
f(t, λ) = f(t, λ_last) * exp(- rate * |λ - λ_last|)
- class LinearFit(nfit=5, nbin=None)[source]
Bases:
FluxExtrapolationModelLinear extrapolation based on a linear fit to the last few points.
- Parameters:
nfit (int) – The number of points to be used for extrapolation. (Default is 5)
nbin (int) – The number of bins to be used to bin the last fluxes. This can be used to avoid extrapolating to extreme values when models are not well-behaved in smaller bins.
- class LinearFitOnMag(nfit=5, nbin=None)[source]
Bases:
FluxExtrapolationModelLinear extrapolation based on a linear fit to the coverted magnitude of the last few points.
- Parameters:
nfit (int) – The number of points to be used for extrapolation. (Default is 5)
nbin (int) – The number of bins to be used to bin the last fluxes. This can be used to avoid extrapolating to extreme values when models are not well-behaved in smaller bins.