Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
README.md 5.75 KiB

Python module for binary_c

Docstring coverage: docstring coverage Test coverage: test coverage

Powered by: astropy

Binary population synthesis code that interfaces with binary_c. Based on a original work by Jeff Andrews. Updated and extended for Python3 by David Hendriks, Robert Izzard.

The current release is version version, make sure to use that version number when installing!

Installation

To install binary_c-python we need to make sure we meet the requirements of installation, and

Python requirements

To run this code you need to at least have installations of:

  • Python 3.7 or higher (3.6 is EOL, and we are using 3.9 for development)
  • binary_c version 2.2.0 or higher

The packages that are required for this code to run are listed in the requirements.txt, which automatically gets read out by setup.py

Environment variables

Before compilation you need to have certain environment variables:

Required:

  • BINARY_C should point to the root directory of your binary_c installation
  • LD_LIBRARY_PATH should include $BINARY_C/src and whatever directories are required to run binary_c (e.g. locations of libgsl, libmemoize, librinterpolate, etc.)
  • LIBRARY_PATH should include whatever directories are required to build binary_c (e.g. locations of libgsl, libmemoize, librinterpolate, etc.)
  • GSL_DIR should point to the root location where you installed GSL to. This root dir should contain bin/, lib/ etc

Build instructions

First, make sure you have built binary_c (See $BINARY_C/doc/binary_c2.pdf section: installation for all the installation instructions for binary_c)) and that it functions correctly.

Installation via PIP:

To install this package via pip:

pip install binarycpython

This will install the latest stable installation that is available on Pip. The version on the master branch should be the same version as the latest stable version on Pip

Installation from source:

We can also install the package from source, which is useful for development versions and when you want to modify the code. It is recommended that you install this into a virtual environment. From within the commands/ directory, run

./install.sh

This will install the package, along with all the dependencies, into the current active (virtual) python environment.

After installation

After installing the code via source it is useful to run the test suite before doing any programming with it. The test suite is stored in binarycpython/tests and running python main.py in there will run all the tests.

Usage

Examples

See the examples/ directory for example scripts and notebooks. The documentation contains example pages as well.

Usage notes

Make sure that with every change/recompilation you make in binary_c, you also rebuild this package. Whenever you change the sourcecode of this package, you need to reinstall it into your virtualenvironment as well

Documentation

Look in the docs/ directory. Within the build/html/ there is the html version of the documentation. The

Development:

If you want to contribute to the code, then it is recommended that you install the packages in development_requirements.txt:

pip install -r development_requirements.txt

Please do not hesitate to contact us to discuss any developments.

Generating documentation

To build the documentation manually, run