BSPL Model Classes

BSPL Photometry + Astrometry with Static Lens Secondary

class model.BSPL_PhotAstrom_Par_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstromParam1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_Par_Param2(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstromParam2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_Par_Param3(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstromParam3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstromParam1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_Param2(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstromParam2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_Param3(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstromParam3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.

BSPL Photometry Only, Static Lens Secondary

class model.BSPL_Phot_Par_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_Phot, BSPL_Parallax, BSPL_PhotParam1

BSPL model for photometry only

A Binary point Source Point Lens model for microlensing.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_amp: float

Angular distance between the lens and source on the plane of the sky at closest approach in units of thetaE. It can be

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

tE: float

Einstein crossing time based on the system mass. [MJD]

piE_E: float

The microlensing parallax in the East direction in units of thetaE

piE_N: float

The microlensing parallax in the North direction in units of thetaE

sep: float

Angular separation of the source scondary from the source primary in units of thetaE.

phi: float

Angle made between the binary axis and the relative proper motion vector, measured in degrees.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

Parallax: Get the photometric amplification term 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_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

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.

get_t0_sec

start

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

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
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.

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

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_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in Einstein radii.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the astrometry of the source if the lens didn’t exist. This is the flux-weighted, centroid of the two sources. Note, this is a photometry only model, so units are in Einstein radii.

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

The unlensed positions of the source in Einstein radii.

get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_Phot_noPar_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_Phot, BSPL_noParallax, BSPL_PhotParam1

BSPL model for photometry only

A Binary point Source Point Lens model for microlensing.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_amp: float

Angular distance between the lens and source on the plane of the sky at closest approach in units of thetaE. It can be

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

tE: float

Einstein crossing time based on the system mass. [MJD]

piE_E: float

The microlensing parallax in the East direction in units of thetaE

piE_N: float

The microlensing parallax in the North direction in units of thetaE

sep: float

Angular separation of the source scondary from the source primary in units of thetaE.

phi: float

Angle made between the binary axis and the relative proper motion vector, measured in degrees.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

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

Parallax: Get the photometric amplification term 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_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

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.

get_t0_sec

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

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
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.

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

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_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in Einstein radii.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the astrometry of the source if the lens didn’t exist. This is the flux-weighted, centroid of the two sources. Note, this is a photometry only model, so units are in Einstein radii.

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

The unlensed positions of the source in Einstein radii.

get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.

BSPL Photometry + Astrometry, with GP

class model.BSPL_PhotAstrom_Par_GP_Param1(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_Parallax, BSPL_GP_PhotAstromParam1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_Par_GP_Param2(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_Parallax, BSPL_GP_PhotAstromParam2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_Par_GP_Param3(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_Parallax, BSPL_GP_PhotAstromParam3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_noPar_GP_Param1(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_noParallax, BSPL_GP_PhotAstromParam1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_noPar_GP_Param2(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_noParallax, BSPL_GP_PhotAstromParam2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_noPar_GP_Param3(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_noParallax, BSPL_GP_PhotAstromParam3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.

BSPL Photometry-Only, with GP

class model.BSPL_Phot_Par_GP_Param1(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_Phot, BSPL_Parallax, BSPL_GP_PhotParam1

BSPL model for photometry only

A Binary point Source Point Lens model for microlensing.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_amp: float

Angular distance between the lens and source on the plane of the sky at closest approach in units of thetaE. It can be

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

tE: float

Einstein crossing time based on the system mass. [MJD]

piE_E: float

The microlensing parallax in the East direction in units of thetaE

piE_N: float

The microlensing parallax in the North direction in units of thetaE

sep: float

Angular separation of the source scondary from the source primary in units of thetaE.

phi: float

Angle made between the binary axis and the relative proper motion vector, measured in degrees.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

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_celerite_gp_object(mag_err_obs[, filt_idx])

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

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term 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_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

start

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

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
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.

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

The unlensed positions of the source in Einstein radii.

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_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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

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_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in Einstein radii.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the astrometry of the source if the lens didn’t exist. This is the flux-weighted, centroid of the two sources. Note, this is a photometry only model, so units are in Einstein radii.

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

The unlensed positions of the source in Einstein radii.

get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_Phot_noPar_GP_Param1(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_Phot, BSPL_noParallax, BSPL_GP_PhotParam1

BSPL model for photometry only

A Binary point Source Point Lens model for microlensing.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_amp: float

Angular distance between the lens and source on the plane of the sky at closest approach in units of thetaE. It can be

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

tE: float

Einstein crossing time based on the system mass. [MJD]

piE_E: float

The microlensing parallax in the East direction in units of thetaE

piE_N: float

The microlensing parallax in the North direction in units of thetaE

sep: float

Angular separation of the source scondary from the source primary in units of thetaE.

phi: float

Angle made between the binary axis and the relative proper motion vector, measured in degrees.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

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_celerite_gp_object(mag_err_obs[, filt_idx])

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

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term 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_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

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

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
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.

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

The unlensed positions of the source in Einstein radii.

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_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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

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_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in Einstein radii.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the astrometry of the source if the lens didn’t exist. This is the flux-weighted, centroid of the two sources. Note, this is a photometry only model, so units are in Einstein radii.

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

The unlensed positions of the source in Einstein radii.

get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.

BSPL Photometry + Astrometry, Linear Secondary Lens Motion

class model.BSPL_PhotAstrom_Par_LinOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_LinOrbs_Param1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_Par_LinOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_LinOrbs_Param2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_Par_LinOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_LinOrbs_Param3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_LinOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_LinOrbs_Param1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_LinOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_LinOrbs_Param2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_LinOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_LinOrbs_Param3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.

BSPL Photometry + Astrometry, Accelerating Secondary Lens Motion

class model.BSPL_PhotAstrom_Par_AccOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_AccOrbs_Param1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_Par_AccOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_AccOrbs_Param2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_Par_AccOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_AccOrbs_Param3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_AccOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_AccOrbs_Param1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_AccOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_AccOrbs_Param2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_AccOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_AccOrbs_Param3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.

BSPL Photometry + Astrometry, Circular Orbits for Lens

class model.BSPL_PhotAstrom_Par_CircOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_CircOrbs_Param1

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_Par_CircOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_CircOrbs_Param2

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_Par_CircOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_CircOrbs_Param3

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_CircOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_CircOrbs_Param1

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_CircOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_CircOrbs_Param2

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_CircOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_CircOrbs_Param3

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.

BSPL Photometry + Astrometry, Elliptical Orbits for Lens

class model.BSPL_PhotAstrom_Par_EllOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_EllOrbs_Param1

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_Par_EllOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_EllOrbs_Param2

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_Par_EllOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_Parallax, BSPL_PhotAstrom_EllOrbs_Param3

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_EllOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_EllOrbs_Param1

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_EllOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_EllOrbs_Param2

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.BSPL_PhotAstrom_noPar_EllOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, BSPL_PhotAstrom, BSPL_noParallax, BSPL_PhotAstrom_EllOrbs_Param3

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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.

BSPL Photometry + Astrometry, Lens Motion, GP

class model.BSPL_PhotAstrom_Par_GP_LinOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_Parallax, BSPL_GP_PhotAstrom_LinOrbs_Param1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_Par_GP_LinOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_Parallax, BSPL_GP_PhotAstrom_LinOrbs_Param2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_Par_GP_LinOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_Parallax, BSPL_GP_PhotAstrom_LinOrbs_Param3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_noPar_GP_LinOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_noParallax, BSPL_GP_PhotAstrom_LinOrbs_Param1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_noPar_GP_LinOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_noParallax, BSPL_GP_PhotAstrom_LinOrbs_Param2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_noPar_GP_LinOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_noParallax, BSPL_GP_PhotAstrom_LinOrbs_Param3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_Par_GP_AccOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_Parallax, BSPL_GP_PhotAstrom_AccOrbs_Param1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_Par_GP_AccOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_Parallax, BSPL_GP_PhotAstrom_AccOrbs_Param2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_Par_GP_AccOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_Parallax, BSPL_GP_PhotAstrom_AccOrbs_Param3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_geoproj_ast_params(t0par[, plot])

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

get_geoproj_params(t0par[, plot])

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par.

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

start

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.

Parameters:
filt_idxint, optional

Index of the astrometric filter or data set.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_geoproj_ast_params(t0par, plot=False)

Get the astrometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
xS0E_gfloat

The East-component of source position vector on the sky, in the geocentric-projected frame.

xS0N_gfloat

The North-component of source position vector on the sky, in the geocentric-projected frame.

muSE_gfloat

The East-component of source proper motion vector, in the geocentric-projected frame.

muSN_gfloat

The North-component of source proper motion vector, in the geocentric-projected frame.

get_geoproj_params(t0par, plot=False)

Get the photometric microlensing model parameters in the geocentric-projected coordinate system, which just applies a rectalinear position and velocity offset into the geocentric frame at time t0par. Note, this is not a true geocentric frame. It is only geocentric at time t0par. However, this is a common convention for photometry-only microlens models in the literature. The benefits of the geocentric-projected frame is that the t0_{geoProj} can more closely match the observed peak in the light curve.

Parameters:
t0parfloat

Time in MJD at which to convert into the geocentric frame.

Returns:
t0_gfloat

The time (in MJD) of closest approach between the lens and source in the geocentric-projected frame.

u0_gfloat

The distance (in thetaE) at closest approach in the geocentric-projected frame.

tE_gfloat

The Einsten crossing time (in MJD) in the geocentric-projected frame.

piEE_gfloat

The East-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the East-component of the relative proper motion vector between the source and lens

piEN_gfloat

The North-component of the microlensing parallax vector, in the geocentric-projected frame. This also indicates the North-component of the relative proper motion vector between the source and lens

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_noPar_GP_AccOrbs_Param1(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_noParallax, BSPL_GP_PhotAstrom_AccOrbs_Param1

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
mL: float

Mass of the lens (Msun)

t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

beta: float

Angular distance between the lens and primary source on the plane of the sky (mas). Can be

  • positive (u0_amp > 0 when u0_hat[0] < 0) or

  • negative (u0_amp < 0 when u0_hat[0] > 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

dL: float

Distance from the observer to the lens (pc)

dL_dS: float

Ratio of Distance from the obersver to the lens to Distance from the observer to the source

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_N: float

Dec source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

muL_E: float

RA Lens proper motion (mas/yr)

muL_N: float

Dec Lens proper motion (mas/yr)

muS_E: float

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_N: float

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

mag_src_pri: array or list

Photometric magnitude of the first (primary) source. This must be passed in as a list or array, with one entry for each photometric filter.

mag_src_sec: array or list

Photometric magnitude of the second (secondary) source. This must be passed in as a list or array, with one entry for each photometric filter.

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_S1 + f_S2) / (f_S1 + f_s2 + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_noPar_GP_AccOrbs_Param2(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_noParallax, BSPL_GP_PhotAstrom_AccOrbs_Param2

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_{base} = f_{src1} + f_{src2} + f_{blend}\)

such that

\(b_sff = (f_{src1}+ f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.BSPL_PhotAstrom_noPar_GP_AccOrbs_Param3(*args, **kwargs)

Bases: ModelClassABC, PSPL_GP, BSPL_PhotAstrom, BSPL_noParallax, BSPL_GP_PhotAstrom_AccOrbs_Param3

BSPL model for astrometry and photometry - physical parameterization.

A Binary point Source Point Lens model for microlensing. This model uses a parameterization that depends on only physical quantities such as the lens mass and positions and proper motions of both the lens and source.

Note the attributes, RA (raL) and Dec (decL) are required if you are calculating a model with parallax.

Attributes:
t0: float

Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.

u0_ampfloat

Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can

  • positive (u0_amp > 0 when u0_hat[0] > 0) or

  • negative (u0_amp < 0 when u0_hat[0] < 0).

Note, since this is a binary source, we are expressing the nominal source position as that of the primary star in the source binary system.

tEfloat

Einstein crossing time (days).

log10_thetaEfloat

The size of the Einstein radius in (mas).

piSfloat

Amplitude of the parallax (1AU/dS) of the source. (mas)

piE_Efloat

The microlensing parallax in the East direction in units of thetaE

piE_Nfloat

The microlensing parallax in the North direction in units of thetaE

xS0_Efloat

R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame. This should be the position of the source primary.

xS0_Nfloat

Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

muS_Efloat

RA Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

muS_Nfloat

Dec Source proper motion (mas/yr) Identical proper motions are assumed for the source primary and secondary.

sep: float

Angular separation of the source scondary from the source primary (mas).

alpha: float

Angle made between the binary source axis and North; measured in degrees East of North.

fratio_bin: float

Flux ratio of secondary flux / primary flux.

mag_basearray or list

Photometric magnitude of the base. This must be passed in as a list or array, with one entry for each photometric filter. Note that

\(flux_base = f_{src1{ + f_{src2{ + f_{blend}\)

such that

\(b_sff = (f_{src1} + f_{src2}) / ( f_{src1} + f_{src2} + f_{blend} )\)

b_sff: array or list

The ratio of the source flux to the total (source + neighbors + lens) \(b_sff = (f_{S1} + f_{S2}) / (f_{S1} + f_{s2} + f_L + f_N)\). This must be passed in as a list or array, with one entry for each photometric filter.

raL: float, optional

Right ascension of the lens in decimal degrees.

decL: float, optional

Declination of the lens in decimal degrees.

obsLocation: str or list[str], optional

The observers location for each photometric dataset (def=[‘earth’]) such as ‘jwst’ or ‘spitzer’. Can be a single string if all observer locations are identical. Otherwise, array of same length as mag_src or b_sff (e.g. other photometric parameters).

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_amplification(t[, filt_idx])

Parallax: Get the photometric amplification term at a set of times, t.

get_astrometric_shift(t[, filt_idx])

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source.

get_astrometry(t[, filt_idx])

Parallax: Get unresolved astrometry for binary source, point lens.

get_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_celerite_gp_object(mag_err_obs[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).

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_log_det_covariance(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_photometry(t[, filt_idx])

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

get_photometry_with_gp(t, mag_obs, mag_err_obs)

Returns photometry with GP noise added in.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

Parallax: For each source, get the x, y astrometry for the two lensed source images.

get_resolved_source_astrometry_unlensed(t[, ...])

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

get_source_astrometry_unlensed(t[, filt_idx])

Get the flux-weighted centroid for the astrometry of the sources if the lens didn't exist.

get_u(t[, filt_idx])

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)

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.

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.

get_t0_sec

get_u0_sec

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

Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows

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

filt_idxint, optional

Index of the astrometric filter or data set.

calc_piE_ecliptic(filt_idx=0)

Not supported on this object.

get_amplification(t, filt_idx=0)

Parallax: Get the photometric amplification term at a set of times, t.

Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is

..math:

A = (f1 * A1 + f2 * A2) / (f1 + f2)

where the fluxes are the intrinsic source flux in the specified filter.

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
Anumpy array
Array of combined amplifications in the specified filter.
Shape = [len(t)]
get_astrometric_shift(t, filt_idx=0)

Parallax: Get unresolved centroid shift (due to lensing) for each of the binary source. This is made for simulation purposes only.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry(t, filt_idx=0)

Parallax: Get unresolved astrometry for binary source, point lens.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xS_lensed

Returns flux-weighted average of lensed source positions.

get_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
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_centroid_shift(t, filt_idx=0)

Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD). This is the difference between the unresolved, unlensed centroid and the unresolved, lensed centroid. Note that if the lens is luminous or both sources are luminous, both the unlensed and lensed trajectory will be belnded.

Parameters:
t:

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
centroid_shiftnumpy array

[shape = len(t), 2] in milli-arcseoncds

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_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(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_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.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
t: Array of times in MJD.DDD
filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
A_resolvednumpy array

[shape = len(t), len(sources), 2]

Notes

For each time t and each source, we have:
  • A_plus is the amplification for the plus image.

  • A_minus is the amplification for the minus image.

In other words,

xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.

get_resolved_astrometry(t, filt_idx=0)

Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.

Returns:
xS_resolvednumpy array

[shape = len(t), len(sources), 2, 2]

Notes

For each time t and each source, we have:
  • xS_plus is the vector position of the plus image.

  • xS_minus is the vector position of the minus image.

In other words,

xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.

Similarly,

xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.

get_resolved_source_astrometry_unlensed(t, filt_idx=0)

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

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

The unlensed positions of the sources in arcseconds.

In other words,

xS[0, 0, :] returns the 2D sky position of the first source at the first time.

Similarly,

xS[0, 1, :] returns the 2D sky position of the second source at the first time.

get_source_astrometry_unlensed(t, filt_idx=0)

Get the flux-weighted centroid for the astrometry of the sources if the lens didn’t exist.

Returns:
xS_unlensednumpy array, dtype=float, shape = len(t) x 2 directions
The unlensed positions of the combined sources in arcseconds.
Shape = [len(t), 2 directions]
get_u(t, filt_idx=0)
Parameters:
tnumpy array

Times at which to evaluate the source-lens separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
unumpy array

Shape = [len(t), 2 sources, 2 directions on sky]

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)

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.

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.