Skip to main content

Python bindings for ERFA

Project description

PyPI Status DOI 10.5281/zenodo.3940699 GitHub Actions CI Status Documentation Status

PyERFA is the Python wrapper for the ERFA library (Essential Routines for Fundamental Astronomy), a C library containing key algorithms for astronomy, which is based on the SOFA library published by the International Astronomical Union (IAU). All C routines are wrapped as Numpy universal functions, so that they can be called with scalar or array inputs.

The project is a split of astropy._erfa module, developed in the context of Astropy project, into a standalone package. It contains the ERFA C source code as a git submodule. The wrapping is done with help of the Jinja2 template engine.

If you use this package in your research, please cita it via DOI 10.5281/zenodo.3940699.

Installation instructions

The package can be installed from the package directory using a simple:

$ pip install .

and similarly a wheel can be created with:

$ pip wheel .

The package can be obtained from PyPI or directly from the git repository:

$ git clone --recursive https://github.com/liberfa/pyerfa/

The package also has nightly wheel that can be obtained as follows:

$ pip install --upgrade --index-url https://pypi.anaconda.org/liberfa/simple pyerfa --pre

Testing

For testing, one can install the packages together with its testing dependencies and then test it with:

$ pip install .[test]
$ pytest

Alternatively, one can use tox, which will set up a separate testing environment for you, with:

$ tox -e test

Usage

The package can be imported as erfa which has all ERFA ufuncs wrapped with python code that tallies errors and warnings. Also exposed are the constants defined by ERFA in erfam.h, as well as numpy.dtype corresponding to structures used by ERFA. Examples:

>>> import erfa
>>> erfa.jd2cal(2460000., [0, 1, 2, 3])
(array([2023, 2023, 2023, 2023], dtype=int32),
 array([2, 2, 2, 2], dtype=int32),
 array([24, 25, 26, 27], dtype=int32),
 array([0.5, 0.5, 0.5, 0.5]))
>>> erfa.plan94(2460000., [0, 1, 2, 3], 1)
array([([ 0.09083713, -0.39041392, -0.21797389], [0.02192341, 0.00705449, 0.00149618]),
       ([ 0.11260694, -0.38275202, -0.21613731], [0.02160375, 0.00826891, 0.00217806]),
       ([ 0.13401992, -0.37387798, -0.21361622], [0.0212094 , 0.00947838, 0.00286503]),
       ([ 0.15500031, -0.36379788, -0.21040601], [0.02073822, 0.01068061, 0.0035561 ])],
      dtype={'names': ['p', 'v'], 'formats': [('<f8', (3,)), ('<f8', (3,))], 'offsets': [0, 24], 'itemsize': 48, 'aligned': True})
>>> erfa.dt_pv
dtype([('p', '<f8', (3,)), ('v', '<f8', (3,))], align=True)
>>> erfa.dt_eraLDBODY
dtype([('bm', '<f8'), ('dl', '<f8'), ('pv', [('p', '<f8', (3,)), ('v', '<f8', (3,))])], align=True)
>>> erfa.DAYSEC
86400.0

It is also possible to use the ufuncs directly, though then one has to deal with the warning and error states explicitly. For instance, compare:

>>> erfa.jd2cal(-600000., [0, 1, 2, 3])
Traceback (most recent call last):
...
ErfaError: ERFA function "jd2cal" yielded 4 of "unacceptable date (Note 1)"
>>> erfa.ufunc.jd2cal(-600000., [0, 1, 2, 3])
(array([-1, -1, -1, -1], dtype=int32),
 ...,
 array([-1, -1, -1, -1], dtype=int32))

License

PyERFA is licensed under a 3-clause BSD style license - see the LICENSE.rst 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

pyerfa-2.0.1.4.tar.gz (817.4 kB view details)

Uploaded Source

Built Distributions

pyerfa-2.0.1.4-pp39-pypy39_pp73-win_amd64.whl (347.2 kB view details)

Uploaded PyPy Windows x86-64

pyerfa-2.0.1.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (343.9 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyerfa-2.0.1.4-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (321.2 kB view details)

Uploaded PyPy macOS 10.9+ x86-64

pyerfa-2.0.1.4-cp39-abi3-win_amd64.whl (347.1 kB view details)

Uploaded CPython 3.9+ Windows x86-64

pyerfa-2.0.1.4-cp39-abi3-win32.whl (340.0 kB view details)

Uploaded CPython 3.9+ Windows x86

pyerfa-2.0.1.4-cp39-abi3-musllinux_1_1_x86_64.whl (749.2 kB view details)

Uploaded CPython 3.9+ musllinux: musl 1.1+ x86-64

pyerfa-2.0.1.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (738.7 kB view details)

Uploaded CPython 3.9+ manylinux: glibc 2.17+ x86-64

pyerfa-2.0.1.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (692.8 kB view details)

Uploaded CPython 3.9+ manylinux: glibc 2.17+ ARM64

pyerfa-2.0.1.4-cp39-abi3-macosx_11_0_arm64.whl (329.3 kB view details)

Uploaded CPython 3.9+ macOS 11.0+ ARM64

pyerfa-2.0.1.4-cp39-abi3-macosx_10_9_x86_64.whl (341.8 kB view details)

Uploaded CPython 3.9+ macOS 10.9+ x86-64

File details

Details for the file pyerfa-2.0.1.4.tar.gz.

File metadata

  • Download URL: pyerfa-2.0.1.4.tar.gz
  • Upload date:
  • Size: 817.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pyerfa-2.0.1.4.tar.gz
Algorithm Hash digest
SHA256 acb8a6713232ea35c04bc6e40ac4e461dfcc817d395ef2a3c8051c1a33249dd3
MD5 46e0290e20aa0d1c0c59777808dff68e
BLAKE2b-256 6caaa5f67966decfe415684e2505bb0b3dcaadb8c6ccc6421813b1ab34451060

See more details on using hashes here.

File details

Details for the file pyerfa-2.0.1.4-pp39-pypy39_pp73-win_amd64.whl.

File metadata

File hashes

Hashes for pyerfa-2.0.1.4-pp39-pypy39_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 39cf838c9a21e40d4e3183bead65b3ce6af763c4a727f87d84909c9be7d3a33c
MD5 5d136cb45248ba6a131f4184d5a9d67f
BLAKE2b-256 17d8edd38f83fcc657369d54d7afea9a974af72eab38ece68b54b785853a95ad

See more details on using hashes here.

File details

Details for the file pyerfa-2.0.1.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyerfa-2.0.1.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9045e9f786c76cb55da86ada3405c378c32b88f6e3c6296cb288496ab374b068
MD5 5cf4a98ef013049b56fa0fb4dad404b3
BLAKE2b-256 431324aa29d6c3009b55a8632f4cab49da3b67cb6e4861186749e84dede3336f

See more details on using hashes here.

File details

Details for the file pyerfa-2.0.1.4-pp39-pypy39_pp73-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyerfa-2.0.1.4-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 88a8d0f3608a66871615bd168fcddf674dce9f7568c239a03cf8d9936161d032
MD5 da65fe7861693708794ed19200682827
BLAKE2b-256 9989c5f1a97320eb9ce7fdcf545205be83998a8bb693e03ccfcf921ee27ee1fb

See more details on using hashes here.

File details

Details for the file pyerfa-2.0.1.4-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: pyerfa-2.0.1.4-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 347.1 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pyerfa-2.0.1.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 bc3cf45967ac1af77a777deb050fb08bbc75256dd97ca6005e4d385358b7af40
MD5 95e94be2295fae80ddfbc68b759bed7e
BLAKE2b-256 ddccfdce417aa810a6abddf699948d3e1a57b85e12380222d5093d1b0756fb1f

See more details on using hashes here.

File details

Details for the file pyerfa-2.0.1.4-cp39-abi3-win32.whl.

File metadata

  • Download URL: pyerfa-2.0.1.4-cp39-abi3-win32.whl
  • Upload date:
  • Size: 340.0 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for pyerfa-2.0.1.4-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 46d3bed0ac666f08d8364b34a00b8c6595358d6c4f4532da8d13fac0e5227baa
MD5 d89c7ccc978519fc3b67a0ef31ff4bbe
BLAKE2b-256 f4f39b857e3dea224d76e242bd2d4cfb686dc5d357d9f3de4f22e6958a2b52b9

See more details on using hashes here.

File details

Details for the file pyerfa-2.0.1.4-cp39-abi3-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for pyerfa-2.0.1.4-cp39-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 83a44ba84ebfc3244412ecbf1065c087c382da84f1c3eee1f2a0638d9046ac96
MD5 b233da13d6d668c36469a2f8c68504b6
BLAKE2b-256 9eb2d4d916fd2e4cb1bc47e9698b31deed2798fdb99c0a8385871a7aac78b149

See more details on using hashes here.

File details

Details for the file pyerfa-2.0.1.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyerfa-2.0.1.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7e4508dd7ffd7b27b7f67168643764454887e990ca9e4584824f0e3ab5884c0f
MD5 36c1958174fd71ffba4c6c517bf41489
BLAKE2b-256 b31c023031381b4cbc619eae5328d536735ec468218a2e92f45560bab9bb59a3

See more details on using hashes here.

File details

Details for the file pyerfa-2.0.1.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyerfa-2.0.1.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 610d2bc314e140d876b93b1287c7c81685434873c8700cc3e1596193f77d1071
MD5 da1ffd5fc8286229b666610eba3ead25
BLAKE2b-256 15dad588ed186140c775a3117c40e596c8ff09c80ebe4978051d9516cf0bb01b

See more details on using hashes here.

File details

Details for the file pyerfa-2.0.1.4-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyerfa-2.0.1.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 900b266a3862baa9560d6b1b184dcc14e0e76d550ff70d32336d3989b2ed18ca
MD5 b624780daabd602093e819aeeec418f2
BLAKE2b-256 f94c0460d2c1d82ae1c651a6e5354e64dfe4566bcb124d6d915eff039706dfd9

See more details on using hashes here.

File details

Details for the file pyerfa-2.0.1.4-cp39-abi3-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyerfa-2.0.1.4-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ff112353944bf705342741f2fe41674f97154a302b0295eaef7381af92ad2b3a
MD5 490f19bf1e427da00c857fb8086df131
BLAKE2b-256 4d29daec96895624ec32db7a32ad3738463aac52bedb2a8b07bffcebf76c9f64

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