MulensModel package

Subpackages

Submodules

Module contents

class MulensModel.BinaryLens(mass_1=None, mass_2=None, separation=None)

Bases: object

The binary lens equation - its solutions, images, parities, magnifications, etc.

The binary lens equation is a 5th order complex polynomial.

Attributes :
mass_1: float

mass of the primary (left-hand object) as a fraction of the total mass.

mass_2: float

mass of the secondary (right-hand object) as a fraction of the total mass.

separation: float

separation between the two bodies as a fraction of the Einstein ring.

Note: mass_1 and mass_2 may be defined as a fraction of some other mass than the total mass. This is possible but not recommended - make sure you know what you’re doing before you start using this possibility.

point_source_magnification(source_x, source_y)

Calculate point source magnification for given position. The origin of the coordinate system is at the center of mass and both masses are on X axis with higher mass at negative X; this means that the higher mass is at (X, Y)=(-s*q/(1+q), 0) and the lower mass is at (s/(1+q), 0).

Parameters :
source_x: float

X-axis coordinate of the source.

source_y: float

Y-axis coordinate of the source.

Returns :
magnification: float

Point source magnification.

hexadecapole_magnification(source_x, source_y, rho, gamma, quadrupole=False, all_approximations=False)

Magnification in hexadecapole approximation of the binary-lens/finite-source event - based on Gould 2008 ApJ 681, 1593.

For coordinate system convention see point_source_magnification()

Parameters :
source_x: float

X-axis coordinate of the source.

source_y: float

Y-axis coordinate of the source.

rho: float

Source size relative to Einstein ring radius.

gamma: float

Linear limb-darkening coefficient in gamma convention.

quadrupole: boolean, optional

Return quadrupole approximation instead of hexadecapole? Default is False.

all_approximations: boolean, optional

Return hexadecapole, quadrupole, and point source approximations? Default is False.

Returns :
magnification: float or sequence of three floats

Hexadecapole approximation (float) by default. Quadrupole approximation (float) if quadrupole parameter is True. Hexadecapole, quadrupole, and point source approximations (sequence of three floats) if all_approximations parameter is True.

adaptive_contouring_magnification(source_x, source_y, rho, gamma=None, u_limb_darkening=None, accuracy=0.1, ld_accuracy=0.001)

Binary lens finite source magnification calculated using Adaptive Contouring method by Dominik 2007 MNRAS, 377, 1679

See also AdaptiveContouring website by Martin Dominik

For coordinate system convention see point_source_magnification()

Parameters :
source_x: float

X-axis coordinate of the source.

source_y: float

Y-axis coordinate of the source.

rho: float

Source size relative to Einstein ring radius.

gamma: float, optional

Linear limb-darkening coefficient in gamma convention.

u_limb_darkening: float

Linear limb-darkening coefficient in u convention. Note that either gamma or u_limb_darkening can be set. If neither of them is provided then limb darkening is ignored.

accuracy: float, optional

Requested accuracy of the result defined as the sum of the area of the squares that determine the contour line and the estimated total enclosed area (see sec. 4 of the paper). As M. Dominik states: “this vastly overestimates the fractional error, and a suitable value should be chosen by testing how its variation affects the final results - I recommend starting at acc = 0.1.” It significantly affects execution time.

ld_accuracy: float, optional

Requested limb-darkening accuracy. As M. Dominik states: ” Fractional uncertainty for the adaptive Simpson integration of the limb-darkening profile-related function during application of Green’s theorem.” It does not add execution time so can be set to very small value.

Returns :
magnification: float

Magnification.

vbbl_magnification(source_x, source_y, rho, gamma=None, u_limb_darkening=None, accuracy=0.001)

Binary lens finite source magnification calculated using VBBL library that implements advanced contour integration algorithm presented by Bozza 2010 MNRAS, 408, 2188. See also VBBL website by Valerio Bozza.

For coordinate system convention see point_source_magnification()

Parameters :
source_x: float

X-axis coordinate of the source.

source_y: float

Y-axis coordinate of the source.

rho: float

Source size relative to Einstein ring radius.

gamma: float, optional

Linear limb-darkening coefficient in gamma convention.

u_limb_darkening: float

Linear limb-darkening coefficient in u convention. Note that either gamma or u_limb_darkening can be set. If neither of them is provided then limb darkening is ignored.

accuracy: float, optional

Requested accuracy of the result.

Returns :
magnification: float

Magnification.