Python wrapper for CEPHES using CFFI and numba
|Author:||Juan Luis Cano Rodríguez <firstname.lastname@example.org>|
At present it only interfaces a single hypergeometric function, but is provided here both as a proof of concept of the power of CFFI + numba and as a support for poliastro, a Python library for interplanetary Astrodynamics. It is therefore a work in progress, and all contributions are welcome (see Contributing).
The motivation for creating this project is mainly achieving a good performance. Time benchmarks are included in the tests/ directory which can be run using pytest-benchmark.
Preliminary studies suggest that pycephes can be nearly 5 times faster on average than the equivalent SciPy function.
pycephes requires the following Python packages:
- NumPy, for basic array handling
- CFFI, for interfacing with C code
- numba, to make it compatible with upstream jitted functions
In addition, the CEPHES mathematical library must be present on the system.
The easiest and fastest way to get the package up and running is to install pycephes using conda. This also installs the CEPHES package as a dependency:
$ conda install pycephes --channel poliastro
It can be installed from PyPI too, provided that the CEPHES library is present on the system:
$ pip install pycephes
You can also download pycephes source from GitHub and type:
$ pip install .
Development installations are supported as well:
$ pip install -e .
One obvious area of improvement for the library consists in adding more functions. Some other ideas:
- Create some script to generate the function headers so they don’t have to be added manually.
- Use the @generated_jit feature introduced in numba 0.24 to automatically trigger the appropriate function depending on the dimension of the inputs, à la Julia.
Potential contributors are encouraged to fork the repository and open a pull request.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pycephes-0.1.0.tar.gz (47.9 kB)||File type Source||Python version None||Upload date||Hashes View|