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

FluxExtrapolationModel

The base class for the flux extrapolation methods.

ZeroPadding

Extrapolate by zero padding the results.

ConstantPadding

Extrapolate using a constant value in nJy.

LastValue

Extrapolate using the last valid value along the desired axis.

LinearDecay

Linear decay of the flux using the last valid point(s) down to zero.

LinearDecayOnMag

Linear decay of the converted magnitude using the last valid point(s) with a fixed decay

ExponentialDecay

Exponential decay of the flux using the last valid point(s) down to zero.

LinearFit

Linear extrapolation based on a linear fit to the last few points.

LinearFitOnMag

Linear extrapolation based on a linear fit to the coverted magnitude of the last few points.

Module Contents

class FluxExtrapolationModel[source]

Bases: abc.ABC

The base class for the flux extrapolation methods.

nfit[source]

The number of points to be used for extrapolation. (Default is 1)

Type:

int

nfit = 1[source]
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: FluxExtrapolationModel

Extrapolate by zero padding the results.

class ConstantPadding(value=0.0)[source]

Bases: FluxExtrapolationModel

Extrapolate using a constant value in nJy.

value[source]

The value (in nJy) to use for the extrapolation.

Type:

float

value = 0.0[source]
class LastValue[source]

Bases: FluxExtrapolationModel

Extrapolate using the last valid value along the desired axis.

class LinearDecay(decay_width=100.0)[source]

Bases: FluxExtrapolationModel

Linear decay of the flux using the last valid point(s) down to zero.

decay_width[source]

The width of the decay region in Angstroms. The flux is linearly decreased to zero over this range.

Type:

float or np.ndarray

decay_width = 100.0[source]
class LinearDecayOnMag(decay_rate=0.02, mag_thres=40.0)[source]

Bases: FluxExtrapolationModel

Linear 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

mag_thres[source]

The mag threshold for the linear decay extraplation. Fluxes are capped at this value for time/wavelength beyond this value.

Type:

float or np.ndarray

decay_rate = 0.02[source]
mag_thres = 40.0[source]
class ExponentialDecay(rate)[source]

Bases: FluxExtrapolationModel

Exponential decay of the flux using the last valid point(s) down to zero.

f(t, λ) = f(t, λ_last) * exp(- rate * |λ - λ_last|)

rate[source]

The decay rate in the exponential function.

Type:

float

rate[source]
class LinearFit(nfit=5, nbin=None)[source]

Bases: FluxExtrapolationModel

Linear 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.

nfit = 5[source]
nbin = None[source]
class LinearFitOnMag(nfit=5, nbin=None)[source]

Bases: FluxExtrapolationModel

Linear 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.

nfit = 5[source]
nbin = None[source]