Data Class Family

class model.PSPL

Bases: ABC

Methods

animate(tE, time_steps, frame_time, name, ...)

Produces animation of microlensing event.

get_amplification(t[, filt_idx])

Get an array of the total photometric amplifications at the input times.

get_astrometry(t[, filt_idx])

Get the astrometry of the unresolved (observed) position of the lensed source at the input times.

get_astrometry_unlensed(t[, filt_idx])

Get the unresolved astrometry of the combined source and lens if there was no gravitational lensing.

get_centroid_shift(t[, filt_idx])

Get the centroid shift (in mas) at the input times.

get_chi2_astrometry(t, x_obs, y_obs, ...[, ...])

Get the chi^2 value for this model given input astrometry data and uncertainties for the specified astrometric data set.

get_chi2_photometry(t, mag_obs, mag_err_obs)

Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.

get_lens_astrometry(t[, filt_idx])

Get the astrometry for the foreground lens at the input times.

get_lnL_constant(err_obs)

Get the natural log of the constant normalization terms of the likelihood.

get_photometry(t[, filt_idx])

Get the predicted photomety at the specified times for the specified photometric filter or data set.

get_resolved_amplification(t[, filt_idx])

Get the photometric amplification terms at a set of times, t for both the plus and minus images.

get_resolved_astrometry(t[, filt_idx])

Get the relative RA and Dec astrometry for each of the two source images, which we label plus and minus.

get_source_astrometry_unlensed(t[, filt_idx])

Get the astrometry of the source if the lens didn't exist.

get_u(t[, filt_idx])

Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.

log_likely_astrometry(t, x_obs, y_obs, ...)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.

log_likely_astrometry_each(t, x_obs, y_obs, ...)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.

log_likely_photometry(t, mag_obs, mag_err_obs)

Get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.

log_likely_photometry_each(t, mag_obs, ...)

Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.

animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)

Produces animation of microlensing event.

Parameters:
tE:
number of einstein crossings times before/after the peak you want the animation to plot

e.g tE = 2 => graph will go from -2 tE to 2 tE

time_steps:

number of time steps before/after peak, so total number of time steps will be 2 times this value

frame_time:

times in ms of each frame in the animation

name: string

the animation will be saved as name.html

size: list

[horizontal, vertical] cm’s

zoom:

# of einstein radii plotted in vertical direction

get_amplification(t, filt_idx=0)

Get an array of the total photometric amplifications at the input times.

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array, dtype=float, shape = [len(t)]

The total amplification (sum of +/- images)

get_astrometry(t, filt_idx=0)

Get the astrometry of the unresolved (observed) position of the lensed source at the input times. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroidnumpy array, dtype=float, shape = [len(t), 2]

The flux-weighted centroid of all lensed images from the source and any luminous lenses.

get_astrometry_unlensed(t, filt_idx=0)

Get the unresolved astrometry of the combined source and lens if there was no gravitational lensing. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_unlensednumpy array, dtype=float, shape = [len(t), 2]

The unlensed, flux-weighted centroid position of the source+lens in arcseconds.

get_centroid_shift(t, filt_idx=0)

Get the centroid shift (in mas) at the input times. The centroid shift is the difference between the lensed, unresolved position (with lensed source + lens light) and the unlensed, unresolved position (with unlensed source + lens light). The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the photometric filter or data set.

get_chi2_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the chi^2 value for this model given input astrometry data and uncertainties for the specified astrometric data set.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

The index of the astrometric filter or data set.

Returns:
chi2array_like

List of chi^2 values from the model and astrometric data.

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

Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.

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:
chi2array_like

List of chi^2 values from the model and photometric data.

get_lens_astrometry(t, filt_idx=0)

Get the astrometry for the foreground lens at the input times. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xLarray_like, dtype=float, shape = [len(t), 2]

Position of the lens on the sky (arcsec).

get_lnL_constant(err_obs)

Get the natural log of the constant normalization terms of the likelihood.

\[-0.5 * \ln{2 \pi \sigma_{obs}^2}\]
Parameters:
err_obsarray_like

List of the uncertainties.

Returns:
List of ln(likelihood constants).
get_photometry(t, filt_idx=0)

Get the predicted photomety at the specified times for the specified photometric filter or data set.

Parameters:
tarray_like

List of times in MJD for the observations.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
mag_modelarray_like

Magnitude of the unresolved microlensing event at t.

get_resolved_amplification(t, filt_idx=0)

Get the photometric amplification terms at a set of times, t for both the plus and minus images. The returned tuple has two entries: (A_plus, A_minus), each with len(t) arrays.

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array, dtype=float, shape = [len(t), [+/-]

The amplification for the + and - lensed images.

get_resolved_astrometry(t, filt_idx=0)

Get the relative RA and Dec astrometry for each of the two source images, which we label plus and minus. The returned tuple has two entries: (xS_plus, xS_minus), each with [len(t), 2] arrays where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
(xS_plus, xS_minus)tuple of numpy arrays
  • xS_plus is the vector position of the plus image in arcsec with shape = [len(t), 2]

  • xS_minus is the vector position of the plus image in arcsec with shape = [len(t), 2]

get_source_astrometry_unlensed(t, filt_idx=0)

Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_unlensednumpy array, dtype=float, shape = [len(t), 2]

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.

Parameters:
tarray_like

List of times in MJD for the observations.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
u_unlensednumpy array, dtype=float, shape = len(t) x 2

The unlensed positions of the source in Einstein radii.

log_likely_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
ln_Larray_like

List of ln(likelihood) for each astrometric measurement.

log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
ln_Larray_like

List of ln(likelihood) for each astrometric measurement.

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

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

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

Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is 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_Larray_like

List of ln(likelihood) for each photometric measurement.

class model.PSPL_Phot

Bases: PSPL

Contains methods for model a PSPL photometry only. This is a Data-type class in our hierarchy. It is abstract and should not be instantiated.

Attributes:
Available class variables that should be defined.
t0
tE
u0_amp
u0_E
u0_N
piE_E - valid only if parallax model
piE_N - valid only if parallax model
piE_amp
b_sff[#]
mag_src[#] – add in
mag_base[#] – add in
raL - if parallax model
decL - if parallax model

Methods

animate(tE, time_steps, frame_time, name, ...)

Produces animation of microlensing event.

get_amplification(t[, filt_idx])

Get an array of the total photometric amplifications at the input times.

get_astrometry(t[, filt_idx])

Position of the observed (unresolved) source position in Einstein radii.

get_astrometry_unlensed(t[, filt_idx])

Get the astrometry of the source+lens if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Get the centroid shift (in mas) at the input times.

get_chi2_astrometry(t, x_obs, y_obs, ...[, ...])

Get the chi^2 value for this model given input astrometry data and uncertainties for the specified astrometric data set.

get_chi2_photometry(t, mag_obs, mag_err_obs)

Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.

get_lens_astrometry(t[, filt_idx])

Get the lens astrometry.

get_lnL_constant(err_obs)

Get the natural log of the constant normalization terms of the likelihood.

get_photometry(t[, filt_idx])

Get the predicted photomety at the specified times for the specified photometric filter or data set.

get_resolved_amplification(t[, filt_idx])

Get the photometric amplification terms at a set of times, t for both the plus and minus images.

get_resolved_astrometry(t[, filt_idx])

Position of the observed source position in Einstein radii.

get_source_astrometry_unlensed(t[, filt_idx])

Get the unlensed astrometry of the source.

get_u(t[, filt_idx])

Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.

log_likely_astrometry(t, x, y, xerr, yerr[, ...])

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.

log_likely_astrometry_each(t, x_obs, y_obs, ...)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.

log_likely_photometry(t, mag_obs, mag_err_obs)

Get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.

log_likely_photometry_each(t, mag_obs, ...)

Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.

animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)

Produces animation of microlensing event.

Parameters:
tE:
number of einstein crossings times before/after the peak you want the animation to plot

e.g tE = 2 => graph will go from -2 tE to 2 tE

time_steps:

number of time steps before/after peak, so total number of time steps will be 2 times this value

frame_time:

times in ms of each frame in the animation

name: string

the animation will be saved as name.html

size: list

[horizontal, vertical] cm’s

zoom:

# of einstein radii plotted in vertical direction

get_amplification(t, filt_idx=0)

Get an array of the total photometric amplifications at the input times.

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array, dtype=float, shape = [len(t)]

The total amplification (sum of +/- images)

get_astrometry(t, filt_idx=0)

Position of the observed (unresolved) source position in Einstein radii.

Parameters:
t: array_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
model_posarray_like

Array of vector positions of the centroid at each t.

get_astrometry_unlensed(t, filt_idx=0)

Get the astrometry of the source+lens if the lens didn’t exist. Note, this is a photometry only model, so units are in Einstein radii.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2

The unlensed positions of the source in Einstein radii.

get_centroid_shift(t, filt_idx=0)

Get the centroid shift (in mas) at the input times. The centroid shift is the difference between the lensed, unresolved position (with lensed source + lens light) and the unlensed, unresolved position (with unlensed source + lens light). The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the photometric filter or data set.

get_chi2_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the chi^2 value for this model given input astrometry data and uncertainties for the specified astrometric data set.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

The index of the astrometric filter or data set.

Returns:
chi2array_like

List of chi^2 values from the model and astrometric data.

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

Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.

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:
chi2array_like

List of chi^2 values from the model and photometric data.

get_lens_astrometry(t, filt_idx=0)

Get the lens astrometry. In photometry-only coordinates, lens is at the origin.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xLnumpy array, shape=[len(t), 2]

Position of the lens on sky, in Einstein radius units. Always zero.

get_lnL_constant(err_obs)

Get the natural log of the constant normalization terms of the likelihood.

\[-0.5 * \ln{2 \pi \sigma_{obs}^2}\]
Parameters:
err_obsarray_like

List of the uncertainties.

Returns:
List of ln(likelihood constants).
get_photometry(t, filt_idx=0)

Get the predicted photomety at the specified times for the specified photometric filter or data set.

Parameters:
tarray_like

List of times in MJD for the observations.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
mag_modelarray_like

Magnitude of the unresolved microlensing event at t.

get_resolved_amplification(t, filt_idx=0)

Get the photometric amplification terms at a set of times, t for both the plus and minus images. The returned tuple has two entries: (A_plus, A_minus), each with len(t) arrays.

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array, dtype=float, shape = [len(t), [+/-]

The amplification for the + and - lensed images.

get_resolved_astrometry(t, filt_idx=0)

Position of the observed source position in Einstein radii.

Parameters:
tarray_like, shape = [N_times]

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
model_posarray_like. shape = [N_times, N_images, 2]

Array of vector positions of the centroid at each t.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the unlensed astrometry of the source. Note, this is a photometry only model, so units are in Einstein radii.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2

The unlensed positions of the source in Einstein radii (i.e. vec{u})

get_u(t, filt_idx=0)

Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.

Parameters:
tarray_like

List of times in MJD for the observations.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
u_unlensednumpy array, dtype=float, shape = len(t) x 2

The unlensed positions of the source in Einstein radii.

log_likely_astrometry(t, x, y, xerr, yerr, filt_idx=0)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
ln_Larray_like

List of ln(likelihood) for each astrometric measurement.

log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
ln_Larray_like

List of ln(likelihood) for each astrometric measurement.

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

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

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

Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is 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_Larray_like

List of ln(likelihood) for each photometric measurement.

class model.PSPL_PhotAstrom

Bases: PSPL

Contains methods for model a PSPL photometry + astrometry. This is a Data-type class in our hierarchy. It is abstract and should not be instantiated.

Attributes:
Available class variables that should be defined.
t0
tE
u0_amp
u0_E
u0_N
beta
piE_E - valid only if parallax model
piE_N - valid only if parallax model
piE_amp
mL
thetaE_amp
thetaE_E
thetaE_N
xS0_E
xS0_N
xL0_E
xL0_N
muS_E
muS_N
muL_E
muL_N
muRel_E
muRel_N
muRel_amp
piS
piL
dL
dS
dL_dS (dL over dS)
b_sff[#]
mag_src[#] – add in
mag_base[#] – add in
raL - if parallax model
decL - if parallax model

Methods

animate(tE, time_steps, frame_time, name, ...)

Produces animation of microlensing event.

get_amplification(t[, filt_idx])

Get an array of the total photometric amplifications at the input times.

get_astrometry(t[, filt_idx])

Get the astrometry of the unresolved (observed) position of the lensed source at the input times.

get_astrometry_unlensed(t[, filt_idx])

Get the unresolved astrometry of the combined source and lens if there was no gravitational lensing.

get_centroid_shift(t[, filt_idx])

Get the centroid shift (in mas) at the input times.

get_chi2_astrometry(t, x_obs, y_obs, ...[, ...])

Get the chi^2 value for this model given input astrometry data and uncertainties for the specified astrometric data set.

get_chi2_photometry(t, mag_obs, mag_err_obs)

Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.

get_lens_astrometry(t[, filt_idx])

Get the astrometry for the foreground lens at the input times.

get_lnL_constant(err_obs)

Get the natural log of the constant normalization terms of the likelihood.

get_photometry(t[, filt_idx])

Get the predicted photomety at the specified times for the specified photometric filter or data set.

get_resolved_amplification(t[, filt_idx])

Get the photometric amplification terms at a set of times, t for both the plus and minus images.

get_resolved_astrometry(t[, filt_idx])

Get the relative RA and Dec astrometry for each of the two source images, which we label plus and minus.

get_source_astrometry_unlensed(t[, filt_idx])

Get the astrometry of the source if the lens didn't exist.

get_u(t[, filt_idx])

Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.

log_likely_astrometry(t, x_obs, y_obs, ...)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.

log_likely_astrometry_each(t, x_obs, y_obs, ...)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.

log_likely_photometry(t, mag_obs, mag_err_obs)

Get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.

log_likely_photometry_each(t, mag_obs, ...)

Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.

animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)

Produces animation of microlensing event.

Parameters:
tE:
number of einstein crossings times before/after the peak you want the animation to plot

e.g tE = 2 => graph will go from -2 tE to 2 tE

time_steps:

number of time steps before/after peak, so total number of time steps will be 2 times this value

frame_time:

times in ms of each frame in the animation

name: string

the animation will be saved as name.html

size: list

[horizontal, vertical] cm’s

zoom:

# of einstein radii plotted in vertical direction

get_amplification(t, filt_idx=0)

Get an array of the total photometric amplifications at the input times.

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array, dtype=float, shape = [len(t)]

The total amplification (sum of +/- images)

get_astrometry(t, filt_idx=0)

Get the astrometry of the unresolved (observed) position of the lensed source at the input times. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroidnumpy array, dtype=float, shape = [len(t), 2]

The flux-weighted centroid of all lensed images from the source and any luminous lenses.

get_astrometry_unlensed(t, filt_idx=0)

Get the unresolved astrometry of the combined source and lens if there was no gravitational lensing. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_unlensednumpy array, dtype=float, shape = [len(t), 2]

The unlensed, flux-weighted centroid position of the source+lens in arcseconds.

get_centroid_shift(t, filt_idx=0)

Get the centroid shift (in mas) at the input times. The centroid shift is the difference between the lensed, unresolved position (with lensed source + lens light) and the unlensed, unresolved position (with unlensed source + lens light). The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the photometric filter or data set.

get_chi2_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the chi^2 value for this model given input astrometry data and uncertainties for the specified astrometric data set.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

The index of the astrometric filter or data set.

Returns:
chi2array_like

List of chi^2 values from the model and astrometric data.

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

Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.

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:
chi2array_like

List of chi^2 values from the model and photometric data.

get_lens_astrometry(t, filt_idx=0)

Get the astrometry for the foreground lens at the input times. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xLarray_like, dtype=float, shape = [len(t), 2]

Position of the lens on the sky (arcsec).

get_lnL_constant(err_obs)

Get the natural log of the constant normalization terms of the likelihood.

\[-0.5 * \ln{2 \pi \sigma_{obs}^2}\]
Parameters:
err_obsarray_like

List of the uncertainties.

Returns:
List of ln(likelihood constants).
get_photometry(t, filt_idx=0)

Get the predicted photomety at the specified times for the specified photometric filter or data set.

Parameters:
tarray_like

List of times in MJD for the observations.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
mag_modelarray_like

Magnitude of the unresolved microlensing event at t.

get_resolved_amplification(t, filt_idx=0)

Get the photometric amplification terms at a set of times, t for both the plus and minus images. The returned tuple has two entries: (A_plus, A_minus), each with len(t) arrays.

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array, dtype=float, shape = [len(t), [+/-]

The amplification for the + and - lensed images.

get_resolved_astrometry(t, filt_idx=0)

Get the relative RA and Dec astrometry for each of the two source images, which we label plus and minus. The returned tuple has two entries: (xS_plus, xS_minus), each with [len(t), 2] arrays where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
(xS_plus, xS_minus)tuple of numpy arrays
  • xS_plus is the vector position of the plus image in arcsec with shape = [len(t), 2]

  • xS_minus is the vector position of the plus image in arcsec with shape = [len(t), 2]

get_source_astrometry_unlensed(t, filt_idx=0)

Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_unlensednumpy array, dtype=float, shape = [len(t), 2]

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.

Parameters:
tarray_like

List of times in MJD for the observations.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
u_unlensednumpy array, dtype=float, shape = len(t) x 2

The unlensed positions of the source in Einstein radii.

log_likely_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
ln_Larray_like

List of ln(likelihood) for each astrometric measurement.

log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
ln_Larray_like

List of ln(likelihood) for each astrometric measurement.

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

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

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

Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is 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_Larray_like

List of ln(likelihood) for each photometric measurement.

class model.PSPL_Astrom

Bases: PSPL

Contains methods for model a PSPL photometry + astrometry. This is a Data-type class in our hierarchy. It is abstract and should not be instantiated.

Attributes:
Available class variables that should be defined.
t0
tE
u0_amp
u0_E
u0_N
beta
piE_E - valid only if parallax model
piE_N - valid only if parallax model
piE_amp
mL
thetaE_amp
thetaE_E
thetaE_N
xS0_E
xS0_N
xL0_E
xL0_N
muS_E
muS_N
muL_E
muL_N
muRel_E
muRel_N
muRel_amp
piS
piL
dL
dS
dL_dS (dL over dS)
b_sff[#]
raL - if parallax model
decL - if parallax model

Methods

animate(tE, time_steps, frame_time, name, ...)

Produces animation of microlensing event.

get_amplification(t[, filt_idx])

Get an array of the total photometric amplifications at the input times.

get_astrometry(t[, filt_idx])

Get the astrometry of the unresolved (observed) position of the lensed source at the input times.

get_astrometry_unlensed(t[, filt_idx])

Get the unresolved astrometry of the combined source and lens if there was no gravitational lensing.

get_centroid_shift(t[, filt_idx])

Get the centroid shift (in mas) at the input times.

get_chi2_astrometry(t, x_obs, y_obs, ...[, ...])

Get the chi^2 value for this model given input astrometry data and uncertainties for the specified astrometric data set.

get_chi2_photometry(t, mag_obs, mag_err_obs)

Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.

get_lens_astrometry(t[, filt_idx])

Get the astrometry for the foreground lens at the input times.

get_lnL_constant(err_obs)

Get the natural log of the constant normalization terms of the likelihood.

get_photometry(t[, filt_idx])

Get the predicted photomety at the specified times for the specified photometric filter or data set.

get_resolved_amplification(t[, filt_idx])

Get the photometric amplification terms at a set of times, t for both the plus and minus images.

get_resolved_astrometry(t[, filt_idx])

Get the relative RA and Dec astrometry for each of the two source images, which we label plus and minus.

get_source_astrometry_unlensed(t[, filt_idx])

Get the astrometry of the source if the lens didn't exist.

get_u(t[, filt_idx])

Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.

log_likely_astrometry(t, x_obs, y_obs, ...)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.

log_likely_astrometry_each(t, x_obs, y_obs, ...)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.

log_likely_photometry(t, mag_obs, mag_err_obs)

Get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.

log_likely_photometry_each(t, mag_obs, ...)

Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.

animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)

Produces animation of microlensing event.

Parameters:
tE:
number of einstein crossings times before/after the peak you want the animation to plot

e.g tE = 2 => graph will go from -2 tE to 2 tE

time_steps:

number of time steps before/after peak, so total number of time steps will be 2 times this value

frame_time:

times in ms of each frame in the animation

name: string

the animation will be saved as name.html

size: list

[horizontal, vertical] cm’s

zoom:

# of einstein radii plotted in vertical direction

get_amplification(t, filt_idx=0)

Get an array of the total photometric amplifications at the input times.

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array, dtype=float, shape = [len(t)]

The total amplification (sum of +/- images)

get_astrometry(t, filt_idx=0)

Get the astrometry of the unresolved (observed) position of the lensed source at the input times. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroidnumpy array, dtype=float, shape = [len(t), 2]

The flux-weighted centroid of all lensed images from the source and any luminous lenses.

get_astrometry_unlensed(t, filt_idx=0)

Get the unresolved astrometry of the combined source and lens if there was no gravitational lensing. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_unlensednumpy array, dtype=float, shape = [len(t), 2]

The unlensed, flux-weighted centroid position of the source+lens in arcseconds.

get_centroid_shift(t, filt_idx=0)

Get the centroid shift (in mas) at the input times. The centroid shift is the difference between the lensed, unresolved position (with lensed source + lens light) and the unlensed, unresolved position (with unlensed source + lens light). The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the photometric filter or data set.

get_chi2_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the chi^2 value for this model given input astrometry data and uncertainties for the specified astrometric data set.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

The index of the astrometric filter or data set.

Returns:
chi2array_like

List of chi^2 values from the model and astrometric data.

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

Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.

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:
chi2array_like

List of chi^2 values from the model and photometric data.

get_lens_astrometry(t, filt_idx=0)

Get the astrometry for the foreground lens at the input times. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xLarray_like, dtype=float, shape = [len(t), 2]

Position of the lens on the sky (arcsec).

get_lnL_constant(err_obs)

Get the natural log of the constant normalization terms of the likelihood.

\[-0.5 * \ln{2 \pi \sigma_{obs}^2}\]
Parameters:
err_obsarray_like

List of the uncertainties.

Returns:
List of ln(likelihood constants).
get_photometry(t, filt_idx=0)

Get the predicted photomety at the specified times for the specified photometric filter or data set.

Parameters:
tarray_like

List of times in MJD for the observations.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
mag_modelarray_like

Magnitude of the unresolved microlensing event at t.

get_resolved_amplification(t, filt_idx=0)

Get the photometric amplification terms at a set of times, t for both the plus and minus images. The returned tuple has two entries: (A_plus, A_minus), each with len(t) arrays.

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array, dtype=float, shape = [len(t), [+/-]

The amplification for the + and - lensed images.

get_resolved_astrometry(t, filt_idx=0)

Get the relative RA and Dec astrometry for each of the two source images, which we label plus and minus. The returned tuple has two entries: (xS_plus, xS_minus), each with [len(t), 2] arrays where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
(xS_plus, xS_minus)tuple of numpy arrays
  • xS_plus is the vector position of the plus image in arcsec with shape = [len(t), 2]

  • xS_minus is the vector position of the plus image in arcsec with shape = [len(t), 2]

get_source_astrometry_unlensed(t, filt_idx=0)

Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_unlensednumpy array, dtype=float, shape = [len(t), 2]

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.

Parameters:
tarray_like

List of times in MJD for the observations.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
u_unlensednumpy array, dtype=float, shape = len(t) x 2

The unlensed positions of the source in Einstein radii.

log_likely_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
ln_Larray_like

List of ln(likelihood) for each astrometric measurement.

log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)

Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.

y_obsarray_like

List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.

x_err_obsarray_like

List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.

y_err_obsarray_like

List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
ln_Larray_like

List of ln(likelihood) for each astrometric measurement.

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

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

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

Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is 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_Larray_like

List of ln(likelihood) for each photometric measurement.