Skip to main content

Join the chat at https://gitter.im/VBBinaryLensing/Lobby

VBBinaryLensing

VBBinaryLensing is a tool for efficient computation in gravitational microlensing events using the advanced contour integration method, supporting single and binary lenses.

In particular, VBBinaryLensing is designed for the following calculations:

  • Magnification by single and binary lenses
  • Centroid of the images generated by single and binary lenses
  • Critical curves and caustics of binary lenses
  • Complete light curves including several higher order effects: limb darkening of the source, binary source, parallax, xallarap, circular and elliptic orbital motion.

The code has been developed by Valerio Bozza, University of Salerno. It is written as a C++ library and wrapped as a Python package, the user can call the code from either C++ or Python.

The root finding algorithm has been adopted from Jan Skowron & Andy Gould (http://www.astrouw.edu.pl/~jskowron/cmplx_roots_sg/) and translated to C++ by Tyler M. Heintz and Ava R. Hoag. The new Python wrapper has been created by Fran Bartolić in collaboration with Etienne Bachelet and Markus Hundertmark.

VBBinaryLensing is also adopted by several user-friendly modeling platforms for microlensing:

These platforms offer high-level frameworks for easy modeling of microlensing events. Consider using those codes if you do not want to develop your own modeling or simulation code. On the other hand, if you need direct access to basic functions to include in your own project, this is the right place for you.

A selection of recent reviews about microlensing and its applications can be found here.

Attribution

Any use of this code for scientific publications should be acknowledged by citations to the works relevant to your study:

If specifically relevant to your work, please also cite J. Skowron and A. Gould, arXiv:1203.1034.

Installation

Python

The easiest way to install VBBinaryLensing is through pip

pip install VBBinaryLensing

If you want the latest development version from Github, clone this repository and run

python setup.py install

Currently, VBBinaryLensing works on Linux, Windows, MacOS and python >= 2.7. The python package requires pybind11 which can be installed with

pip install pybind11

The package requires a C++ compiler supporting C++.

C++

If you just want to use the C++ library, clone this repository, the library files VBBinaryLensingLibrary.cpp and VBBinaryLensing.h are located in in VBBinaryLensing/lib. An example usage of the C++ code is provided in examples/cpp_examples together with a sample Makefile for compiling the library.

The package also contains the following files:

  • examples/cpp_examples/instructions.cpp - Contains working examples and specific instructions for all functions.
  • VBBinaryLensing/data/ESPL.tbl - Pre-calculated table for Extended-source-point-lens
  • VBBinaryLensing/data/OB151212coords.txt - Sample file with event coordinates
  • VBBinaryLensing/data/satellite1.txt - Sample table for satellite position (Spitzer)
  • VBBinaryLensing/data/satellite2.txt - Sample table for satellite position (Kepler)

Example usage

To check the installation, try:

>>>import VBBinaryLensing

# Initialize the VBBinaryLensing object which contains all functions 
>>>VBBL = VBBinaryLensing.VBBinaryLensing()

>>>s = 1.
>>>q = 0.02
>>>y1 = 0.5 
>>>y2 = 0.5 
>>>rho = 0.0033

# Calculate magnification for a single point in the source plane
>>>magnification = VBBL.BinaryMag2(s, q, y1, y2, rho)
>>>print(magnification)
>>>1.6310924403681109

Example Jupyter notebooks are included in examples/python_examples.

Documentation

Full documentation for the use of VBBinaryLensing in C++ is available. This can be a good reference also for Python users.

Furthermore, the vast majority of functions are documented with Python docstrings which can be accessed as, for example, ?VBBL.BinaryMag2() in a Jupyter notebook.

Note that the python wrapper does not support the user-defined limb-darkening law.

License

VBBinaryLensing is freely available to the community under the GNU Lesser General Public License Version 3 included in this repository.

Metadata

Release files for VBBinaryLensing 3.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for VBBinaryLensing 3.7.0
File Size Uploaded
VBBinaryLensing-3.7.0.tar.gz 508.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for VBBinaryLensing 3.7.0
File Interpreter ABI Platform
VBBinaryLensing-3.7.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details

Total release size: 1.2 MB

Release files / VBBinaryLensing-3.7.0.tar.gz

Download URL VBBinaryLensing-3.7.0.tar.gz
Size 508.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a23536248d6df0eaa7b871ae153e3942b6ff83829be43ee84485636a7b6689cb
BLAKE2b-256 checksum
How to use checksums
0e187fde5067b7a127e039befb2364f29a221eedc3aeed485929679182114d07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release files / VBBinaryLensing-3.7.0-cp311-cp311-win_amd64.whl

Download URL VBBinaryLensing-3.7.0-cp311-cp311-win_amd64.whl
Size 655.3 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
8afee24997d8613032e0acf6cab66e4bfe9f171a2095f010a3e204fdd8bf3470
BLAKE2b-256 checksum
How to use checksums
239643cc2a8c88d50e3c702342d63a08a5ba244d38703f79e4e9005ebe821343
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.8

Release history Release notifications | RSS feed

This release

3.7.0 This release

2 release files

3.6.2

1 release file

3.6.1

1 release file

3.6.0

1 release file

3.5.0

1 release file

3.4.0

1 release file

3.3.0

2 release files

3.2.0

2 release files

3.0.0

2 release files

2.0.8

1 release file

2.0.7

1 release file

2.0.6

1 release file

2.0.5

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page