Magnification Model¤
Light curve for the binary lens with adaptive contour integration and point sorce approximation.
microlux.binary_mag(t_0, u_0, t_E, rho, q, s, alpha_deg, times: jnp.ndarray, tol=0.01, retol=0.001, default_strategy: Tuple[int] = (30, 30, 60, 120, 240), analytic: bool = True, return_info: bool = False, limb_darkening_coeff: float | None = None)
¤
Compute the light curve of a binary lens system with finite source effects. This function will dynamically choose full contour integration or point source approximation based on the quadrupole test.
Note
The coordinate system is consistent with the MulensModel(Center of mass).
Warning
Currently, to deal with limb-darkening effect, we only use 10 annuli which are uniformly distributed in terms of the area, which is not in an adaptive scheme. So the tolerance of the limb darkening effect is not guaranteed.
Parameters
t_0
: The time of the peak of the microlensing event.u_0
: The impact parameter of the source trajectory.t_E
: The Einstein crossing time.rho
: The source radius normalized to the Einstein radius.q
: The planet to host mass ratio of the binary lens system.s
: The projected separation of the binary lens system normalized to the Einstein radius.alpha_deg
: The angle between the source trajectory and the binary axis in degrees.times
: The times at which to compute the model.tol
: The tolerance for the adaptive contour integration. Defaults to 1e-2.retol
: The relative tolerance for the adaptive contour integration. Defaults to 0.001.default_strategy
: The default strategy for the contour integration. Defaults to (30, 30, 60, 120, 240). more details can be found in themicrolux.contour_integral
.analytic
: Whether to use the analytic chain rule to simplify the computation graph. Set this to True will accelerate the computation of the gradient and will support the reverse mode differentiation containing the while loop. But set this to True will slow down if only calculate the model without differentiation. Defaults to True.return_info
: Whether to return additional information about the computation. Defaults to False.limb_darkening_coeff
: The limb darkening coefficient for the source star. Defaults to None. currently only support linear limb darkening.
Returns
magnification
: The magnification of the source at the given times.info
: Additional information about the computation used for debugging if return_info is True.
Light curve with point source approximation.
microlux.point_light_curve(trajectory_l, s, q, rho, tol, return_num: bool = False)
¤
Calculate the point source light curve.
Parameters
trajectory_l
: The trajectory of the lensing event.s
: The projected separation between the lens and the source.q
: The mass ratio between the lens and the source.rho
: The source radius in units of the Einstein radius.tol
: The absolute tolerance for the quadrupole test.return_num
: Whether to return the number of real roots. Defaults to False.
Returns
result
: A tuple containing:- The magnification array.
- A boolean array indicating the validity of the calculation. If the quadrupole test is passed, the corresponding element in the boolean array is
True
. - If
return_num
isTrue
, the tuple will also contain the number of real roots.
cond
: A boolean array indicating whether the quadrupole test is passed.True
means the quadrupole test is passed.mask
: An integer array indicating the number of real roots.
Adaptive contour integration for the light curve.
microlux.extended_light_curve(trajectory_l, s, q, rho, tol=0.01, retol=0.001, default_strategy: Tuple[int] = (30, 30, 60, 120, 240), analytic: bool = True, return_info: bool = False, limb_darkening: AbstractLimbDarkening | None = None, n_annuli: int = 10)
¤
compute the light curve of a binary lens system with finite source effects.
Parameters
trajectory_l
: The trajectory in the low mass coordinate system.n_annuli
: The number of annuli for the limb darkening calculation.- for the definition of the other parameters, please see
microlux.binary_mag
.
Adaptive contour integration for the single epoch.
microlux.contour_integral(trajectory_l, tol, retol, rho, s, q, default_strategy=(60, 80, 150), analytic=True) -> Tuple[jnp.ndarray, Tuple]
¤
Perform adaptive contour integration with pre-define shaped array. This function is used to reduce the memory usage and improve the performance of the contour integration. The reason is that the optimal fixed array length is hard to determine before the code runs which the basic requirement for JIT compilation. If the array length is too small, the adaptive contour integration will stop early and the error will be larger than the tolerance. If the array length is too large, it will cause the waste of memory and time. This waste is linear with the array length. So we use this pre-define shaped array to solve this problem.
Parameters
- For other parameters: please see at
microlux.binary_mag
default_strategy
: The default strategy for the contour integration. The array length will be added gradually according to this strategy. For example, if the default_strategy is (60, 80, 150), the array length in each layer will be 60, 140, 290, respectively.analytic
: Whether to use the analytic chain rule to simplify the computation graph. Set this to True will accelerate the computation of the gradient and will support the reverse mode differentiation containing the while loop. But set this to True will slow down if only calculate the model without differentiation. Defaults to True.
Returns
result
: A tuple containing the magnitude and the result of the contour integration.