lightcurvelynx.models.salt2_jax

Classes

SALT2JaxModel

A SALT2 model implemented with JAX for it can use auto-differentiation.

Module Contents

class SALT2JaxModel(x0=None, x1=None, c=None, model_dir='', m0_filename='salt2_template_0.dat', m1_filename='salt2_template_1.dat', cl_filename='salt2_color_correction.dat', **kwargs)[source]

Bases: lightcurvelynx.models.physical_model.SEDModel, citation_compass.CiteClass

A SALT2 model implemented with JAX for it can use auto-differentiation.

The model is defined in (Guy J., 2007) as:

flux(time, wave) = x0 * [M0(time, wave) + x1 * M1(time, wave)] * exp(c * CL(wave))

where x0, x1, and c are given parameters, M0 is the average spectral sequence, M1 is the first compoment to describe variability, and CL is the average color correction law.

We use the formulation in sncosmo where CL is defined such that:

flux(time, wave) = x0 * [M0(time, wave) + x1 * M1(time, wave)] * 10 ** (-0.4 * c * CL(wave))

This class is based on the sncosmo implementation at: https://github.com/sncosmo/sncosmo/blob/v2.10.1/sncosmo/models.py The wrapped sncosmo version in sncosmo_models.py is faster and should be used when auto-differentiation is not needed.

Parameterized values include:

  • c - The SALT2 c parameter.

  • dec - The object’s declination in degrees. [from BasePhysicalModel]

  • distance - The object’s luminosity distance in pc. [from BasePhysicalModel]

  • period - The period of the source, in days.

  • 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]

  • x0 - The SALT2 x0 parameter.

  • x1 - The SALT2 x1 parameter.

References

_m0_model[source]

The interpolator for the m0 parameter.

Type:

BicubicInterpolator

_m1_model[source]

The interpolator for the m1 parameter.

Type:

BicubicInterpolator

_colorlaw[source]

The data to apply the color law.

Type:

SALT2ColorLaw

Parameters:
  • x0 (parameter) – The SALT2 x0 parameter.

  • x1 (parameter) – The SALT2 x1 parameter.

  • c (parameter) – The SALT2 c parameter.

  • model_dir (str) – The path for the model file directory. Default: “”

  • m0_filename (str) – The file name for the m0 model component. Default: “salt2_template_0.dat”

  • m1_filename (str) – The file name for the m1 model component. Default: “salt2_template_1.dat”

  • cl_filename (str) – The file name of the color law correction coefficients. Default: “salt2_color_correction.dat”,

  • **kwargs (dict, optional) – Any additional keyword arguments.

minphase(**kwargs)[source]

Get the minimum supported rest-frame phase of the model in days.

Parameters:

**kwargs (dict) – Additional keyword arguments, not used in this method.

Returns:

minphase – The minimum phase of the model (in days) or None if the model does not have a defined minimum phase.

Return type:

float or None

maxphase(**kwargs)[source]

Get the minimum supported rest-frame phase of the model in days.

Parameters:

**kwargs (dict) – Additional keyword arguments, not used in this method.

Returns:

minphase – The minimum phase of the model (in days) or None if the model does not have a defined minimum phase.

Return type:

float or None

compute_sed(times, wavelengths, graph_state, **kwargs)[source]

Draw effect-free observations for this object.

Parameters:
  • times (numpy.ndarray) – A length T array of rest frame timestamps.

  • wavelengths (numpy.ndarray, optional) – A length N array of wavelengths (in angstroms).

  • graph_state (GraphState) – An object mapping graph parameters to their values.

  • **kwargs (dict, optional) – Any additional keyword arguments.

Returns:

flux_density – A length T x N matrix of SED values (in nJy).

Return type:

numpy.ndarray