FSPL Model Classes

FSPL Photometry and Astrometry

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

Bases: ModelClassABC, FSPL_PhotAstrom, FSPL_Parallax, FSPL_PhotAstromParam1

PSPL model for astrometry and photometry - physical parameterization.

A 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.

Parameters:
mL: float

Mass of the lens (Msun)

t0: float

Time of photometric peak, as seen from Earth (MJD.DDD)

beta: float

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

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

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

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.

xS0_N: float

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

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)

muS_N: float

Dec Source proper motion (mas/yr)

radiusS: float

Projected radius of the source star in arcsec on the sky plane.

b_sff: float

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

mag_src: float

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

n_outline: int (optional)

Number of boundary points to use when approximating the source outline. Calculation time scales approximately linearly with ‘n_outline’.

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(crossings, time_steps, frame_time, ...)

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

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

get_all_arrays_CI(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_all_arrays_amg(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_amplification(t[, filt_idx, amp_arr])

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

get_astrometry(t[, image_arr, amp_arr, filt_idx])

Position of the observed (unresolved) source position in arcsec.

get_astrometry_outline_unlensed(t[, filt_idx])

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

get_astrometry_unlensed(t[, filt_idx])

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

get_centroid_shift(t[, filt_idx, image_arr, ...])

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

Get the photometry for the combined source images.

get_resolved_amplification(t[, filt_idx, ...])

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

get_resolved_astrometry(t[, image_arr, ...])

Position of the observed (lensed) source position on the sky.

get_resolved_astrometry_outline(t[, filt_idx])

Get the x, y astrometry for each of the two lensed source images and all the associated outline points for each.

get_resolved_photometry(t[, filt_idx, amp_arr])

Get the photometry for each of the lensed source images.

get_resolved_shift_outline(t[, filt_idx])

Get the astrometric microlensing shift of each point in the source outline for each of the multiple lensed images.

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

get_u_outline(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline.

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.

cent

detJac

get_all_arrays

im_pos1

start

animate(crossings, 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_all_arrays_CI(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_all_arrays_amg(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Adaptive mesh grid creates more boundary points around the source only when it enters the Einstein ring.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_amplification(t, filt_idx=0, amp_arr=None)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

get_astrometry(t, image_arr=None, amp_arr=None, filt_idx=0)

Position of the observed (unresolved) source position in arcsec.

Parameters:
tarray_like

Array of times to model.

Returns:
model_posarray_like

Array of vector positions of the centroid at each t.

Other Parameters:
image_arrarray_like

Array of complex image positions at each t, i.e. image_arr.shape = (len(t), number of images at each t). Each value in this array is complex (real = north component, imaginary = east component)

amp_arrarray_like

Array of magnifications of each images. Same shape as image_arr.

filt_idxint

The filter index (def=0).

get_astrometry_outline_unlensed(t, filt_idx=0)

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

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source outline points in arcseconds. The source outline is described by a list of points along the circumference of the circular source. The last axis contains East/North positions.

get_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_centroid_shift(t, filt_idx=0, image_arr=None, amp_arr=None)

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

Returns the flux-weighted centroid of all the sources lensed images.

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 milliarcseoncds

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, amp_arr=None)

Get the photometry for the combined source images.

Parameters:
tarray_like

Array of times to model.

Returns:
mag_modelarray_like

Magnitude of the centroid at t.

Other Parameters:
amp_arrarray_like

Amplifications of each individual image at each time, i.e. amp_arr.shape = (len(t), number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

filt_idxint

The filter index (def=0).

get_resolved_amplification(t, filt_idx=0, amp_arr=None)

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
_______
amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [n_images=2, len(t)]

get_resolved_astrometry(t, image_arr=None, amp_arr=None, filt_idx=0)

Position of the observed (lensed) source position on the sky.

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, 2]

Array of vector positions of the centroid at each t. Last axis contains East/North positions.

Other Parameters:
image_arrarray_like

Array of complex image positions at each t, i.e. image_arr.shape = (len(t), number of images at each t, [E,N]).

amp_arrarray_like

Array of magnifications of each images. Same shape as image_arr.

get_resolved_astrometry_outline(t, filt_idx=0)

Get the x, y astrometry for each of the two lensed source images and all the associated outline points for each. The two lensed source images are labeled plus and minus.

These are actual positions on the sky.

Returns:
xS_lensed_resolved_outlinenumpy array

Vector position of the plus and minus images in arcsec. shape = [len(t), self.n_outline, [+,-], [E,N]] where the last axis contains East and North positions.

get_resolved_photometry(t, filt_idx=0, amp_arr=None)

Get the photometry for each of the lensed source images. Implement with no blending (since we don’t support different blendings for the different images).

Parameters:
tarray_like

Array of times to model.

Returns:
mag_modelarray_like

Magnitude of each lensed image centroid at t. Shape = [2, len(t)]

Other Parameters:
amp_arrarray_like

Amplifications of each individual image and each outline point for that image at each time, i.e. amp_arr.shape = (len(t), self.n_outline, number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

filt_idxint

The filter index (def=0).

get_resolved_shift_outline(t, filt_idx=0)

Get the astrometric microlensing shift of each point in the source outline for each of the multiple lensed images. These are the positional offsets between the source image outline and the lens position. No impact from the lens flux is included.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xSL_lensed_resolvedarray, float, shape = [len(t), n_outline, [+, -], [E, N]]

Relative astrometric position of the plus and minus image in East, North w.r.t. the lens in units of milli-arcseconds.

get_source_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

Separation vector in East, North on the sky in units of theta_E.

get_u_outline(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline. Positions are on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
uarray, float, shape = [len(t), n_outline, [E, N]]

Separation vector in East, North on the sky in units of theta_E.

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

Bases: ModelClassABC, FSPL_PhotAstrom, FSPL_Parallax, FSPL_PhotAstromParam2

PSPL model for photometry and astrometry – photom-like parameterization

Point Source Point Lens model for microlensing. This model includes proper motions of the source and the source position on the sky.

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. 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 (days).

thetaE: float

The size of the Einstein radius in (mas).

piS: float

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

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

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

xS0_N: float

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

muS_E: float

RA Source proper motion (mas/yr)

muS_N: float

Source proper motion (mas/yr)

b_sff: numpy array or list

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

mag_src: numpy array or list

Photometric magnitude of the source. 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(crossings, time_steps, frame_time, ...)

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

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

get_all_arrays_CI(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_all_arrays_amg(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_amplification(t[, filt_idx, amp_arr])

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

get_astrometry(t[, image_arr, amp_arr, filt_idx])

Position of the observed (unresolved) source position in arcsec.

get_astrometry_outline_unlensed(t[, filt_idx])

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

get_astrometry_unlensed(t[, filt_idx])

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

get_centroid_shift(t[, filt_idx, image_arr, ...])

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

Get the photometry for the combined source images.

get_resolved_amplification(t[, filt_idx, ...])

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

get_resolved_astrometry(t[, image_arr, ...])

Position of the observed (lensed) source position on the sky.

get_resolved_astrometry_outline(t[, filt_idx])

Get the x, y astrometry for each of the two lensed source images and all the associated outline points for each.

get_resolved_photometry(t[, filt_idx, amp_arr])

Get the photometry for each of the lensed source images.

get_resolved_shift_outline(t[, filt_idx])

Get the astrometric microlensing shift of each point in the source outline for each of the multiple lensed images.

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

get_u_outline(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline.

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.

cent

detJac

get_all_arrays

im_pos1

start

animate(crossings, 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_all_arrays_CI(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_all_arrays_amg(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Adaptive mesh grid creates more boundary points around the source only when it enters the Einstein ring.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_amplification(t, filt_idx=0, amp_arr=None)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

get_astrometry(t, image_arr=None, amp_arr=None, filt_idx=0)

Position of the observed (unresolved) source position in arcsec.

Parameters:
tarray_like

Array of times to model.

Returns:
model_posarray_like

Array of vector positions of the centroid at each t.

Other Parameters:
image_arrarray_like

Array of complex image positions at each t, i.e. image_arr.shape = (len(t), number of images at each t). Each value in this array is complex (real = north component, imaginary = east component)

amp_arrarray_like

Array of magnifications of each images. Same shape as image_arr.

filt_idxint

The filter index (def=0).

get_astrometry_outline_unlensed(t, filt_idx=0)

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

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source outline points in arcseconds. The source outline is described by a list of points along the circumference of the circular source. The last axis contains East/North positions.

get_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_centroid_shift(t, filt_idx=0, image_arr=None, amp_arr=None)

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

Returns the flux-weighted centroid of all the sources lensed images.

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 milliarcseoncds

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, amp_arr=None)

Get the photometry for the combined source images.

Parameters:
tarray_like

Array of times to model.

Returns:
mag_modelarray_like

Magnitude of the centroid at t.

Other Parameters:
amp_arrarray_like

Amplifications of each individual image at each time, i.e. amp_arr.shape = (len(t), number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

filt_idxint

The filter index (def=0).

get_resolved_amplification(t, filt_idx=0, amp_arr=None)

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
_______
amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [n_images=2, len(t)]

get_resolved_astrometry(t, image_arr=None, amp_arr=None, filt_idx=0)

Position of the observed (lensed) source position on the sky.

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, 2]

Array of vector positions of the centroid at each t. Last axis contains East/North positions.

Other Parameters:
image_arrarray_like

Array of complex image positions at each t, i.e. image_arr.shape = (len(t), number of images at each t, [E,N]).

amp_arrarray_like

Array of magnifications of each images. Same shape as image_arr.

get_resolved_astrometry_outline(t, filt_idx=0)

Get the x, y astrometry for each of the two lensed source images and all the associated outline points for each. The two lensed source images are labeled plus and minus.

These are actual positions on the sky.

Returns:
xS_lensed_resolved_outlinenumpy array

Vector position of the plus and minus images in arcsec. shape = [len(t), self.n_outline, [+,-], [E,N]] where the last axis contains East and North positions.

get_resolved_photometry(t, filt_idx=0, amp_arr=None)

Get the photometry for each of the lensed source images. Implement with no blending (since we don’t support different blendings for the different images).

Parameters:
tarray_like

Array of times to model.

Returns:
mag_modelarray_like

Magnitude of each lensed image centroid at t. Shape = [2, len(t)]

Other Parameters:
amp_arrarray_like

Amplifications of each individual image and each outline point for that image at each time, i.e. amp_arr.shape = (len(t), self.n_outline, number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

filt_idxint

The filter index (def=0).

get_resolved_shift_outline(t, filt_idx=0)

Get the astrometric microlensing shift of each point in the source outline for each of the multiple lensed images. These are the positional offsets between the source image outline and the lens position. No impact from the lens flux is included.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xSL_lensed_resolvedarray, float, shape = [len(t), n_outline, [+, -], [E, N]]

Relative astrometric position of the plus and minus image in East, North w.r.t. the lens in units of milli-arcseconds.

get_source_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

Separation vector in East, North on the sky in units of theta_E.

get_u_outline(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline. Positions are on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
uarray, float, shape = [len(t), n_outline, [E, N]]

Separation vector in East, North on the sky in units of theta_E.

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

Bases: ModelClassABC, FSPL_PhotAstrom, FSPL_noParallax, FSPL_PhotAstromParam1

PSPL model for astrometry and photometry - physical parameterization.

A 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.

Parameters:
mL: float

Mass of the lens (Msun)

t0: float

Time of photometric peak, as seen from Earth (MJD.DDD)

beta: float

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

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

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

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.

xS0_N: float

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

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)

muS_N: float

Dec Source proper motion (mas/yr)

radiusS: float

Projected radius of the source star in arcsec on the sky plane.

b_sff: float

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

mag_src: float

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

n_outline: int (optional)

Number of boundary points to use when approximating the source outline. Calculation time scales approximately linearly with ‘n_outline’.

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(crossings, time_steps, frame_time, ...)

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_all_arrays_CI(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_all_arrays_amg(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_amplification(t[, filt_idx, amp_arr])

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

get_astrometry(t[, image_arr, amp_arr, filt_idx])

Position of the observed (unresolved) source position in arcsec.

get_astrometry_outline_unlensed(t[, filt_idx])

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

get_astrometry_unlensed(t[, filt_idx])

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

get_centroid_shift(t[, filt_idx, image_arr, ...])

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

Get the photometry for the combined source images.

get_resolved_amplification(t[, filt_idx, ...])

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

get_resolved_astrometry(t[, image_arr, ...])

Position of the observed (lensed) source position on the sky.

get_resolved_astrometry_outline(t[, filt_idx])

Get the x, y astrometry for each of the two lensed source images and all the associated outline points for each.

get_resolved_photometry(t[, filt_idx, amp_arr])

Get the photometry for each of the lensed source images.

get_resolved_shift_outline(t[, filt_idx])

Get the astrometric microlensing shift of each point in the source outline for each of the multiple lensed images.

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

get_u_outline(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline.

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.

cent

detJac

get_all_arrays

im_pos1

animate(crossings, 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_all_arrays_CI(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_all_arrays_amg(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Adaptive mesh grid creates more boundary points around the source only when it enters the Einstein ring.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_amplification(t, filt_idx=0, amp_arr=None)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

get_astrometry(t, image_arr=None, amp_arr=None, filt_idx=0)

Position of the observed (unresolved) source position in arcsec.

Parameters:
tarray_like

Array of times to model.

Returns:
model_posarray_like

Array of vector positions of the centroid at each t.

Other Parameters:
image_arrarray_like

Array of complex image positions at each t, i.e. image_arr.shape = (len(t), number of images at each t). Each value in this array is complex (real = north component, imaginary = east component)

amp_arrarray_like

Array of magnifications of each images. Same shape as image_arr.

filt_idxint

The filter index (def=0).

get_astrometry_outline_unlensed(t, filt_idx=0)

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

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source outline points in arcseconds. The source outline is described by a list of points along the circumference of the circular source. The last axis contains East/North positions.

get_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_centroid_shift(t, filt_idx=0, image_arr=None, amp_arr=None)

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

Returns the flux-weighted centroid of all the sources lensed images.

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 milliarcseoncds

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, amp_arr=None)

Get the photometry for the combined source images.

Parameters:
tarray_like

Array of times to model.

Returns:
mag_modelarray_like

Magnitude of the centroid at t.

Other Parameters:
amp_arrarray_like

Amplifications of each individual image at each time, i.e. amp_arr.shape = (len(t), number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

filt_idxint

The filter index (def=0).

get_resolved_amplification(t, filt_idx=0, amp_arr=None)

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
_______
amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [n_images=2, len(t)]

get_resolved_astrometry(t, image_arr=None, amp_arr=None, filt_idx=0)

Position of the observed (lensed) source position on the sky.

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, 2]

Array of vector positions of the centroid at each t. Last axis contains East/North positions.

Other Parameters:
image_arrarray_like

Array of complex image positions at each t, i.e. image_arr.shape = (len(t), number of images at each t, [E,N]).

amp_arrarray_like

Array of magnifications of each images. Same shape as image_arr.

get_resolved_astrometry_outline(t, filt_idx=0)

Get the x, y astrometry for each of the two lensed source images and all the associated outline points for each. The two lensed source images are labeled plus and minus.

These are actual positions on the sky.

Returns:
xS_lensed_resolved_outlinenumpy array

Vector position of the plus and minus images in arcsec. shape = [len(t), self.n_outline, [+,-], [E,N]] where the last axis contains East and North positions.

get_resolved_photometry(t, filt_idx=0, amp_arr=None)

Get the photometry for each of the lensed source images. Implement with no blending (since we don’t support different blendings for the different images).

Parameters:
tarray_like

Array of times to model.

Returns:
mag_modelarray_like

Magnitude of each lensed image centroid at t. Shape = [2, len(t)]

Other Parameters:
amp_arrarray_like

Amplifications of each individual image and each outline point for that image at each time, i.e. amp_arr.shape = (len(t), self.n_outline, number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

filt_idxint

The filter index (def=0).

get_resolved_shift_outline(t, filt_idx=0)

Get the astrometric microlensing shift of each point in the source outline for each of the multiple lensed images. These are the positional offsets between the source image outline and the lens position. No impact from the lens flux is included.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xSL_lensed_resolvedarray, float, shape = [len(t), n_outline, [+, -], [E, N]]

Relative astrometric position of the plus and minus image in East, North w.r.t. the lens in units of milli-arcseconds.

get_source_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

Separation vector in East, North on the sky in units of theta_E.

get_u_outline(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline. Positions are on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
uarray, float, shape = [len(t), n_outline, [E, N]]

Separation vector in East, North on the sky in units of theta_E.

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

Bases: ModelClassABC, FSPL_PhotAstrom, FSPL_noParallax, FSPL_PhotAstromParam2

PSPL model for photometry and astrometry – photom-like parameterization

Point Source Point Lens model for microlensing. This model includes proper motions of the source and the source position on the sky.

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. 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 (days).

thetaE: float

The size of the Einstein radius in (mas).

piS: float

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

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

xS0_E: float

RA Source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.

xS0_N: float

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

muS_E: float

RA Source proper motion (mas/yr)

muS_N: float

Source proper motion (mas/yr)

b_sff: numpy array or list

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

mag_src: numpy array or list

Photometric magnitude of the source. 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(crossings, time_steps, frame_time, ...)

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_all_arrays_CI(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_all_arrays_amg(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_amplification(t[, filt_idx, amp_arr])

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

get_astrometry(t[, image_arr, amp_arr, filt_idx])

Position of the observed (unresolved) source position in arcsec.

get_astrometry_outline_unlensed(t[, filt_idx])

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

get_astrometry_unlensed(t[, filt_idx])

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

get_centroid_shift(t[, filt_idx, image_arr, ...])

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

Get the photometry for the combined source images.

get_resolved_amplification(t[, filt_idx, ...])

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

get_resolved_astrometry(t[, image_arr, ...])

Position of the observed (lensed) source position on the sky.

get_resolved_astrometry_outline(t[, filt_idx])

Get the x, y astrometry for each of the two lensed source images and all the associated outline points for each.

get_resolved_photometry(t[, filt_idx, amp_arr])

Get the photometry for each of the lensed source images.

get_resolved_shift_outline(t[, filt_idx])

Get the astrometric microlensing shift of each point in the source outline for each of the multiple lensed images.

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

get_u_outline(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline.

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.

cent

detJac

get_all_arrays

im_pos1

animate(crossings, 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_all_arrays_CI(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_all_arrays_amg(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Adaptive mesh grid creates more boundary points around the source only when it enters the Einstein ring.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_amplification(t, filt_idx=0, amp_arr=None)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

get_astrometry(t, image_arr=None, amp_arr=None, filt_idx=0)

Position of the observed (unresolved) source position in arcsec.

Parameters:
tarray_like

Array of times to model.

Returns:
model_posarray_like

Array of vector positions of the centroid at each t.

Other Parameters:
image_arrarray_like

Array of complex image positions at each t, i.e. image_arr.shape = (len(t), number of images at each t). Each value in this array is complex (real = north component, imaginary = east component)

amp_arrarray_like

Array of magnifications of each images. Same shape as image_arr.

filt_idxint

The filter index (def=0).

get_astrometry_outline_unlensed(t, filt_idx=0)

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

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source outline points in arcseconds. The source outline is described by a list of points along the circumference of the circular source. The last axis contains East/North positions.

get_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_centroid_shift(t, filt_idx=0, image_arr=None, amp_arr=None)

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

Returns the flux-weighted centroid of all the sources lensed images.

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 milliarcseoncds

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, amp_arr=None)

Get the photometry for the combined source images.

Parameters:
tarray_like

Array of times to model.

Returns:
mag_modelarray_like

Magnitude of the centroid at t.

Other Parameters:
amp_arrarray_like

Amplifications of each individual image at each time, i.e. amp_arr.shape = (len(t), number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

filt_idxint

The filter index (def=0).

get_resolved_amplification(t, filt_idx=0, amp_arr=None)

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
_______
amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [n_images=2, len(t)]

get_resolved_astrometry(t, image_arr=None, amp_arr=None, filt_idx=0)

Position of the observed (lensed) source position on the sky.

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, 2]

Array of vector positions of the centroid at each t. Last axis contains East/North positions.

Other Parameters:
image_arrarray_like

Array of complex image positions at each t, i.e. image_arr.shape = (len(t), number of images at each t, [E,N]).

amp_arrarray_like

Array of magnifications of each images. Same shape as image_arr.

get_resolved_astrometry_outline(t, filt_idx=0)

Get the x, y astrometry for each of the two lensed source images and all the associated outline points for each. The two lensed source images are labeled plus and minus.

These are actual positions on the sky.

Returns:
xS_lensed_resolved_outlinenumpy array

Vector position of the plus and minus images in arcsec. shape = [len(t), self.n_outline, [+,-], [E,N]] where the last axis contains East and North positions.

get_resolved_photometry(t, filt_idx=0, amp_arr=None)

Get the photometry for each of the lensed source images. Implement with no blending (since we don’t support different blendings for the different images).

Parameters:
tarray_like

Array of times to model.

Returns:
mag_modelarray_like

Magnitude of each lensed image centroid at t. Shape = [2, len(t)]

Other Parameters:
amp_arrarray_like

Amplifications of each individual image and each outline point for that image at each time, i.e. amp_arr.shape = (len(t), self.n_outline, number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

filt_idxint

The filter index (def=0).

get_resolved_shift_outline(t, filt_idx=0)

Get the astrometric microlensing shift of each point in the source outline for each of the multiple lensed images. These are the positional offsets between the source image outline and the lens position. No impact from the lens flux is included.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
xSL_lensed_resolvedarray, float, shape = [len(t), n_outline, [+, -], [E, N]]

Relative astrometric position of the plus and minus image in East, North w.r.t. the lens in units of milli-arcseconds.

get_source_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

Separation vector in East, North on the sky in units of theta_E.

get_u_outline(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline. Positions are on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
uarray, float, shape = [len(t), n_outline, [E, N]]

Separation vector in East, North on the sky in units of theta_E.

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.

FSPL Photometry Only

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

Bases: ModelClassABC, FSPL_Phot, FSPL_Parallax, FSPL_PhotParam1

Point source point lens model for microlensing photometry only. This model includes the relative proper motion between the lens and the source. Parameters are reduced with the use of piRel (rather than dL and dS) and muRel (rather than muL and muS). Same as PSPL_PhotParam1.

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 in days.

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

radiusS: float

Apparent radius on the sky of the source star (in thetaE).

b_sff: numpy array or list

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

mag_src: numpy array or list

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

n_outline: int (optional)

Number of boundary points to use when approximating the source outline. Calculation time scales approximately linearly with ‘n_outline’.

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_all_arrays_CI(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_all_arrays_amg(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_amplification(t[, filt_idx, amp_arr])

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

get_astrometry(t[, filt_idx])

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

get_astrometry_unlensed(t[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

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

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

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

get_chi2_photometry(t, mag_obs, mag_err_obs)

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

get_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, amp_arr])

Get the photometry for each of the lensed source images.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

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

get_resolved_astrometry_outline(t[, filt_idx])

Get the delta-x, delta-y astrometry for each of the two lensed source images and all the associated outline points for each.

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

get_u_outline(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline.

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.

cent

detJac

get_all_arrays

im_pos1

start

Notes

Note

Required parameters if calculating with parallax

  • raL: Right ascension of the lens in decimal degrees.

  • decL: Declination of the lens in decimal degrees.

  • obsLocation: 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).

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

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_all_arrays_amg(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Adaptive mesh grid creates more boundary points around the source only when it enters the Einstein ring.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_amplification(t, filt_idx=0, amp_arr=None)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

get_astrometry(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_centroid_shift(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the photometric filter or data set.

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

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

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

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

y_obsarray_like

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

x_err_obsarray_like

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

y_err_obsarray_like

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

filt_idxint, optional

The index of the astrometric filter or data set.

Returns:
chi2array_like

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

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

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

Parameters:
tarray_like

List of times in MJD for the observations.

mag_obsarray_like

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

mag_err_obsarray_like

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

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
chi2array_like

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

get_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, amp_arr=None)

Get the photometry for each of the lensed source images.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
mag_modelarray_like

Magnitude of the unresolved microlensing event at t.

Other Parameters:
amp_arrarray_like

Amplifications of each individual image at each time, i.e. amp_arr.shape = (len(t), number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

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

The amplification for the + and - lensed images.

get_resolved_astrometry(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_resolved_astrometry_outline(t, filt_idx=0)

Get the delta-x, delta-y astrometry for each of the two lensed source images and all the associated outline points for each. The two lensed source images are labeled plus and minus.

These are relative offsets from the lens (at origin) in units of thetaE. (xS - xL) / thetaE

Returns:
u_lensed_resolved_outlinenumpy array

Vector position of the plus and minus images. shape = [len(t), self.n_outline, [+,-], [E,N]] where the last axis contains East and North positions.

get_source_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

Separation vector in East, North on the sky in units of theta_E.

get_u_outline(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline. Positions are on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
uarray, float, shape = [len(t), n_outline, [E, N]]

Separation vector in East, North on the sky in units of theta_E.

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

Bases: ModelClassABC, FSPL_Phot, FSPL_noParallax, FSPL_PhotParam1

Point source point lens model for microlensing photometry only. This model includes the relative proper motion between the lens and the source. Parameters are reduced with the use of piRel (rather than dL and dS) and muRel (rather than muL and muS). Same as PSPL_PhotParam1.

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 in days.

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

radiusS: float

Apparent radius on the sky of the source star (in thetaE).

b_sff: numpy array or list

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

mag_src: numpy array or list

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

n_outline: int (optional)

Number of boundary points to use when approximating the source outline. Calculation time scales approximately linearly with ‘n_outline’.

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_all_arrays_CI(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_all_arrays_amg(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_amplification(t[, filt_idx, amp_arr])

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

get_astrometry(t[, filt_idx])

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

get_astrometry_unlensed(t[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

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

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

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

get_chi2_photometry(t, mag_obs, mag_err_obs)

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

get_lens_astrometry(t[, filt_idx])

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

get_lnL_constant(err_obs)

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

get_photometry(t[, filt_idx, amp_arr])

Get the photometry for each of the lensed source images.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

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

get_resolved_astrometry_outline(t[, filt_idx])

Get the delta-x, delta-y astrometry for each of the two lensed source images and all the associated outline points for each.

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

get_u_outline(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline.

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.

cent

detJac

get_all_arrays

im_pos1

Notes

Note

Required parameters if calculating with parallax

  • raL: Right ascension of the lens in decimal degrees.

  • decL: Declination of the lens in decimal degrees.

  • obsLocation: 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).

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

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_all_arrays_amg(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Adaptive mesh grid creates more boundary points around the source only when it enters the Einstein ring.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_amplification(t, filt_idx=0, amp_arr=None)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

get_astrometry(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_centroid_shift(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the photometric filter or data set.

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

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

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

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

y_obsarray_like

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

x_err_obsarray_like

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

y_err_obsarray_like

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

filt_idxint, optional

The index of the astrometric filter or data set.

Returns:
chi2array_like

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

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

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

Parameters:
tarray_like

List of times in MJD for the observations.

mag_obsarray_like

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

mag_err_obsarray_like

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

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
chi2array_like

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

get_lens_astrometry(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

Position of the lens on the sky (arcsec).

get_lnL_constant(err_obs)

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

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

List of the uncertainties.

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

Get the photometry for each of the lensed source images.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
mag_modelarray_like

Magnitude of the unresolved microlensing event at t.

Other Parameters:
amp_arrarray_like

Amplifications of each individual image at each time, i.e. amp_arr.shape = (len(t), number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

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

The amplification for the + and - lensed images.

get_resolved_astrometry(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_resolved_astrometry_outline(t, filt_idx=0)

Get the delta-x, delta-y astrometry for each of the two lensed source images and all the associated outline points for each. The two lensed source images are labeled plus and minus.

These are relative offsets from the lens (at origin) in units of thetaE. (xS - xL) / thetaE

Returns:
u_lensed_resolved_outlinenumpy array

Vector position of the plus and minus images. shape = [len(t), self.n_outline, [+,-], [E,N]] where the last axis contains East and North positions.

get_source_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

Separation vector in East, North on the sky in units of theta_E.

get_u_outline(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline. Positions are on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
uarray, float, shape = [len(t), n_outline, [E, N]]

Separation vector in East, North on the sky in units of theta_E.

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

Bases: ModelClassABC, FSPL_Phot, FSPL_Parallax, FSPL_PhotParam2

Point source point lens model for microlensing photometry only. This model includes the relative proper motion between the lens and the source. Parameters are reduced with the use of piRel (rather than dL and dS) and muRel (rather than muL and muS). Same as PSPL_PhotParam1, except fits for mag_base instead of mag_src.

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 in days.

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

radiusS: float

Apparent radius on the sky of the source star (in thetaE).

b_sff: numpy array or list

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

mag_base: numpy array or list

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

n_outline: int (optional)

Number of boundary points to use when approximating the source outline. Calculation time scales approximately linearly with ‘n_outline’.

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_all_arrays_CI(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_all_arrays_amg(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_amplification(t[, filt_idx, amp_arr])

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

get_astrometry(t[, filt_idx])

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

get_astrometry_unlensed(t[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

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

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

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

get_chi2_photometry(t, mag_obs, mag_err_obs)

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

get_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, amp_arr])

Get the photometry for each of the lensed source images.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

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

get_resolved_astrometry_outline(t[, filt_idx])

Get the delta-x, delta-y astrometry for each of the two lensed source images and all the associated outline points for each.

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

get_u_outline(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline.

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.

cent

detJac

get_all_arrays

im_pos1

start

Notes

Note

Required parameters if calculating with parallax

  • raL: Right ascension of the lens in decimal degrees.

  • decL: Declination of the lens in decimal degrees.

  • obsLocation: 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).

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

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_all_arrays_amg(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Adaptive mesh grid creates more boundary points around the source only when it enters the Einstein ring.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_amplification(t, filt_idx=0, amp_arr=None)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

get_astrometry(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_centroid_shift(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the photometric filter or data set.

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

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

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

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

y_obsarray_like

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

x_err_obsarray_like

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

y_err_obsarray_like

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

filt_idxint, optional

The index of the astrometric filter or data set.

Returns:
chi2array_like

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

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

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

Parameters:
tarray_like

List of times in MJD for the observations.

mag_obsarray_like

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

mag_err_obsarray_like

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

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
chi2array_like

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

get_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, amp_arr=None)

Get the photometry for each of the lensed source images.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
mag_modelarray_like

Magnitude of the unresolved microlensing event at t.

Other Parameters:
amp_arrarray_like

Amplifications of each individual image at each time, i.e. amp_arr.shape = (len(t), number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

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

The amplification for the + and - lensed images.

get_resolved_astrometry(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_resolved_astrometry_outline(t, filt_idx=0)

Get the delta-x, delta-y astrometry for each of the two lensed source images and all the associated outline points for each. The two lensed source images are labeled plus and minus.

These are relative offsets from the lens (at origin) in units of thetaE. (xS - xL) / thetaE

Returns:
u_lensed_resolved_outlinenumpy array

Vector position of the plus and minus images. shape = [len(t), self.n_outline, [+,-], [E,N]] where the last axis contains East and North positions.

get_source_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

Separation vector in East, North on the sky in units of theta_E.

get_u_outline(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline. Positions are on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
uarray, float, shape = [len(t), n_outline, [E, N]]

Separation vector in East, North on the sky in units of theta_E.

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

Bases: ModelClassABC, FSPL_Phot, FSPL_noParallax, FSPL_PhotParam2

Point source point lens model for microlensing photometry only. This model includes the relative proper motion between the lens and the source. Parameters are reduced with the use of piRel (rather than dL and dS) and muRel (rather than muL and muS). Same as PSPL_PhotParam1, except fits for mag_base instead of mag_src.

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 in days.

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

radiusS: float

Apparent radius on the sky of the source star (in thetaE).

b_sff: numpy array or list

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

mag_base: numpy array or list

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

n_outline: int (optional)

Number of boundary points to use when approximating the source outline. Calculation time scales approximately linearly with ‘n_outline’.

Methods

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

Produces animation of microlensing event.

calc_piE_ecliptic([filt_idx])

Not supported on this object.

get_all_arrays_CI(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_all_arrays_amg(t[, filt_idx])

Obtain the image and amplitude arrays for each t.

get_amplification(t[, filt_idx, amp_arr])

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

get_astrometry(t[, filt_idx])

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

get_astrometry_unlensed(t[, filt_idx])

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

get_centroid_shift(t[, filt_idx])

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

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

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

get_chi2_photometry(t, mag_obs, mag_err_obs)

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

get_lens_astrometry(t[, filt_idx])

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

get_lnL_constant(err_obs)

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

get_photometry(t[, filt_idx, amp_arr])

Get the photometry for each of the lensed source images.

get_resolved_amplification(t[, filt_idx])

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

get_resolved_astrometry(t[, filt_idx])

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

get_resolved_astrometry_outline(t[, filt_idx])

Get the delta-x, delta-y astrometry for each of the two lensed source images and all the associated outline points for each.

get_source_astrometry_unlensed(t[, filt_idx])

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

get_u(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

get_u_outline(t[, filt_idx])

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline.

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.

cent

detJac

get_all_arrays

im_pos1

Notes

Note

Required parameters if calculating with parallax

  • raL: Right ascension of the lens in decimal degrees.

  • decL: Declination of the lens in decimal degrees.

  • obsLocation: 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).

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

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_all_arrays_amg(t, filt_idx=0)

Obtain the image and amplitude arrays for each t. These arrays contain the positions for each point in the outline for each lensed image.

Adaptive mesh grid creates more boundary points around the source only when it enters the Einstein ring.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
imagesarray_like

Array/tuple of positions of each lensed image at each t. Shape = [len(t), n_images=2, [E,N]] The last axis contains East and North positions on the sky in arcseconds.

amp_arrarray_like

Array/tuple of amplification of each lensed image at each t. Shape = [len(t), n_images=2]

Notes

The algorithm uses Green’s theorem to change an area integral of the image of the source into a path integral around the outline. For the amplification, we perform a first-order contour integral to approximate the area, and include a second-order parabolic correction. For the centroid calculation, we perform only the first-order contour integral with no second-order parabolic correction. Equations for the contour integrals come from Bozza et al. (2021).

get_amplification(t, filt_idx=0, amp_arr=None)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

get_astrometry(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_centroid_shift(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the photometric filter or data set.

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

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

Parameters:
tarray_like

List of times in MJD for the observations.

x_obsarray_like

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

y_obsarray_like

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

x_err_obsarray_like

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

y_err_obsarray_like

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

filt_idxint, optional

The index of the astrometric filter or data set.

Returns:
chi2array_like

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

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

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

Parameters:
tarray_like

List of times in MJD for the observations.

mag_obsarray_like

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

mag_err_obsarray_like

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

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
chi2array_like

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

get_lens_astrometry(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

Position of the lens on the sky (arcsec).

get_lnL_constant(err_obs)

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

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

List of the uncertainties.

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

Get the photometry for each of the lensed source images.

Parameters:
tarray_like

Array of times to model.

filt_idxint, optional

Index of the photometric filter or data set.

Returns:
mag_modelarray_like

Magnitude of the unresolved microlensing event at t.

Other Parameters:
amp_arrarray_like

Amplifications of each individual image at each time, i.e. amp_arr.shape = (len(t), number of images at each t).

This will over-ride t; but is more efficient when calculating both photometry and astrometry. If None, then just use t.

get_resolved_amplification(t, filt_idx=0)

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

Parameters:
tarray_like

Array of times in MJD.DDD

filt_idxint, optional

Index of the astrometric filter or data set.

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

The amplification for the + and - lensed images.

get_resolved_astrometry(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

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

get_resolved_astrometry_outline(t, filt_idx=0)

Get the delta-x, delta-y astrometry for each of the two lensed source images and all the associated outline points for each. The two lensed source images are labeled plus and minus.

These are relative offsets from the lens (at origin) in units of thetaE. (xS - xL) / thetaE

Returns:
u_lensed_resolved_outlinenumpy array

Vector position of the plus and minus images. shape = [len(t), self.n_outline, [+,-], [E,N]] where the last axis contains East and North positions.

get_source_astrometry_unlensed(t, filt_idx=0)

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

Parameters:
tarray_like

Time (in MJD).

filt_idxint, optional

Index of the astrometric filter or data set.

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

The unlensed positions of the source in arcseconds.

get_u(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

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

Separation vector in East, North on the sky in units of theta_E.

get_u_outline(t, filt_idx=0)

Get the separation vector, vec{u}(t), which is the unlensed source - lens separation vector for each point of the source outline. Positions are on the plane of the sky in units of theta_E.

Parameters:
tarray, float

Times in MJD at which to evaluate the separation.

filt_idxint, optional

Index of the astrometric filter or data set.

Returns:
uarray, float, shape = [len(t), n_outline, [E, N]]

Separation vector in East, North on the sky in units of theta_E.

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.