Skip to main content

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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

VBBinaryLensing-3.7.0.tar.gz (508.2 kB view details)

Uploaded Source

Built Distribution

VBBinaryLensing-3.7.0-cp311-cp311-win_amd64.whl (655.3 kB view details)

Uploaded CPython 3.11 Windows x86-64

File details

Details for the file VBBinaryLensing-3.7.0.tar.gz.

File metadata

  • Download URL: VBBinaryLensing-3.7.0.tar.gz
  • Upload date:
  • Size: 508.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for VBBinaryLensing-3.7.0.tar.gz
Algorithm Hash digest
SHA256 a23536248d6df0eaa7b871ae153e3942b6ff83829be43ee84485636a7b6689cb
MD5 4ba0a8a5a03901b7a9ca6a5ed9d9d541
BLAKE2b-256 0e187fde5067b7a127e039befb2364f29a221eedc3aeed485929679182114d07

See more details on using hashes here.

File details

Details for the file VBBinaryLensing-3.7.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for VBBinaryLensing-3.7.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8afee24997d8613032e0acf6cab66e4bfe9f171a2095f010a3e204fdd8bf3470
MD5 122130daa9a58355a4e23fc6830bee84
BLAKE2b-256 239643cc2a8c88d50e3c702342d63a08a5ba244d38703f79e4e9005ebe821343

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page