PSBL Model Classes
PSBL Photometry + Astrometry with Static Lens Secondary
- class model.PSBL_PhotAstrom_Par_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstromParam1Point source binary lens. Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0float
Time of photometric peak, as seen from Earth (MJD.DDD)
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas). Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens system proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens system proper motion in the Dec. direction (mas/yr)
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source (pc)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. If they are both dark, then dmag_Lp_Ls=0 and b_sff=1. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_Param2(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstromParam2Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0float
Time of photometric peak, as seen from Earth (MJD.DDD)
- u0_ampfloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_Lp_Ls should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. If they are both dark, then dmag_Lp_Ls=0 and b_sff=1. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_Param3(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstromParam3Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0float
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_ampfloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tEfloat
Einstein crossing time (days).
- log10_thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_Param4(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstromParam4Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_comfloat
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_amp_comfloat
Angular distance between the source and the binary lens COM 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_Param5(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstromParam5Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_primfloat
Time of closest approach between source and primary lens (MJD.DDD).
- u0_amp_primfloat
Angular distance between the source and the PRIMARY lens 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piEN_piEEfloat
The ratio of piE_E / piE_N.
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas).
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_Param7(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstromParam7Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0_pfloat
Time of closest approach between source and PRIMARY LENS (MJD.DDD)
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- beta_pfloat
Angular distance between the source and the PRIMARY LENS of the lenses on the plane of the sky (mas) at t0. Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens system proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens system proper motion in the Dec. direction (mas/yr)
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source (pc)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstromParam1Point source binary lens. Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0float
Time of photometric peak, as seen from Earth (MJD.DDD)
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas). Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens system proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens system proper motion in the Dec. direction (mas/yr)
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source (pc)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. If they are both dark, then dmag_Lp_Ls=0 and b_sff=1. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_Param2(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstromParam2Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0float
Time of photometric peak, as seen from Earth (MJD.DDD)
- u0_ampfloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_Lp_Ls should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. If they are both dark, then dmag_Lp_Ls=0 and b_sff=1. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_Param3(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstromParam3Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0float
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_ampfloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tEfloat
Einstein crossing time (days).
- log10_thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_Param4(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstromParam4Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_comfloat
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_amp_comfloat
Angular distance between the source and the binary lens COM 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
PSBL Photometry Only, Static Lens Secondary
- class model.PSBL_Phot_noPar_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSBL_Phot,PSBL_noParallax,PSBL_PhotParam1Point source binary lens, photometry only.
- It has 3 more parameters than PSPL_PhotParam1:
mass ratio
separation – in units of thetaE
angle of approach
Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0: float
Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.
- u0_amp: float
Angular distance between the lens and source on the plane of the sky at closest approach in units of thetaE. It can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tE: float
Einstein crossing time based on the system mass. [MJD]
- piE_E: float
The microlensing parallax in the East direction in units of thetaE
- piE_N: float
The microlensing parallax in the North direction in units of thetaE
- q: float
Mass ratio (low-mass / high-mass)
- sep: float
Angular separation of the two lenses in units of thetaE where thetaE is defined with the total binary mass.
- phi: float
Angle made between the binary axis and the relative proper motion vector, measured in degrees.
- b_sff: 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: 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Get the astrometry for the foreground lens at the input times.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in Einstein radii.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source images.
get_source_astrometry_unlensed(t[, filt_idx])Get the astrometry of the source alone if there was no gravitational lensing and no lens.
get_u(t[, filt_idx])Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
log_likely_astrometry(t, x, y, xerr, yerr[, ...])Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_astrometry_each(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_photometry(t, mag_obs, mag_err_obs)Get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.
log_likely_photometry_each(t, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
get_me_some_orbital_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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Note, this is a photometry only model, so units are in Einstein radii.
- Returns:
- xS_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- filt_idxint, optional
Filter index.
- xS_unlensednumpy array, dtype=float,
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers.
This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position as an array of complex numbers with real = east component, imaginary = north component
- z1complex array
Lens primary component position as an array of complex numbers with real = east component, imaginary = north component
- z2complex array
Lens secondary component position as an array of complex numbers with real = east component, imaginary = north component
- filt_idxint, optional
Filter index.
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- 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
Filter index.
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in Einstein radii.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Filter index.
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source alone if there was no gravitational lensing and no lens. Note, this is a photometry only model, so units are in Einstein radii.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- xS_unlensednumpy array, dtype=float,
Notes
Note
Note that this is a photometry-only model, so units are in Einstein radii.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- log_likely_astrometry(t, x, y, xerr, yerr, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_photometry(t, mag_obs, mag_err_obs, filt_idx=0)
Get the summed natural log of the likelihood for the input photometric data for the specified filter or data set. Note, this function returns the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Lfloat
ln(likelihood) summed over the photometric measurement
- log_likely_photometry_each(t, mag_obs, mag_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_Phot_Par_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSBL_Phot,PSBL_Parallax,PSBL_PhotParam1Point source binary lens, photometry only.
- It has 3 more parameters than PSPL_PhotParam1:
mass ratio
separation – in units of thetaE
angle of approach
Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0: float
Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.
- u0_amp: float
Angular distance between the lens and source on the plane of the sky at closest approach in units of thetaE. It can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tE: float
Einstein crossing time based on the system mass. [MJD]
- piE_E: float
The microlensing parallax in the East direction in units of thetaE
- piE_N: float
The microlensing parallax in the North direction in units of thetaE
- q: float
Mass ratio (low-mass / high-mass)
- sep: float
Angular separation of the two lenses in units of thetaE where thetaE is defined with the total binary mass.
- phi: float
Angle made between the binary axis and the relative proper motion vector, measured in degrees.
- b_sff: 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: 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Get the astrometry for the foreground lens at the input times.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in Einstein radii.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source images.
get_source_astrometry_unlensed(t[, filt_idx])Get the astrometry of the source alone if there was no gravitational lensing and no lens.
get_u(t[, filt_idx])Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
log_likely_astrometry(t, x, y, xerr, yerr[, ...])Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_astrometry_each(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_photometry(t, mag_obs, mag_err_obs)Get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.
log_likely_photometry_each(t, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
get_me_some_orbital_parameters
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event.
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.
- Parameters:
- filt_idxint, optional
Index of the astrometric filter or data set.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Note, this is a photometry only model, so units are in Einstein radii.
- Returns:
- xS_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- filt_idxint, optional
Filter index.
- xS_unlensednumpy array, dtype=float,
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers.
This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position as an array of complex numbers with real = east component, imaginary = north component
- z1complex array
Lens primary component position as an array of complex numbers with real = east component, imaginary = north component
- z2complex array
Lens secondary component position as an array of complex numbers with real = east component, imaginary = north component
- filt_idxint, optional
Filter index.
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- 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
Filter index.
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in Einstein radii.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Filter index.
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source alone if there was no gravitational lensing and no lens. Note, this is a photometry only model, so units are in Einstein radii.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- xS_unlensednumpy array, dtype=float,
Notes
Note
Note that this is a photometry-only model, so units are in Einstein radii.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- log_likely_astrometry(t, x, y, xerr, yerr, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_photometry(t, mag_obs, mag_err_obs, filt_idx=0)
Get the summed natural log of the likelihood for the input photometric data for the specified filter or data set. Note, this function returns the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Lfloat
ln(likelihood) summed over the photometric measurement
- log_likely_photometry_each(t, mag_obs, mag_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
PSBL Photometry + Astrometry, with GP
- class model.PSBL_PhotAstrom_Par_GP_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSPL_GP,PSBL_PhotAstrom,PSBL_Parallax,PSBL_GP_PhotAstromParam1Point source binary lens. Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0float
Time of photometric peak, as seen from Earth (MJD.DDD)
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas). Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens system proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens system proper motion in the Dec. direction (mas/yr)
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source (pc)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. If they are both dark, then dmag_Lp_Ls=0 and b_sff=1. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_celerite_gp_object(mag_err_obs[, filt_idx])Returns a celerite GP object that is used for all GP operations
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
get_lnL_constant(err_obs)Get the natural log of the constant normalization terms of the likelihood.
get_log_det_covariance(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
get_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source images.
get_photometry_with_gp(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
log_likely_astrometry(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_astrometry_each(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_photometry(t, mag_obs, mag_err_obs)For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.
log_likely_photometry_each(t, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_celerite_gp_object(mag_err_obs, filt_idx=0)
Returns a celerite GP object that is used for all GP operations
- Parameters:
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. The mean of mag_err_obs is inputted into the jitter term of the kernel if ‘gp_log_jit_sigma’ is not a parameter.
- filt_idxinteger
An integer indicating which photometric data set should be used for the GP.
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Returns:
- gpa celerite GP object
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- get_lnL_constant(err_obs)
Get the natural log of the constant normalization terms of the likelihood.
\[-0.5 * \ln{2 \pi \sigma_{obs}^2}\]- Parameters:
- err_obsarray_like
List of the uncertainties.
- Returns:
- List of ln(likelihood constants).
- get_log_det_covariance(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- get_photometry(t, filt_idx=0, 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_photometry_with_gp(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Parameters:
- tarray_like
List of times in MJD for the observations. These times are used as input to the GP. If t_pred is not specified, then t_pred = t.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- t_predarray_like, optional
List of times in MJD on which to evalute the model. If t_pred is not specified, then t_pred = t.
- Returns:
- mag_modelarray_like
Magnitude of the unresolved microlensing event at t. This is the “predictive mean” of the GP.
- mag_model_stdarray_like
Standard deviation of the magnitude of the unresolved microlensing event at t. This comes from the diagonal (the varainces) of the “predictive covariance” of the GP.
- get_resolved_amplification(t, filt_idx=0)
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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- log_likely_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_photometry(t, mag_obs, mag_err_obs, filt_idx=0)
For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set. Note, this function returns the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Lfloat
ln(likelihood) summed over the photometric measurement
Note
The GP will only be used for filters where use_gp_phot[filt_idx] = True.
- log_likely_photometry_each(t, mag_obs, mag_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_GP_Param2(*args, **kwargs)
Bases:
ModelClassABC,PSPL_GP,PSBL_PhotAstrom,PSBL_Parallax,PSBL_GP_PhotAstromParam2Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0float
Time of photometric peak, as seen from Earth (MJD.DDD)
- u0_ampfloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_Lp_Ls should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. If they are both dark, then dmag_Lp_Ls=0 and b_sff=1. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_celerite_gp_object(mag_err_obs[, filt_idx])Returns a celerite GP object that is used for all GP operations
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
get_lnL_constant(err_obs)Get the natural log of the constant normalization terms of the likelihood.
get_log_det_covariance(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
get_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source images.
get_photometry_with_gp(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
log_likely_astrometry(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_astrometry_each(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_photometry(t, mag_obs, mag_err_obs)For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.
log_likely_photometry_each(t, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_celerite_gp_object(mag_err_obs, filt_idx=0)
Returns a celerite GP object that is used for all GP operations
- Parameters:
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. The mean of mag_err_obs is inputted into the jitter term of the kernel if ‘gp_log_jit_sigma’ is not a parameter.
- filt_idxinteger
An integer indicating which photometric data set should be used for the GP.
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Returns:
- gpa celerite GP object
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- get_lnL_constant(err_obs)
Get the natural log of the constant normalization terms of the likelihood.
\[-0.5 * \ln{2 \pi \sigma_{obs}^2}\]- Parameters:
- err_obsarray_like
List of the uncertainties.
- Returns:
- List of ln(likelihood constants).
- get_log_det_covariance(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- get_photometry(t, filt_idx=0, 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_photometry_with_gp(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Parameters:
- tarray_like
List of times in MJD for the observations. These times are used as input to the GP. If t_pred is not specified, then t_pred = t.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- t_predarray_like, optional
List of times in MJD on which to evalute the model. If t_pred is not specified, then t_pred = t.
- Returns:
- mag_modelarray_like
Magnitude of the unresolved microlensing event at t. This is the “predictive mean” of the GP.
- mag_model_stdarray_like
Standard deviation of the magnitude of the unresolved microlensing event at t. This comes from the diagonal (the varainces) of the “predictive covariance” of the GP.
- get_resolved_amplification(t, filt_idx=0)
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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- log_likely_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_photometry(t, mag_obs, mag_err_obs, filt_idx=0)
For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set. Note, this function returns the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Lfloat
ln(likelihood) summed over the photometric measurement
Note
The GP will only be used for filters where use_gp_phot[filt_idx] = True.
- log_likely_photometry_each(t, mag_obs, mag_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_GP_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSPL_GP,PSBL_PhotAstrom,PSBL_noParallax,PSBL_GP_PhotAstromParam1Point source binary lens. Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0float
Time of photometric peak, as seen from Earth (MJD.DDD)
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas). Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens system proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens system proper motion in the Dec. direction (mas/yr)
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source (pc)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. If they are both dark, then dmag_Lp_Ls=0 and b_sff=1. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_celerite_gp_object(mag_err_obs[, filt_idx])Returns a celerite GP object that is used for all GP operations
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
get_lnL_constant(err_obs)Get the natural log of the constant normalization terms of the likelihood.
get_log_det_covariance(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
get_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source images.
get_photometry_with_gp(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
log_likely_astrometry(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_astrometry_each(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_photometry(t, mag_obs, mag_err_obs)For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.
log_likely_photometry_each(t, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_celerite_gp_object(mag_err_obs, filt_idx=0)
Returns a celerite GP object that is used for all GP operations
- Parameters:
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. The mean of mag_err_obs is inputted into the jitter term of the kernel if ‘gp_log_jit_sigma’ is not a parameter.
- filt_idxinteger
An integer indicating which photometric data set should be used for the GP.
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Returns:
- gpa celerite GP object
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- get_lnL_constant(err_obs)
Get the natural log of the constant normalization terms of the likelihood.
\[-0.5 * \ln{2 \pi \sigma_{obs}^2}\]- Parameters:
- err_obsarray_like
List of the uncertainties.
- Returns:
- List of ln(likelihood constants).
- get_log_det_covariance(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- get_photometry(t, filt_idx=0, 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_photometry_with_gp(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Parameters:
- tarray_like
List of times in MJD for the observations. These times are used as input to the GP. If t_pred is not specified, then t_pred = t.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- t_predarray_like, optional
List of times in MJD on which to evalute the model. If t_pred is not specified, then t_pred = t.
- Returns:
- mag_modelarray_like
Magnitude of the unresolved microlensing event at t. This is the “predictive mean” of the GP.
- mag_model_stdarray_like
Standard deviation of the magnitude of the unresolved microlensing event at t. This comes from the diagonal (the varainces) of the “predictive covariance” of the GP.
- get_resolved_amplification(t, filt_idx=0)
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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- log_likely_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_photometry(t, mag_obs, mag_err_obs, filt_idx=0)
For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set. Note, this function returns the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Lfloat
ln(likelihood) summed over the photometric measurement
Note
The GP will only be used for filters where use_gp_phot[filt_idx] = True.
- log_likely_photometry_each(t, mag_obs, mag_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_GP_Param2(*args, **kwargs)
Bases:
ModelClassABC,PSPL_GP,PSBL_PhotAstrom,PSBL_noParallax,PSBL_GP_PhotAstromParam2Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0float
Time of photometric peak, as seen from Earth (MJD.DDD)
- u0_ampfloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_Lp_Ls should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. If they are both dark, then dmag_Lp_Ls=0 and b_sff=1. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_celerite_gp_object(mag_err_obs[, filt_idx])Returns a celerite GP object that is used for all GP operations
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
get_lnL_constant(err_obs)Get the natural log of the constant normalization terms of the likelihood.
get_log_det_covariance(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
get_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source images.
get_photometry_with_gp(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
log_likely_astrometry(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_astrometry_each(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_photometry(t, mag_obs, mag_err_obs)For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.
log_likely_photometry_each(t, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_celerite_gp_object(mag_err_obs, filt_idx=0)
Returns a celerite GP object that is used for all GP operations
- Parameters:
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. The mean of mag_err_obs is inputted into the jitter term of the kernel if ‘gp_log_jit_sigma’ is not a parameter.
- filt_idxinteger
An integer indicating which photometric data set should be used for the GP.
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Returns:
- gpa celerite GP object
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- get_lnL_constant(err_obs)
Get the natural log of the constant normalization terms of the likelihood.
\[-0.5 * \ln{2 \pi \sigma_{obs}^2}\]- Parameters:
- err_obsarray_like
List of the uncertainties.
- Returns:
- List of ln(likelihood constants).
- get_log_det_covariance(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- get_photometry(t, filt_idx=0, 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_photometry_with_gp(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Parameters:
- tarray_like
List of times in MJD for the observations. These times are used as input to the GP. If t_pred is not specified, then t_pred = t.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- t_predarray_like, optional
List of times in MJD on which to evalute the model. If t_pred is not specified, then t_pred = t.
- Returns:
- mag_modelarray_like
Magnitude of the unresolved microlensing event at t. This is the “predictive mean” of the GP.
- mag_model_stdarray_like
Standard deviation of the magnitude of the unresolved microlensing event at t. This comes from the diagonal (the varainces) of the “predictive covariance” of the GP.
- get_resolved_amplification(t, filt_idx=0)
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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- log_likely_astrometry(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_photometry(t, mag_obs, mag_err_obs, filt_idx=0)
For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set. Note, this function returns the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Lfloat
ln(likelihood) summed over the photometric measurement
Note
The GP will only be used for filters where use_gp_phot[filt_idx] = True.
- log_likely_photometry_each(t, mag_obs, mag_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
PSBL Photometry-Only, with GP
- class model.PSBL_Phot_Par_GP_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSPL_GP,PSBL_Phot,PSBL_Parallax,PSBL_GP_PhotParam1Point source binary lens, photometry only.
- It has 3 more parameters than PSPL_PhotParam1:
mass ratio
separation – in units of thetaE
angle of approach
Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0: float
Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.
- u0_amp: float
Angular distance between the lens and source on the plane of the sky at closest approach in units of thetaE. It can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tE: float
Einstein crossing time based on the system mass. [MJD]
- piE_E: float
The microlensing parallax in the East direction in units of thetaE
- piE_N: float
The microlensing parallax in the North direction in units of thetaE
- q: float
Mass ratio (low-mass / high-mass)
- sep: float
Angular separation of the two lenses in units of thetaE where thetaE is defined with the total binary mass.
- phi: float
Angle made between the binary axis and the relative proper motion vector, measured in degrees.
- b_sff: 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: 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_celerite_gp_object(mag_err_obs[, filt_idx])Returns a celerite GP object that is used for all GP operations
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Get the astrometry for the foreground lens at the input times.
get_lens_photometry([filt_idx])Get the combined lens photometry.
get_lnL_constant(err_obs)Get the natural log of the constant normalization terms of the likelihood.
get_log_det_covariance(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
get_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source images.
get_photometry_with_gp(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
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[, image_arr, ...])Position of the observed source position in Einstein radii.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source images.
get_source_astrometry_unlensed(t[, filt_idx])Get the astrometry of the source alone if there was no gravitational lensing and no lens.
get_u(t[, filt_idx])Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
log_likely_astrometry(t, x, y, xerr, yerr[, ...])Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_astrometry_each(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_photometry(t, mag_obs, mag_err_obs)For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.
log_likely_photometry_each(t, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
get_me_some_orbital_parameters
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event.
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Get piE_ecliptic, the microlensing parallax vector in the ecliptic coorindate system.
- Parameters:
- filt_idxint, optional
Index of the astrometric filter or data set.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Note, this is a photometry only model, so units are in Einstein radii.
- Returns:
- xS_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- filt_idxint, optional
Filter index.
- xS_unlensednumpy array, dtype=float,
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_celerite_gp_object(mag_err_obs, filt_idx=0)
Returns a celerite GP object that is used for all GP operations
- Parameters:
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. The mean of mag_err_obs is inputted into the jitter term of the kernel if ‘gp_log_jit_sigma’ is not a parameter.
- filt_idxinteger
An integer indicating which photometric data set should be used for the GP.
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Returns:
- gpa celerite GP object
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers.
This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position as an array of complex numbers with real = east component, imaginary = north component
- z1complex array
Lens primary component position as an array of complex numbers with real = east component, imaginary = north component
- z2complex array
Lens secondary component position as an array of complex numbers with real = east component, imaginary = north component
- filt_idxint, optional
Filter index.
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- 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
Filter index.
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- get_lnL_constant(err_obs)
Get the natural log of the constant normalization terms of the likelihood.
\[-0.5 * \ln{2 \pi \sigma_{obs}^2}\]- Parameters:
- err_obsarray_like
List of the uncertainties.
- Returns:
- List of ln(likelihood constants).
- get_log_det_covariance(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- get_photometry(t, filt_idx=0, 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_photometry_with_gp(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Parameters:
- tarray_like
List of times in MJD for the observations. These times are used as input to the GP. If t_pred is not specified, then t_pred = t.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- t_predarray_like, optional
List of times in MJD on which to evalute the model. If t_pred is not specified, then t_pred = t.
- Returns:
- mag_modelarray_like
Magnitude of the unresolved microlensing event at t. This is the “predictive mean” of the GP.
- mag_model_stdarray_like
Standard deviation of the magnitude of the unresolved microlensing event at t. This comes from the diagonal (the varainces) of the “predictive covariance” of the GP.
- get_resolved_amplification(t, filt_idx=0)
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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in Einstein radii.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Filter index.
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source alone if there was no gravitational lensing and no lens. Note, this is a photometry only model, so units are in Einstein radii.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- xS_unlensednumpy array, dtype=float,
Notes
Note
Note that this is a photometry-only model, so units are in Einstein radii.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- log_likely_astrometry(t, x, y, xerr, yerr, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_photometry(t, mag_obs, mag_err_obs, filt_idx=0)
For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set. Note, this function returns the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Lfloat
ln(likelihood) summed over the photometric measurement
Note
The GP will only be used for filters where use_gp_phot[filt_idx] = True.
- log_likely_photometry_each(t, mag_obs, mag_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_Phot_noPar_GP_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSPL_GP,PSBL_Phot,PSBL_noParallax,PSBL_GP_PhotParam1Point source binary lens, photometry only.
- It has 3 more parameters than PSPL_PhotParam1:
mass ratio
separation – in units of thetaE
angle of approach
Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0: float
Time (MJD.DDD) of closest projected approach between source and lens as seen in Solar System barycentric coordinates. This should be close, but not exactly aligned with the photometric peak, as seen from Earth or a Solar System satellite.
- u0_amp: float
Angular distance between the lens and source on the plane of the sky at closest approach in units of thetaE. It can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tE: float
Einstein crossing time based on the system mass. [MJD]
- piE_E: float
The microlensing parallax in the East direction in units of thetaE
- piE_N: float
The microlensing parallax in the North direction in units of thetaE
- q: float
Mass ratio (low-mass / high-mass)
- sep: float
Angular separation of the two lenses in units of thetaE where thetaE is defined with the total binary mass.
- phi: float
Angle made between the binary axis and the relative proper motion vector, measured in degrees.
- b_sff: 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: 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_celerite_gp_object(mag_err_obs[, filt_idx])Returns a celerite GP object that is used for all GP operations
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Get the astrometry for the foreground lens at the input times.
get_lens_photometry([filt_idx])Get the combined lens photometry.
get_lnL_constant(err_obs)Get the natural log of the constant normalization terms of the likelihood.
get_log_det_covariance(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
get_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source images.
get_photometry_with_gp(t, mag_obs, mag_err_obs)Returns photometry with GP noise added in.
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[, image_arr, ...])Position of the observed source position in Einstein radii.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source images.
get_source_astrometry_unlensed(t[, filt_idx])Get the astrometry of the source alone if there was no gravitational lensing and no lens.
get_u(t[, filt_idx])Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
log_likely_astrometry(t, x, y, xerr, yerr[, ...])Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_astrometry_each(t, x_obs, y_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_photometry(t, mag_obs, mag_err_obs)For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set.
log_likely_photometry_each(t, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
get_me_some_orbital_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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Note, this is a photometry only model, so units are in Einstein radii.
- Returns:
- xS_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- filt_idxint, optional
Filter index.
- xS_unlensednumpy array, dtype=float,
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_celerite_gp_object(mag_err_obs, filt_idx=0)
Returns a celerite GP object that is used for all GP operations
- Parameters:
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. The mean of mag_err_obs is inputted into the jitter term of the kernel if ‘gp_log_jit_sigma’ is not a parameter.
- filt_idxinteger
An integer indicating which photometric data set should be used for the GP.
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Returns:
- gpa celerite GP object
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers.
This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position as an array of complex numbers with real = east component, imaginary = north component
- z1complex array
Lens primary component position as an array of complex numbers with real = east component, imaginary = north component
- z2complex array
Lens secondary component position as an array of complex numbers with real = east component, imaginary = north component
- filt_idxint, optional
Filter index.
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- 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
Filter index.
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- get_lnL_constant(err_obs)
Get the natural log of the constant normalization terms of the likelihood.
\[-0.5 * \ln{2 \pi \sigma_{obs}^2}\]- Parameters:
- err_obsarray_like
List of the uncertainties.
- Returns:
- List of ln(likelihood constants).
- get_log_det_covariance(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- get_photometry(t, filt_idx=0, 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_photometry_with_gp(t, mag_obs, mag_err_obs, filt_idx=0, t_pred=None)
Returns photometry with GP noise added in.
Note
This will throw an error if this is a filter with use_gp_phot[filt_idx] = False.
- Parameters:
- tarray_like
List of times in MJD for the observations. These times are used as input to the GP. If t_pred is not specified, then t_pred = t.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. These values are used as input to the GP. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- t_predarray_like, optional
List of times in MJD on which to evalute the model. If t_pred is not specified, then t_pred = t.
- Returns:
- mag_modelarray_like
Magnitude of the unresolved microlensing event at t. This is the “predictive mean” of the GP.
- mag_model_stdarray_like
Standard deviation of the magnitude of the unresolved microlensing event at t. This comes from the diagonal (the varainces) of the “predictive covariance” of the GP.
- get_resolved_amplification(t, filt_idx=0)
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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in Einstein radii.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Filter index.
Notes
Note
Note, this is a photometry only model, so units are in Einstein radii.
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source alone if there was no gravitational lensing and no lens. Note, this is a photometry only model, so units are in Einstein radii.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- xS_unlensednumpy array, dtype=float,
Notes
Note
Note that this is a photometry-only model, so units are in Einstein radii.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- log_likely_astrometry(t, x, y, xerr, yerr, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_astrometry_each(t, x_obs, y_obs, x_err_obs, y_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function eturns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each astrometric measurement.
- log_likely_photometry(t, mag_obs, mag_err_obs, filt_idx=0)
For models that include a Gaussian Process, get the summed natural log of the likelihood for the input photometric data for the specified filter or data set. Note, this function returns the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Lfloat
ln(likelihood) summed over the photometric measurement
Note
The GP will only be used for filters where use_gp_phot[filt_idx] = True.
- log_likely_photometry_each(t, mag_obs, mag_err_obs, filt_idx=0)
Get the natural log of the likelihood for the input photometric data in the specified filter or data sets. Note, this function returns a list and it is the full ln(likelihood), including the normalization constant.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t.
- mag_err_obsarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
PSBL Photometry + Astrometry, Linear Secondary Lens Motion
- class model.PSBL_PhotAstrom_Par_LinOrbs_Param6(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_LinOrbs_Param6Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_primfloat
Time of projected closest approach between the source and the primary lens (before parallax is applied and in the SSB frame).
- u0_amp_primfloat
Angular distance between the source and the PRIMARY lens 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas).
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_LinOrbs_Param7(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_LinOrbs_Param7Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0_pfloat
Time of closest approach between source and PRIMARY LENS (MJD.DDD)
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- beta_pfloat
Angular distance between the source and the PRIMARY LENS of the lenses on the plane of the sky (mas) at t0. Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens system proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens system proper motion in the Dec. direction (mas/yr)
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source (pc)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_LinOrbs_Param6(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_LinOrbs_Param6Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_primfloat
Time of projected closest approach between the source and the primary lens (before parallax is applied and in the SSB frame).
- u0_amp_primfloat
Angular distance between the source and the PRIMARY lens 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas).
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_LinOrbs_Param7(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_LinOrbs_Param7Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0_pfloat
Time of closest approach between source and PRIMARY LENS (MJD.DDD)
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- beta_pfloat
Angular distance between the source and the PRIMARY LENS of the lenses on the plane of the sky (mas) at t0. Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens system proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens system proper motion in the Dec. direction (mas/yr)
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source (pc)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
PSBL Photometry + Astrometry, Accelerating Secondary Lens Motion
- class model.PSBL_PhotAstrom_Par_AccOrbs_Param6(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_AccOrbs_Param6Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_primfloat
Time of projected closest approach between the source and the primary lens (before parallax is applied and in the SSB frame).
- u0_amp_primfloat
Angular distance between the source and the PRIMARY lens 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas).
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_AccOrbs_Param7(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_AccOrbs_Param7Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0_pfloat
Time of closest approach between source and PRIMARY LENS (MJD.DDD)
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- beta_pfloat
Angular distance between the source and the PRIMARY LENS of the lenses on the plane of the sky (mas) at t0. Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens system proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens system proper motion in the Dec. direction (mas/yr)
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source (pc)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_AccOrbs_Param6(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_AccOrbs_Param6Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_primfloat
Time of projected closest approach between the source and the primary lens (before parallax is applied and in the SSB frame).
- u0_amp_primfloat
Angular distance between the source and the PRIMARY lens 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas).
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_AccOrbs_Param7(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_AccOrbs_Param7Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0_pfloat
Time of closest approach between source and PRIMARY LENS (MJD.DDD)
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- beta_pfloat
Angular distance between the source and the PRIMARY LENS of the lenses on the plane of the sky (mas) at t0. Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens system proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens system proper motion in the Dec. direction (mas/yr)
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source (pc)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
PSBL Photometry + Astrometry, Circular Orbits for Lens
- class model.PSBL_PhotAstrom_Par_CircOrbs_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_CircOrbs_Param1Point source binary lens. Note that this is a non-STATIC binary lens, i.e. there is orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0_comfloat
Time of closest approach between the source and binary lens system’s COM
- xS0_Efloat
R.A. of source position on the sky at t = t0_com (arcseconds) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on the sky at t = t0_com (arcseconds) in an arbitrary ref. frame.
- beta_com: float
Angular distance between the source and the CoM of the lenses on the plane of the sky (mas). Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens System proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens System proper motion in the Dec. direction (mas/yr)
- omega_pri: float
The argument of periastron of the primary lens’s orbit in degrees. omega_sec = omega_pri + 180 deg
- big_omega_sec: float
The longitude of the ascending node of the secondary lens’s orbit in degrees.
- i: float
The inclination angle of the system in degrees.
- e: float
The eccentricity of the System
- tp: float
This is the time of the periastron of the system in days.
- a: float
The semi-major axis of the binary system; but in mas. This is actually lens system semi-major axis / distance to lens.
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source’s CoM (pc)
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_CircOrbs_Param3(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_CircOrbs_Param3Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0float
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_ampfloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tEfloat
Einstein crossing time (days).
- log10_thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_CircOrbs_Param4(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_CircOrbs_Param4Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_comfloat
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_amp_comfloat
Angular distance between the source and the binary lens COM 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_CircOrbs_Param8(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_CircOrbs_Param8Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_comfloat
Time of closest approach between the source and the center of mass of the lens system (before parallax is applied, in the SSB frame).
- u0_amp_comfloat
Angular distance between the source and the binary lens COM 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).
- tEfloat
Einstein crossing time (days).
- log10_thetaEfloat
The log of the size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas).
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_CircOrbs_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_CircOrbs_Param1Point source binary lens. Note that this is a non-STATIC binary lens, i.e. there is orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0_comfloat
Time of closest approach between the source and binary lens system’s COM
- xS0_Efloat
R.A. of source position on the sky at t = t0_com (arcseconds) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on the sky at t = t0_com (arcseconds) in an arbitrary ref. frame.
- beta_com: float
Angular distance between the source and the CoM of the lenses on the plane of the sky (mas). Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens System proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens System proper motion in the Dec. direction (mas/yr)
- omega_pri: float
The argument of periastron of the primary lens’s orbit in degrees. omega_sec = omega_pri + 180 deg
- big_omega_sec: float
The longitude of the ascending node of the secondary lens’s orbit in degrees.
- i: float
The inclination angle of the system in degrees.
- e: float
The eccentricity of the System
- tp: float
This is the time of the periastron of the system in days.
- a: float
The semi-major axis of the binary system; but in mas. This is actually lens system semi-major axis / distance to lens.
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source’s CoM (pc)
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_CircOrbs_Param3(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_CircOrbs_Param3Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0float
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_ampfloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tEfloat
Einstein crossing time (days).
- log10_thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_CircOrbs_Param4(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_CircOrbs_Param4Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_comfloat
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_amp_comfloat
Angular distance between the source and the binary lens COM 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_CircOrbs_Param8(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_CircOrbs_Param8Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_comfloat
Time of closest approach between the source and the center of mass of the lens system (before parallax is applied, in the SSB frame).
- u0_amp_comfloat
Angular distance between the source and the binary lens COM 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).
- tEfloat
Einstein crossing time (days).
- log10_thetaEfloat
The log of the size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas).
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
PSBL Photometry + Astrometry, Elliptical Orbits for Lens
- class model.PSBL_PhotAstrom_Par_EllOrbs_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_EllOrbs_Param1Point source binary lens. Note that this is a non-STATIC binary lens, i.e. there is orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0_comfloat
Time of closest approach between the source and binary lens system’s COM
- xS0_Efloat
R.A. of source position on the sky at t = t0_com (arcseconds) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on the sky at t = t0_com (arcseconds) in an arbitrary ref. frame.
- beta_com: float
Angular distance between the source and the CoM of the lenses on the plane of the sky (mas). Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens System proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens System proper motion in the Dec. direction (mas/yr)
- omega_pri: float
The argument of periastron of the primary lens’s orbit in degrees. omega_sec = omega_pri + 180 deg
- big_omega_sec: float
The longitude of the ascending node of the secondary lens’s orbit in degrees.
- i: float
The inclination angle of the system in degrees.
- e: float
The eccentricity of the System
- tp: float
This is the time of the periastron of the system in days.
- a: float
The semi-major axis of the binary system; but in mas. This is actually lens system semi-major axis / distance to lens.
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source’s CoM (pc)
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_EllOrbs_Param3(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_EllOrbs_Param3Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0float
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_ampfloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tEfloat
Einstein crossing time (days).
- log10_thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_EllOrbs_Param4(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_EllOrbs_Param4Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_comfloat
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_amp_comfloat
Angular distance between the source and the binary lens COM 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_Par_EllOrbs_Param8(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_Parallax,PSBL_PhotAstrom_EllOrbs_Param8Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_comfloat
Time of closest approach between the source and the center of mass of the lens system (before parallax is applied, in the SSB frame).
- u0_amp_comfloat
Angular distance between the source and the binary lens COM 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).
- tEfloat
Einstein crossing time (days).
- log10_thetaEfloat
The log of the size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas).
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
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_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
start
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- 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(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- 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_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_EllOrbs_Param1(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_EllOrbs_Param1Point source binary lens. Note that this is a non-STATIC binary lens, i.e. there is orbital motion.
- Attributes:
- mLp, mLsfloat
Masses of the lenses (Msun)
- t0_comfloat
Time of closest approach between the source and binary lens system’s COM
- xS0_Efloat
R.A. of source position on the sky at t = t0_com (arcseconds) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on the sky at t = t0_com (arcseconds) in an arbitrary ref. frame.
- beta_com: float
Angular distance between the source and the CoM of the lenses on the plane of the sky (mas). Can be
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- muL_Efloat
Lens System proper motion in the RA direction (mas/yr)
- muL_Nfloat
Lens System proper motion in the Dec. direction (mas/yr)
- omega_pri: float
The argument of periastron of the primary lens’s orbit in degrees. omega_sec = omega_pri + 180 deg
- big_omega_sec: float
The longitude of the ascending node of the secondary lens’s orbit in degrees.
- i: float
The inclination angle of the system in degrees.
- e: float
The eccentricity of the System
- tp: float
This is the time of the periastron of the system in days.
- a: float
The semi-major axis of the binary system; but in mas. This is actually lens system semi-major axis / distance to lens.
- muS_Efloat
Source proper motion in the RA direction (mas/yr)
- muS_Nfloat
Source proper motion in the Dec. direction (mas/yr)
- dLfloat
Distance from the observer to the lens system (pc)
- dSfloat
Distance from the observer to the source’s CoM (pc)
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_EllOrbs_Param3(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_EllOrbs_Param3Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0float
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_ampfloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky at closest approach in units of thetaE. Can
positive (u0_amp > 0 when u0_hat[0] > 0) or
negative (u0_amp < 0 when u0_hat[0] < 0).
- tEfloat
Einstein crossing time (days).
- log10_thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_EllOrbs_Param4(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_EllOrbs_Param4Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_comfloat
Time of projected closest approach between the source and the geometric center of the lens system (before parallax is applied and in the SSB frame).
- u0_amp_comfloat
Angular distance between the source and the binary lens COM 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).
- tEfloat
Einstein crossing time (days).
- thetaEfloat
The size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
\(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_basenumpy 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.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.
- class model.PSBL_PhotAstrom_noPar_EllOrbs_Param8(*args, **kwargs)
Bases:
ModelClassABC,PSBL_PhotAstrom,PSBL_noParallax,PSBL_PhotAstrom_EllOrbs_Param8Point source binary lens. It has 3 more parameters than PSPL (additional mass term, separation, and angle of approach). Note that this is a STATIC binary lens, i.e. there is no orbital motion.
- Attributes:
- t0_comfloat
Time of closest approach between the source and the center of mass of the lens system (before parallax is applied, in the SSB frame).
- u0_amp_comfloat
Angular distance between the source and the binary lens COM 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).
- tEfloat
Einstein crossing time (days).
- log10_thetaEfloat
The log of the size of the Einstein radius in (mas).
- piSfloat
Amplitude of the parallax (1AU/dS) of the source. (mas)
- piE_Efloat
The microlensing parallax in the East direction in units of thetaE
- piE_Nfloat
The microlensing parallax in the North direction in units of thetaE
- xS0_Efloat
R.A. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- xS0_Nfloat
Dec. of source position on sky at t = t0 (arcsec) in an arbitrary ref. frame.
- muS_Efloat
RA Source proper motion (mas/yr)
- muS_Nfloat
Dec Source proper motion (mas/yr)
- betafloat
Angular distance between the source and the GEOMETRIC center of the lenses on the plane of the sky (mas).
- qfloat
Mass ratio (M2 / M1)
- sepfloat
Angular separation of the two lenses (mas)
- alphafloat
Angle made between the binary axis and North; measured in degrees East of North.
- b_sffnumpy array or list
The ratio of the source flux to the total (source + neighbors + lenses). One for each filter.
- mag_srcnumpy array or list
Source magnitude, unlensed. One in each filter.
- dmag_Lp_Lsnumpy array or list
Magnitude difference of lens primary - lens secondary. If the primary lens is dark, then dmag_L1_L2 should be set to 20 (or some other large, positive number). If the secondary lens 2 is dark, then it should be set to -20. Note, in astrometric filters, we assume all the excess flux (i.e. 1 - b_sff) comes from the lenses, not any neighbors.
- 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’])
- root_tolfloat
Tolerance in comparing the polynomial roots to the physical solutions. Default = 1e-8
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(t[, filt_idx, check_sols, ...])Obtain the lensed image and amplitude arrays for each t.
get_amp_arr(z_arr, z1, z2)Calculations amplification array
get_amplification(t[, amp_arr, filt_idx])Get the photometric amplification term at a set of times, t.
get_astrometry(t[, image_arr, amp_arr, filt_idx])Position of the observed (unresolved) source + lens position in arcsec.
get_astrometry_unlensed(t[, filt_idx])Get the unresolved astrometry of the source and lens if there was no gravitational lensing.
get_caustics(t[, N_pts, amp_inv])Get the caustic in the source plane generated by the binary lens system.
get_centroid_shift(t[, amp_arr, image_arr, ...])PSBL: 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_complex_pos(t[, filt_idx])Get the positions of the lenses and source as complex numbers.
get_critical_curves(t[, N_pts, amp_inv])Get the critical curve in the lens plane generated by the binary lens system.
get_image_pos_arr(w, z1, z2, m1, m2[, ...])Gets image positions.
get_image_pos_arr_old(w, z1, z2[, check_sols])Gets image positions.
get_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_origin_astrometry(t[, filt_idx])Equation of motion for just the foreground lens system.
get_lens_photometry([filt_idx])Get the combined lens photometry.
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[, image_arr, ...])Position of the observed source position in arcsec.
get_resolved_lens_astrometry(t[, filt_idx])Equation of motion for just the foreground lenses, individually.
get_resolved_lens_photometry([filt_idx])Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors).
get_resolved_photometry(t[, filt_idx, amp_arr])Get the photometry for each of the lensed source 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 unlensed, relative astrometry of the source and lens in units of the Einstein radius.
lens_map(t, z)Gets source plane position from lens plane position via the lens map.
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.
rescale_complex_pos(w, z1, z2)Make sure everything is roughly centered on the origin in a 1 x 1 box.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry, filt_idx=0)
Produces animation of microlensing event. This function takes the PSPL and makes an animation, the input variables are as follows
- Parameters:
- tE:
- number of einstein crossings times before/after the peak you want the animation to plot
e.g tE = 2 => graph will go from -2 tE to 2 tE
- time_steps:
number of time steps before/after peak, so total number of time steps will be 2 times this value
- frame_time:
times in ms of each frame in the animation
- name: string
the animation will be saved as name.html
- size: list
[horizontal, vertical] cm’s
- zoom:
# of einstein radii plotted in vertical direction
- calc_piE_ecliptic(filt_idx=0)
Not supported on this object.
- get_all_arrays(t, filt_idx=0, check_sols=True, rescale=True)
Obtain the lensed image and amplitude arrays for each t.
- 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 complex positions of each lensed image at each t.
- amp_arrarray_like
Array/tuple of amplification of each images at each t.
- get_amp_arr(z_arr, z1, z2)
Calculations amplification array
Calculates the amplification A from the Jacobian J, \(A = 1/|J|\)
- Parameters:
- z_arrarray_like
- Complex position of images.
Shape = [N_times, N_solutions, 1]– note this could be jagged. - z1array_like
Complex position(s) of lens 1 (primary).
Shape = [N_times, 1]- z2array_like
Complex position(s) of lens 2 (secondary).
Shape = [N_times, 1]
- Returns:
- amp_arrarray_like
BLEH
- get_amplification(t, amp_arr=None, filt_idx=0)
Get the photometric amplification term at a set of times, t.
- Parameters:
- t: float or array
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 + lens position in arcsec. This accounts for the source magnification and the contamination by any luminous lens. Note: we assume no other luminous neighbors.
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t.
- 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 for the astrometry.
- get_astrometry_unlensed(t, filt_idx=0)
Get the unresolved astrometry of the source and lens if there was no gravitational lensing. Parallax is included. 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_caustics(t, N_pts=2000, amp_inv=0)
Get the caustic in the source plane generated by the binary lens system. Casutics in units of thetaE. Plot using plot_models.plot_caustics().
- Parameters:
- tfloat
Time to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- Returns:
- w_arrarray_like
Complex positions of caustic points in the source plane. Shape = [N_pts, 4]
- get_centroid_shift(t, amp_arr=None, image_arr=None, filt_idx=0)
PSBL: Get the centroid shift (in mas) for a list of observation times (in MJD).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- Centroid offset on the plane of the sky in arcseoncds.
- Other Parameters:
- image_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- amp_arrlist
List returned from PSPL get_all_arrays() used to improve efficiency.
- filt_idxint
Index into the photometry parameter lists for the photometry that corresponds to this astrometry 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_complex_pos(t, filt_idx=0)
Get the positions of the lenses and source as complex numbers. This is needed for further calculations. Note that all units are still the same as before, this is just rewriting vectors \(z = (x,y)\) as \(z = x + iy\).
- Parameters:
- tarray_like
Array of times to model.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- wcomplex array
Source position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times, N_sources].
- z1complex array
Lens primary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- z2complex array
Lens secondary component position (arcsec) as an array of complex numbers with real = east component, imaginary = north component shape = [N_times]
- get_critical_curves(t, N_pts=2000, amp_inv=0.0)
Get the critical curve in the lens plane generated by the binary lens system. Critical curves in units of thetaE. Plot using plot_models.plot_critical_curves().
- Parameters:
- tfloat
Times to model.
- N_ptsint, optional
Number of points to sample along the critical curve.
- amp_invfloat, optional
Reciprocal amplification of points in the lens plane with parity; 0.0 corresponds to points along the critical curve (i.e. infinite amplification)
- Returns:
- z_arrarray_like
Complex positions of critical curve points in the lens plane which satisfy |m1/(z - z1)**2 + m2/(z - z2)**2| = sqrt(1 - amp_inv). Shape = [N_times, N_pts, 4]
- get_image_pos_arr(w, z1, z2, m1, m2, check_sols=True)
Gets image positions.
Solve the fifth-order polynomial and get the image positions.See PSBL writeup for full equations.All angular distances are in arcsec.- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- m1float
- m2float
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_image_pos_arr_old(w, z1, z2, check_sols=True)
Gets image positions. | Solve the fifth-order polynomial and get the image positions. | See PSBL writeup for full equations. | All angular distances are in arcsec.
- Parameters:
- warray_like
Complex position(s) of the source. Shape = [N_times, 1]
- z1array_like
Complex position(s) of lens 1 (primary). Shape = [N_times, 1]
- z2array_like
Complex position(s) of lens 2 (secondary). Shape = [N_times, 1]
- check_solsbool, optional
If True, calculated roots are checked against the lens equation, and output will only contain those within self.root_tol. If False, all calculated roots are returned.
- Returns:
- z_arrarray_like
Position of the lensed source images. Rank-1 array of polynomial roots, possibly complex. If check_sols = True, only roots solving the lens equation are returned.
- get_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_origin_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lens system. This returns the lens-system origin motion (not the observed flux-weighted centroid).
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xLarray_like, shape = [N_times, 2 directions]
Position of the lens system (geometric center) over time.
- get_lens_photometry(filt_idx=0)
Get the combined lens photometry.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_Lfloat
Magnitude of the combined primary (L1) and secondary (L2) lens brightness.
- 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, image_arr=None, amp_arr=None, filt_idx=0)
Position of the observed source position in arcsec.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t.
- 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, optional
Index of the photometric filter or data set.
- get_resolved_lens_astrometry(t, filt_idx=0)
Equation of motion for just the foreground lenses, individually.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- xL1array_like, shape = [N_times, 2 directions]
Position of the lens primary (arcsec)
- xL2array_like, shape = [N_times, 2 directions]
Position of the lens secondary (arcsec)
- get_resolved_lens_photometry(filt_idx=0)
Get the resolved lens photometry, assuming that all the non-source light comes from the lens (and not neighbors). We split the light amongst the lenses based on the input lens flux ratio quantities.
- Parameters:
- filt_idxint, optional
Filter index.
- Returns:
- mag_L1, mag_L2float, float
Magnitude of the primary lens (L1) and the secondary lens (L2).
- 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.
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of each lensed image centroid at t. Shape = [5, len(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_source_astrometry_unlensed(t, filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. The returned array is in arcsec and has a shape of [len(t), 2] where the second dimension includes [RA, Dec] positions in arcsec.
- Parameters:
- tarray_like
Time (in MJD).
- filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = [len(t), 2]
The unlensed positions of the source in arcseconds.
- get_u(t, filt_idx=0)
Get the unlensed, relative astrometry of the source and lens in units of the Einstein radius.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- u_unlensednumpy array, dtype=float,
shape = len(t) x 2 The unlensed positions of the source in Einstein radii.
- u_unlensednumpy array, dtype=float,
- lens_map(t, z)
Gets source plane position from lens plane position via the lens map.
- Parameters:
- tarray_like
Times to model. Shape = [N_times, 1]
- zarray_like
Complex position(s) of objects in the lens plane. Shape = [N_times, N_positions]
- Returns:
- w_arrarray_like
Corresponding complex position(s) of objects in the source plane. Shape = [N_times, N_positions]
- 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.
- rescale_complex_pos(w, z1, z2)
Make sure everything is roughly centered on the origin in a 1 x 1 box.