Skip to content

Parametric fit features

light_curve.BazinFit

Bases: _FeatureEvaluator

Bazin function fit

Five fit parameters and goodness of fit (reduced \(\chi^2\)) of the Bazin function developed for core-collapsed supernovae:

\[ f(t) = A \frac{ \mathrm{e}^{ -(t-t_0)/\tau_\mathrm{fall} } }{ 1 + \mathrm{e}^{ -(t - t_0) / \tau_\mathrm{rise} } } + B. \]

Note, that the Bazin function is developed to be used with fluxes, not magnitudes. Also note a typo in the Eq. (1) of the original paper, the minus sign is missed in the "rise" exponent.

  • Depends on: time, magnitude, magnitude error
  • Minimum number of observations: 6
  • Number of features: 6

Bazin et al. 2009 DOI:10.1051/0004-6361/200911847 Names and description of the output features: - bazin_fit_amplitude: half amplitude of the Bazin function (A) - bazin_fit_baseline: baseline of the Bazin function (B) - bazin_fit_reference_time: reference time of the Bazin fit (t0) - bazin_fit_rise_time: rise time of the Bazin function (tau_rise) - bazin_fit_fall_time: fall time of the Bazin function (tau_fall) - bazin_fit_reduced_chi2: Bazin fit quality (reduced chi2)

Parameters:

Name Type Description Default
algorithm str

Non-linear least-square algorithm, supported values are: mcmc, ceres, mcmc-ceres, lmsder, mcmc-lmsder, nuts, nuts-ceres, nuts-lmsder.

required
mcmc_niter int

Number of MCMC iterations

128
ceres_niter int

Number of Ceres iterations

10
ceres_loss_reg float or None

Ceres loss regularization. If set to a number, the loss function is regularized to discriminate outlier residuals larger than this value. None means no regularization.

None
lmsder_niter int

Number of LMSDER iterations

10
init list or None

Initial conditions, must be None or a list of floats or Nones. The length of the list must be 5; None values will be replaced with some default values. Supported by MCMC only.

None
bounds list of tuples or None

Boundary conditions, must be None or a list of tuples of floats or Nones. The length of the list must be 5; boundary conditions must include initial conditions; None values will be replaced with some broad defaults. Supported by MCMC only.

None
ln_prior str or list of ln_prior.LnPrior1D or None

Prior for MCMC, None means no prior. Specified by a string literal or a list of 5 ln_prior.LnPrior1D objects; see the ln_prior submodule for corresponding functions. Available string literals are: 'no': no prior

None
transform bool or None

If False or None output is not transformed. If True output is transformed as follows:

  • Half-amplitude A is transformed as zp - 2.5 lg(2*A), zp = 8.9, so that the amplitude is assumed to be the object peak flux in Jy.
  • Baseline flux is normalised by A: baseline → baseline / A
  • Reference time is removed
  • Goodness of fit is transformed as ln(reduced chi^2 + 1) to reduce its spread
  • Other parameters are not transformed

See names and descriptions attributes for the list and order of features.

None
bands list of str or None

Passband names for multiband mode. If provided, the feature is evaluated independently per passband and the outputs are concatenated in passband order. If None (default), single-band mode is used.

required

Attributes:

Name Type Description
names list of str

Feature names

descriptions list of str

Feature descriptions

bands numpy.ndarray of str or None

Passband names for multiband mode, or None for single-band mode

supported_algorithms list of str

Available argument values for the constructor

Methods:

Name Description
__call__

Extract features and return them as a numpy array

many

Extract features from multiple light curves in parallel

model

Underlying parametric model function

Parameters

t : np.ndarray of float32 or float64
Time moments, can be unsorted
params : np.ndarray of float32 or float64
Parameters of the model, this array can be longer than actual parameter list, the beginning part of the array will be used in this case, see Examples section in the class documentation.
cast : bool, optional
Cast inputs to np.ndarray of the same dtype

Returns

np.ndarray of float32 or float64
Array of model values corresponded to the given time moments

Examples:

>>> import numpy as np
>>> from light_curve import BazinFit
>>>
>>> fit = BazinFit('mcmc')
>>> t = np.linspace(0, 10, 101)
>>> flux = 1 + (t - 3) ** 2
>>> fluxerr = np.sqrt(flux)
>>> result = fit(t, flux, fluxerr, sorted=True)
>>> # Result is built from a model parameters and reduced chi^2
>>> # So we can use as a `params` array of the static `.model()` method
>>> model = BazinFit.model(t, result)

light_curve.LinexpFit

Bases: _FeatureEvaluator

Linexp function fit

Four fit parameters and goodness of fit (reduced \(\chi^2\)) of the Linexp function developed for core-collapsed supernovae:

\[ f(t) = A \frac{(t-t_0)}{\tau} \times \exp{\left(\frac{(t-t_0)}{\tau}\right)} + B. \]

Note, that the Linexp function is developed to be used with fluxes, not magnitudes.

  • Depends on: time, flux, flux error
  • Minimum number of observations: 5
  • Number of features: 5

Names and description of the output features: - linexp_fit_amplitude: Amplitude of the Linexp function (A) - linexp_fit_reference_time: reference time of the Linexp fit (t0) - linexp_fit_fall_time: fall time of the Linexp function (tau) - linexp_fit_baseline: baseline of the Linexp function (B) - linexp_fit_reduced_chi2: Linexp fit quality (reduced chi2)

Parameters:

Name Type Description Default
algorithm str

Non-linear least-square algorithm, supported values are: mcmc, ceres, mcmc-ceres, lmsder, mcmc-lmsder, nuts, nuts-ceres, nuts-lmsder.

required
mcmc_niter int

Number of MCMC iterations

128
ceres_niter int

Number of Ceres iterations

10
ceres_loss_reg float or None

Ceres loss regularization. If set to a number, the loss function is regularized to discriminate outlier residuals larger than this value. None means no regularization.

None
lmsder_niter int

Number of LMSDER iterations

10
init list or None

Initial conditions, must be None or a list of floats or Nones. The length of the list must be 4; None values will be replaced with some default values. Supported by MCMC only.

None
bounds list of tuples or None

Boundary conditions, must be None or a list of tuples of floats or Nones. The length of the list must be 4; boundary conditions must include initial conditions; None values will be replaced with some broad defaults. Supported by MCMC only.

None
ln_prior str or list of ln_prior.LnPrior1D or None

Prior for MCMC, None means no prior. Specified by a string literal or a list of 4 ln_prior.LnPrior1D objects; see the ln_prior submodule for corresponding functions. Available string literals are: 'no': no prior

None
transform bool or None

If False or None output is not transformed. If True output is transformed as follows:

  • Half-amplitude A is transformed as zp - 2.5 lg(2*A), zp = 8.9, so that the amplitude is assumed to be the object peak flux in Jy.
  • Baseline flux is normalised by A: baseline → baseline / A
  • Reference time is removed
  • Goodness of fit is transformed as ln(reduced chi^2 + 1) to reduce its spread
  • Other parameters are not transformed

See names and descriptions attributes for the list and order of features.

None
bands list of str or None

Passband names for multiband mode. If provided, the feature is evaluated independently per passband and the outputs are concatenated in passband order. If None (default), single-band mode is used.

required

Attributes:

Name Type Description
names list of str

Feature names

descriptions list of str

Feature descriptions

bands numpy.ndarray of str or None

Passband names for multiband mode, or None for single-band mode

supported_algorithms list of str

Available argument values for the constructor

Methods:

Name Description
__call__

Extract features and return them as a numpy array

many

Extract features from multiple light curves in parallel

model

Underlying parametric model function

Parameters

t : np.ndarray of float32 or float64
Time moments, can be unsorted
params : np.ndarray of float32 or float64
Parameters of the model, this array can be longer than actual parameter list, the beginning part of the array will be used in this case, see Examples section in the class documentation.
cast : bool, optional
Cast inputs to np.ndarray of the same dtype

Returns

np.ndarray of float32 or float64
Array of model values corresponded to the given time moments

Examples:

>>> import numpy as np
>>> from light_curve import LinexpFit
>>>
>>> fit = LinexpFit('mcmc')
>>> t = np.linspace(0, 10, 101)
>>> flux = 1 + (t - 3) ** 2
>>> fluxerr = np.sqrt(flux)
>>> result = fit(t, flux, fluxerr, sorted=True)
>>> # Result is built from a model parameters and reduced chi^2
>>> # So we can use as a `params` array of the static `.model()` method
>>> model = LinexpFit.model(t, result)

light_curve.VillarFit

Bases: _FeatureEvaluator

Villar function fit

Seven fit parameters and goodness of fit (reduced \(\chi^2\)) of the Villar function developed for supernovae classification:

\[ f(t) = c + \frac{A}{ 1 + \exp{\frac{-(t - t_0)}{\tau_\mathrm{rise}}}} \left\{ \begin{array}{ll} 1 - \frac{\nu (t - t_0)}{\gamma}, &t < t_0 + \gamma \\ (1 - \nu) \exp{\frac{-(t-t_0-\gamma)}{\tau_\mathrm{fall}}}, &t \geq t_0 + \gamma \end{array} \right. \]

where \(A, \gamma, \tau_\mathrm{rise}, \tau_\mathrm{fall} > 0\), \(\nu \in [0; 1)\).

Here we introduce a new dimensionless parameter \(\nu\) instead of the plateau slope \(\beta\) from the orioginal paper: \(\nu \equiv -\beta \gamma / A\).

Note, that the Villar function is developed to be used with fluxes, not magnitudes.

  • Depends on: time, magnitude, magnitude error
  • Minimum number of observations: 8
  • Number of features: 8

Villar et al. 2019 DOI:10.3847/1538-4357/ab418c Names and description of the output features: - villar_fit_amplitude: half amplitude of the Villar function (A) - villar_fit_baseline: baseline of the Villar function (c) - villar_fit_reference_time: reference time of the Villar function (t_0) - villar_fit_rise_time: rise time of the Villar function (tau_rise) - villar_fit_fall_time: decline time of the Villar function (tau_fall) - villar_fit_plateau_rel_amplitude: relative plateau amplitude of the Villar function (nu = beta gamma / A) - villar_fit_plateau_duration: plateau duration of the Villar function (gamma) - villar_fit_reduced_chi2: Villar fit quality (reduced chi2)

Parameters:

Name Type Description Default
algorithm str

Non-linear least-square algorithm, supported values are: mcmc, ceres, mcmc-ceres, lmsder, mcmc-lmsder, nuts, nuts-ceres, nuts-lmsder.

required
mcmc_niter int

Number of MCMC iterations

128
ceres_niter int

Number of Ceres iterations

10
ceres_loss_reg float or None

Ceres loss regularization. If set to a number, the loss function is regularized to discriminate outlier residuals larger than this value. None means no regularization.

None
lmsder_niter int

Number of LMSDER iterations

10
init list or None

Initial conditions, must be None or a list of floats or Nones. The length of the list must be 7; None values will be replaced with some default values. Supported by MCMC only.

None
bounds list of tuples or None

Boundary conditions, must be None or a list of tuples of floats or Nones. The length of the list must be 7; boundary conditions must include initial conditions; None values will be replaced with some broad defaults. Supported by MCMC only.

None
ln_prior str or list of ln_prior.LnPrior1D or None

Prior for MCMC, None means no prior. Specified by a string literal or a list of 7 ln_prior.LnPrior1D objects; see the ln_prior submodule for corresponding functions. Available string literals are: - 'no': no prior,\ - 'hosseinzadeh2020': prior addopted from Hosseinzadeh et al. 2020, it assumes that t is in days

None
transform bool or None

If False or None output is not transformed. If True output is transformed as follows:

  • Half-amplitude A is transformed as zp - 2.5 lg(2*A), zp = 8.9, so that the amplitude is assumed to be the object peak flux in Jy.
  • Baseline flux is normalised by A: baseline → baseline / A
  • Reference time is removed
  • Goodness of fit is transformed as ln(reduced chi^2 + 1) to reduce its spread
  • Other parameters are not transformed

See names and descriptions attributes for the list and order of features.

None
bands list of str or None

Passband names for multiband mode. If provided, the feature is evaluated independently per passband and the outputs are concatenated in passband order. If None (default), single-band mode is used.

required

Attributes:

Name Type Description
names list of str

Feature names

descriptions list of str

Feature descriptions

bands numpy.ndarray of str or None

Passband names for multiband mode, or None for single-band mode

supported_algorithms list of str

Available argument values for the constructor

Methods:

Name Description
__call__

Extract features and return them as a numpy array

many

Extract features from multiple light curves in parallel

model

Underlying parametric model function

Parameters

t : np.ndarray of float32 or float64
Time moments, can be unsorted
params : np.ndarray of float32 or float64
Parameters of the model, this array can be longer than actual parameter list, the beginning part of the array will be used in this case, see Examples section in the class documentation.
cast : bool, optional
Cast inputs to np.ndarray of the same dtype

Returns

np.ndarray of float32 or float64
Array of model values corresponded to the given time moments

Examples:

>>> import numpy as np
>>> from light_curve import VillarFit
>>>
>>> fit = VillarFit('mcmc')
>>> t = np.linspace(0, 10, 101)
>>> flux = 1 + (t - 3) ** 2
>>> fluxerr = np.sqrt(flux)
>>> result = fit(t, flux, fluxerr, sorted=True)
>>> # Result is built from a model parameters and reduced chi^2
>>> # So we can use as a `params` array of the static `.model()` method
>>> model = VillarFit.model(t, result)