Skip to main content

Python wrapper for CEPHES using CFFI and numba

Project description

pycephes

Name:

pycephes

Website:

https://github.com/poliastro/pycephes

Author:

Juan Luis Cano Rodríguez <juanlu001@gmail.com>

Version:

0.1.0

license mailing

pycephes is a thin Python wrapper for the CEPHES mathematical library from Netlib, written using CFFI and easy to use with numba. It is released under the MIT license, hence allowing commercial use.

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).

Performance

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.

Time benchmarks

Requirements

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.

Installation

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 .

Contributing

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.

Support

mailing

You can post support questions regarding pycephes on the poliastro mailing list or the pycephes issue tracker.

License

license

pycephes is released under the MIT license, hence allowing commercial use of the library. Please refer to the COPYING file.

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

pycephes-0.1.0.tar.gz (47.9 kB view details)

Uploaded Source

File details

Details for the file pycephes-0.1.0.tar.gz.

File metadata

  • Download URL: pycephes-0.1.0.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pycephes-0.1.0.tar.gz
Algorithm Hash digest
SHA256 152b1896780fb43145fb325f02f1bfcc0fe33ff42f7058f012590f3efab9ef1f
MD5 bd8c4deb68b14737fd4445d4b9fe196a
BLAKE2b-256 31114ba8b169e7903ad507f5d78c606946354ce46fd5f9e8f2f1295e278c8ed2

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