The lens equation for a single lens is
For a given lens-source angular separation
If the source is point-like, the magnification is given by the famous Paczynski formula
In VBMicrolensing, this formula is obtained through the function PSPLMag
as follows:
VBMicrolensing VBM;
double Mag,u;
u=0.1; // Source-lens separation in Einstein radii
Mag = VBM.PSPLMag(u);
printf("PSPL Magnification = %lf", Mag); // Output should be 10.037...
For extended sources, the magnification depends on
VBMicrolensing VBM;
double Mag, u, rho;
VBM.LoadESPLTable("ESPL.tbl"); // Load the pre-calculated table (you only have to do this once)
// The ESPL.dat file is located inside the data folder; copy it to your directory.
u = 0.1; // Source-lens separation in Einstein radii
rho = 0.01; // Source radius in units of the Einstein angle
Mag = VBM.ESPLMag2(u, rho); // Call to the ESPLMag2 function with these parameters
printf("\nMagnification of Extended-source-point-lens = %lf\n", Mag); // Output should be 10.050.....
The current range for the pre-calculated table is
By default, VBMicrolensing works with uniform sources. We will introduce Limb Darkening in a later section: arbitrary Limb Darkening laws can be implemented in VBMicrolensing.
For a Point-Source, in the reference frame in which the lens is in the origin, the centroid of the images is simply
If you need astrometry calculations together with magnification, you have to turn astrometry on by VBM.astrometry = true
and read the results in VBM.astrox1
. This works in the same way for PSPLMag
and ESPLMag2
.
VBMicrolensing VBM;
double Mag,u,rho;
VBM.LoadESPLTable("ESPL.tbl"); // Load the pre-calculated table (you only have to do this once)
u = 0.1; // Source-lens separation in Einstein radii
rho = 0.01; // Source radius in units of the Einstein angle
VBM.astrometry = true; // We want astrometry
Mag = VBM.ESPLMag2(u, rho); // Call to the ESPLMag2 function with these parameters
printf("\nMagnification of Extended-source-point-lens = %lf\n", Mag); // Output should be 10.050.....
printf("\nCentroid shift = %lf\n", VBM.astrox1 - u); // Output should be 0.0493.....
Note that VBM.astrox1
reports the centroid position with respect to the lens. The centroid position with respect to the source is VBM.astrox1 - u
.