Data Class Family
- class model.BSPL
Bases:
PSPLMethods
animate(tE, time_steps, frame_time, name, ...)Produces animation of microlensing event.
get_amplification(t[, filt_idx])Parallax: Get the photometric amplification term at a set of times, t.
get_chi2_photometry(t_obs, 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_lnL_constant(err_obs)Get the natural log of the constant normalization terms of the likelihood.
get_photometry(t[, filt_idx, print_warning])Get the predicted photomety at the specified times for the specified photometric filter or data set.
Parallax: Get the photometric amplification term at a set of times, t for both the plus and minus images.
get_u(t)- Parameters:
log_likely_photometry(t_obs, mag_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_obs, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry)
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
- get_amplification(t, filt_idx=0)
Parallax: Get the photometric amplification term at a set of times, t.
Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is
..math:
A = (f1 * A1 + f2 * A2) / (f1 + f2)
where the fluxes are the intrinsic source flux in the specified filter.
- Parameters:
- t: Array of times in MJD.DDD
- Returns:
- Anumpy array
- Array of combined amplifications in the specified filter.Shape = [len(t)]
- get_chi2_photometry(t_obs, mag_obs, mag_err_obs, filt_index=0)
Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.
- Parameters:
- t_obsarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t_obs.
- mag_obs_errarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t_obs.
- 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_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, print_warning=True)
Get the predicted photomety at the specified times for the specified photometric filter or data set.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of the unresolved microlensing event at t_obs.
- Other Parameters:
- print_warningbool, optional
Print a warning in the rare case that the magnitude exceeds a zeropoint of 30 and conversions result in NaN returned.
- get_resolved_amplification(t)
Parallax: Get the photometric amplification term at a set of times, t for both the plus and minus images.
- Parameters:
- t: Array of times in MJD.DDD
- Returns:
- A_resolvednumpy array
[shape = len(t), len(sources), 2]
Notes
- For each time t and each source, we have:
A_plus is the amplification for the plus image.
A_minus is the amplification for the minus image.
- In other words,
xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.
- Similarly,
xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.
- get_u(t)
- Parameters:
- tnumpy array
Times at which to evaluate the source-lens separation.
- Returns:
- unumpy array
Shape = [len(t), 2 sources, 2 directions on sky]
- log_likely_photometry(t_obs, mag_obs, mag_err_obs, filt_index=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:
- t_obsarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t_obs.
- mag_obs_errarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t_obs.
- 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_obs, mag_obs, mag_err_obs, filt_index=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:
- t_obsarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t_obs.
- mag_obs_errarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t_obs.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.
- class model.BSPL_Phot
-
Contains methods for model a BSPL photometry only. This is a Data-type class in our hierarchy. It is abstract and should not be instantiated.
- Attributes:
- t0
- tE
- u0_amp
- u0_E
- u0_N
- piE_E:
valid only if parallax model
- piE_N:
valid only if parallax model
- piE_amp
- b_sff[#]
- mag_src[#]:
add in
- mag_base[#]:
add in
- raL:
if parallax model
- decL:
if parallax model
Methods
animate(tE, time_steps, frame_time, name, ...)Produces animation of microlensing event.
get_amplification(t[, filt_idx])Parallax: Get the photometric amplification term at a set of times, t.
get_astrometry(t[, ast_filt_idx])Position of the observed (unresolved) source position in Einstein radii.
get_astrometry_unlensed(t[, ast_filt_idx])Get the astrometry of the source if the lens didn't exist.
get_chi2_photometry(t_obs, 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_lnL_constant(err_obs)Get the natural log of the constant normalization terms of the likelihood.
get_photometry(t[, filt_idx, print_warning])Get the predicted photomety at the specified times for the specified photometric filter or data set.
Parallax: Get the photometric amplification term at a set of times, t for both the plus and minus images.
Position of the observed source position in Einstein radii.
Get the astrometry of the source if the lens didn't exist.
get_u(t)- Parameters:
log_likely_photometry(t_obs, mag_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_obs, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
get_centroid_shift
get_lens_astrometry
log_likely_astrometry
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry)
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
- get_amplification(t, filt_idx=0)
Parallax: Get the photometric amplification term at a set of times, t.
Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is
..math:
A = (f1 * A1 + f2 * A2) / (f1 + f2)
where the fluxes are the intrinsic source flux in the specified filter.
- Parameters:
- t: Array of times in MJD.DDD
- Returns:
- Anumpy array
- Array of combined amplifications in the specified filter.Shape = [len(t)]
- get_astrometry(t, ast_filt_idx=0)
Position of the observed (unresolved) source position in Einstein radii.
- Parameters:
- t: array_like
Array of times to model.
- Returns:
- model_posarray_like
Array of vector positions of the centroid at each t_obs.
- get_astrometry_unlensed(t, ast_filt_idx=0)
Get the astrometry of the source if the lens didn’t exist. Note, this is a photometry only model, so units are in Einstein radii.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = len(t_obs) x 2
The unlensed positions of the source in Einstein radii.
- get_chi2_photometry(t_obs, mag_obs, mag_err_obs, filt_index=0)
Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.
- Parameters:
- t_obsarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t_obs.
- mag_obs_errarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t_obs.
- 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_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, print_warning=True)
Get the predicted photomety at the specified times for the specified photometric filter or data set.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of the unresolved microlensing event at t_obs.
- Other Parameters:
- print_warningbool, optional
Print a warning in the rare case that the magnitude exceeds a zeropoint of 30 and conversions result in NaN returned.
- get_resolved_amplification(t)
Parallax: Get the photometric amplification term at a set of times, t for both the plus and minus images.
- Parameters:
- t: Array of times in MJD.DDD
- Returns:
- A_resolvednumpy array
[shape = len(t), len(sources), 2]
Notes
- For each time t and each source, we have:
A_plus is the amplification for the plus image.
A_minus is the amplification for the minus image.
- In other words,
xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.
- Similarly,
xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.
- get_resolved_astrometry(t)
Position of the observed source position in Einstein radii.
- Parameters:
- tarray_like, shape = [N_times]
Array of times to model.
- Returns:
- model_posarray_like. shape = [N_times, N_images, 2]
Array of vector positions of the centroid at each t_obs.
- get_resolved_astrometry_unlensed(t)
Get the astrometry of the source if the lens didn’t exist. Note, this is a photometry only model, so units are in Einstein radii.
- Returns:
- xS_resolved_unlensednumpy array, [shape = len(t_obs), N_sources, 2]
The unlensed positions of the sources in Einstein radii.
- In other words,
xS[0, 0, :] returns the 2D sky position of the first source at the first time.
- Similarly,
xS[0, 1, :] returns the 2D sky position of the second source at the first time.
- get_u(t)
- Parameters:
- tnumpy array
Times at which to evaluate the source-lens separation.
- Returns:
- unumpy array
Shape = [len(t), 2 sources, 2 directions on sky]
- log_likely_photometry(t_obs, mag_obs, mag_err_obs, filt_index=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:
- t_obsarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t_obs.
- mag_obs_errarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t_obs.
- 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_obs, mag_obs, mag_err_obs, filt_index=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:
- t_obsarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t_obs.
- mag_obs_errarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t_obs.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.
- class model.BSPL_PhotAstrom
Bases:
BSPL,PSPL_PhotAstromMethods
animate(tE, time_steps, frame_time, name, ...)Produces animation of microlensing event.
get_amplification(t[, filt_idx])Parallax: Get the photometric amplification term at a set of times, t.
get_astrometry(t[, ast_filt_idx])Parallax: Get unresolved astrometry for binary source, point lens.
get_astrometry_unlensed(t[, ast_filt_idx])Get the astrometry of the sources if the lens didn't exist.
get_centroid_shift(t[, ast_filt_idx])Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).
get_chi2_astrometry(t_obs, 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_obs, 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_lnL_constant(err_obs)Get the natural log of the constant normalization terms of the likelihood.
get_photometry(t[, filt_idx, print_warning])Get the predicted photomety at the specified times for the specified photometric filter or data set.
Parallax: Get the photometric amplification term at a set of times, t for both the plus and minus images.
Parallax: For each source, get the x, y astrometry for the two lensed source images.
Get the astrometry of the source if the lens didn't exist.
get_u(t)- Parameters:
log_likely_astrometry(t_obs, x_obs, y_obs, ...)Get the summed natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_astrometry_each(t_obs, x_obs, ...)Get the natural log of the likelihood for the input astrometric data in the specified filter or data sets.
log_likely_photometry(t_obs, mag_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_obs, mag_obs, ...)Get the natural log of the likelihood for the input photometric data in the specified filter or data sets.
- animate(tE, time_steps, frame_time, name, size, zoom, astrometry)
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
- get_amplification(t, filt_idx=0)
Parallax: Get the photometric amplification term at a set of times, t.
Note that this is a convenience function that combines amplifications from multiple sources. The returned amplification is
..math:
A = (f1 * A1 + f2 * A2) / (f1 + f2)
where the fluxes are the intrinsic source flux in the specified filter.
- Parameters:
- t: Array of times in MJD.DDD
- Returns:
- Anumpy array
- Array of combined amplifications in the specified filter.Shape = [len(t)]
- get_astrometry(t, ast_filt_idx=0)
Parallax: Get unresolved astrometry for binary source, point lens.
- Parameters:
- t:
Array of times in MJD.DDD
- Returns:
- xS_lensed
Returns flux-weighted average of lensed source positions.
- get_astrometry_unlensed(t, ast_filt_idx=0)
Get the astrometry of the sources if the lens didn’t exist.
- Returns:
- xS_unlensednumpy array, dtype=float, shape = len(t_obs) x 2 directions
- The unlensed positions of the combined sources in arcseconds.Shape = [len(t), 2 directions]
- get_centroid_shift(t, ast_filt_idx=0)
Parallax: Get the centroid shift (in mas) for a list of observation times (in MJD).
Returns the flux-weighted centroid of all the sources lensed images.
- Parameters:
- t:
Array of times in MJD.DDD
- Returns:
- centroid_shiftnumpy array
[shape = len(t), 2]
- get_chi2_astrometry(t_obs, x_obs, y_obs, x_err_obs, y_err_obs, ast_filt_idx=0)
Get the chi^2 value for this model given input astrometry data and uncertainties for the specified astrometric data set.
- Parameters:
- t_obsarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t_obs.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t_obs.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t_obs.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t_obs.
- ast_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_obs, mag_obs, mag_err_obs, filt_index=0)
Get chi^2 values for the model and input photometric data in the specified photometric filter or data set.
- Parameters:
- t_obsarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t_obs.
- mag_obs_errarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t_obs.
- 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_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, print_warning=True)
Get the predicted photomety at the specified times for the specified photometric filter or data set.
- Parameters:
- tarray_like
List of times in MJD for the observations.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- mag_modelarray_like
Magnitude of the unresolved microlensing event at t_obs.
- Other Parameters:
- print_warningbool, optional
Print a warning in the rare case that the magnitude exceeds a zeropoint of 30 and conversions result in NaN returned.
- get_resolved_amplification(t)
Parallax: Get the photometric amplification term at a set of times, t for both the plus and minus images.
- Parameters:
- t: Array of times in MJD.DDD
- Returns:
- A_resolvednumpy array
[shape = len(t), len(sources), 2]
Notes
- For each time t and each source, we have:
A_plus is the amplification for the plus image.
A_minus is the amplification for the minus image.
- In other words,
xS[0, 0, 0] returns the amplification of the first source’s “plus” image at the first time.
- Similarly,
xS[0, 0, 1] returns the amplification of the first source’s “minus” image at the first time.
- get_resolved_astrometry(t)
Parallax: For each source, get the x, y astrometry for the two lensed source images. For each source, we label the two images as plus and minus.
- Returns:
- xS_resolvednumpy array
[shape = len(t), len(sources), 2, 2]
Notes
- For each time t and each source, we have:
xS_plus is the vector position of the plus image.
xS_minus is the vector position of the minus image.
- In other words,
xS[0, 0, 0, :] returns the 2D sky position of the first source’s “plus” image at the first time.
- Similarly,
xS[0, 0, 1, :] returns the 2D sky position of the first source’s “minus” image at the first time.
- get_resolved_astrometry_unlensed(t)
Get the astrometry of the source if the lens didn’t exist.
- Returns:
- xS_resolved_unlensednumpy array, [shape = len(t_obs), N_sources, 2]
The unlensed positions of the sources in arcseconds.
- In other words,
xS[0, 0, :] returns the 2D sky position of the first source at the first time.
- Similarly,
xS[0, 1, :] returns the 2D sky position of the second source at the first time.
- get_u(t)
- Parameters:
- tnumpy array
Times at which to evaluate the source-lens separation.
- Returns:
- unumpy array
Shape = [len(t), 2 sources, 2 directions on sky]
- log_likely_astrometry(t_obs, x_obs, y_obs, x_err_obs, y_err_obs, ast_filt_idx=0)
Get the summed natural log of the likelihood for the input astrometric data in the specified filter or data sets. Note, this function returns the full ln(likelihood), including the normalization constant.
- Parameters:
- t_obsarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t_obs.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t_obs.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t_obs.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t_obs.
- ast_filt_idxint, optional
Index of the astrometric filter or data set.
- Returns:
- ln_Lfloat
The ln(likelihood) summed over all astrometric measurements.
- log_likely_astrometry_each(t_obs, x_obs, y_obs, x_err_obs, y_err_obs, ast_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:
- t_obsarray_like
List of times in MJD for the observations.
- x_obsarray_like
List of relative R.A. astrometric positions on the sky in arcsec. Length must match t_obs.
- y_obsarray_like
List of relative Dec. astrometric positions on the sky in arcsec. Length must match t_obs.
- x_err_obsarray_like
List of relative R.A. astrometric positional errors on the sky in arcsec. Length must match t_obs.
- y_err_obsarray_like
List of relative Dec. astrometric positional errors on the sky in arcsec. Length must match t_obs.
- ast_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_obs, mag_obs, mag_err_obs, filt_index=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:
- t_obsarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t_obs.
- mag_obs_errarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t_obs.
- 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_obs, mag_obs, mag_err_obs, filt_index=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:
- t_obsarray_like
List of times in MJD for the observations.
- mag_obsarray_like
List of observed photometric measurements of the microlensing event in magnitudes. Length must be the same as t_obs.
- mag_obs_errarray_like
List of observed photometric uncertainties of the microlensing event in magnitudes. Length must be the same as t_obs.
- filt_idxint, optional
Index of the photometric filter or data set.
- Returns:
- ln_Larray_like
List of ln(likelihood) for each photometric measurement.