GP Class Family

class model.Celerite_GP_Model(pspl_model, filter_index)

Bases: Model

This is nedeed for the GP. Just a wrapper over our model so it is a celerite model.

Attributes:
full_size

The total number of parameters (including frozen parameters)

parameter_vector

An array of all parameters (including frozen parameters)

vector_size

The number of active (or unfrozen) parameters

Methods

compute_gradient(*args, **kwargs)

Compute the "gradient" of the model for the current parameters

freeze_all_parameters()

Freeze all parameters of the model

freeze_parameter(name)

Freeze a parameter by name

get_parameter(name)

Get a parameter value by name

get_parameter_bounds([include_frozen])

Get a list of the parameter bounds

get_parameter_dict([include_frozen])

Get an ordered dictionary of the parameters

get_parameter_names([include_frozen])

Get a list of the parameter names

get_parameter_vector([include_frozen])

Get an array of the parameter values in the correct order

get_value(t)

Compute the "value" of the model for the current parameters

log_prior()

Compute the log prior probability of the current parameters

set_parameter(name, value)

Set a parameter value by name

set_parameter_vector(vector[, include_frozen])

Set the parameter values to the given vector

thaw_all_parameters()

Thaw all parameters of the model

thaw_parameter(name)

Thaw a parameter by name

get_gradient

compute_gradient(*args, **kwargs)

Compute the “gradient” of the model for the current parameters

This method should be overloaded by subclasses to implement the actual functionality of the model. The output of this function should be an array where the first dimension is full_size.

freeze_all_parameters()

Freeze all parameters of the model

freeze_parameter(name)

Freeze a parameter by name

Args:

name: The name of the parameter

get_parameter(name)

Get a parameter value by name

Args:

name: The name of the parameter

get_parameter_bounds(include_frozen=False)

Get a list of the parameter bounds

Args:
include_frozen (Optional[bool]): Should the frozen parameters be

included in the returned value? (default: False)

get_parameter_dict(include_frozen=False)

Get an ordered dictionary of the parameters

Args:
include_frozen (Optional[bool]): Should the frozen parameters be

included in the returned value? (default: False)

get_parameter_names(include_frozen=False)

Get a list of the parameter names

Args:
include_frozen (Optional[bool]): Should the frozen parameters be

included in the returned value? (default: False)

get_parameter_vector(include_frozen=False)

Get an array of the parameter values in the correct order

Args:
include_frozen (Optional[bool]): Should the frozen parameters be

included in the returned value? (default: False)

get_value(t)

Compute the “value” of the model for the current parameters

This method should be overloaded by subclasses to implement the actual functionality of the model.

log_prior()

Compute the log prior probability of the current parameters

set_parameter(name, value)

Set a parameter value by name

Args:

name: The name of the parameter value (float): The new value for the parameter

set_parameter_vector(vector, include_frozen=False)

Set the parameter values to the given vector

Args:
vector (array[vector_size] or array[full_size]): The target

parameter vector. This must be in the same order as parameter_names and it should only include frozen parameters if include_frozen is True.

include_frozen (Optional[bool]): Should the frozen parameters be

included in the returned value? (default: False)

thaw_all_parameters()

Thaw all parameters of the model

thaw_parameter(name)

Thaw a parameter by name

Args:

name: The name of the parameter

property full_size

The total number of parameters (including frozen parameters)

property parameter_vector

An array of all parameters (including frozen parameters)

property vector_size

The number of active (or unfrozen) parameters

class model.PSPL_GP

Bases: ABC

PSPL object that has optional support for Gaussian Process (GP) on each photometric filter.

The GP for this object uses a summation of the matern-3/2, DDSHO, and (fixed) jitter terms as its kernel/covariance function.

Note

Including a jitter term will inflate the white noise component of the GP model.

Methods

get_celerite_gp_object(mag_err_obs[, filt_idx])

Returns a celerite GP object that is used for all GP operations

get_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

log_likely_photometry(t, mag_obs, mag_err_obs)

For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.

get_celerite_gp_object(mag_err_obs, filt_idx=0)

Returns a celerite GP object that is used for all GP operations

Parameters:
mag_err_obsarray_like

List of observed photometric uncertainties of the microlensing event in magnitudes. The mean of mag_err_obs is inputted into the jitter term of the kernel if ‘gp_log_jit_sigma’ is not a parameter.

filt_idxinteger

An integer indicating which photometric data set should be used for the GP.

This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.

Returns:
gpa celerite GP object
get_log_det_covariance(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)

Returns photometry with GP noise added in.

Note

This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.

get_photometry_with_gp(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)

Returns photometry with GP noise added in.

Note

This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.

Parameters:
tarray_like

List of times in MJD for the observations. These times are used as input to the GP. If t_pred is not specified, then t_pred = t.

mag_obsarray_like

List of observed photometric measurements of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.

mag_err_obsarray_like

List of observed photometric uncertainties of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.

filt_idxint, optional

Index of the photometric filter or data set.

t_predarray_like, optional

List of times in MJD on which to evalute the model. If t_pred is not specified, then t_pred = t.

Returns:
mag_modelarray_like

Magnitude of the unresolved microlensing event at t. This is the “predictive mean” of the GP.

mag_model_stdarray_like

Standard deviation of the magnitude of the unresolved microlensing event at t. This comes from the diagonal (the varainces) of the “predictive covariance” of the GP.

log_likely_photometry(t, mag_obs, mag_err_obs, filt_idx=0)

For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set. Note, this function returns the full ln(likelihood), including the normalization constant.

Parameters:
tarray_like

List of times in MJD for the observations.

mag_obsarray_like

List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.

mag_err_obsarray_like

List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
ln_Lfloat

ln(likelihood) summed over the photometric measurement

Note

The GP will only be used for filters where use_gp_phot[filt_idx] = True.