Skip to main content

Python bindings for ERFA

Reason this release was yanked:

Broken

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/

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.2.tar.gz (816.9 kB view details)

Uploaded Source

Built Distributions

pyerfa-2.0.1.2-pp39-pypy39_pp73-win_amd64.whl (347.0 kB view details)

Uploaded PyPy Windows x86-64

pyerfa-2.0.1.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (343.5 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyerfa-2.0.1.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (320.8 kB view details)

Uploaded PyPy macOS 10.9+ x86-64

pyerfa-2.0.1.2-cp39-abi3-win_amd64.whl (346.9 kB view details)

Uploaded CPython 3.9+ Windows x86-64

pyerfa-2.0.1.2-cp39-abi3-win32.whl (339.8 kB view details)

Uploaded CPython 3.9+ Windows x86

pyerfa-2.0.1.2-cp39-abi3-musllinux_1_1_x86_64.whl (748.1 kB view details)

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

pyerfa-2.0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (737.7 kB view details)

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

pyerfa-2.0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (691.9 kB view details)

Uploaded CPython 3.9+ manylinux: glibc 2.17+ ARM64

pyerfa-2.0.1.2-cp39-abi3-macosx_11_0_arm64.whl (328.9 kB view details)

Uploaded CPython 3.9+ macOS 11.0+ ARM64

pyerfa-2.0.1.2-cp39-abi3-macosx_10_9_x86_64.whl (341.4 kB view details)

Uploaded CPython 3.9+ macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pyerfa-2.0.1.2.tar.gz
Algorithm Hash digest
SHA256 9a7fb7c8b0ddd0527f344faf891a3a0975b98fc0155219058a0bcf2fb3e1cb09
MD5 78452fda02ab4775a4b128f61ef60ccd
BLAKE2b-256 fa04692d522e63ad04448ac0a571e4854dc07f03d0a1713cd378dbb8565032f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.2-pp39-pypy39_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 ff697fab6ab9e9b100da0c9b10a6e8711b2be61b9cb0f1dd2179c37f3face1f2
MD5 bb585ec1c4ccd05c5e9d8335f698cb51
BLAKE2b-256 055500929595942fad9b7a147b5f28a8d0d0ca56e355c82e7d918362fbc2b342

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b4263db1ec97f2c5da5b8fffabab16bf24a2b72da54a66fa4fd540938c12c48
MD5 78d541a108b99a88d76afef139c61d70
BLAKE2b-256 16ff9131d4c044b3d295a35d1eca9ef7bd4af51c739806ae96ba2e5661ae5648

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0bb6a4498ab2fea354417c5831ca48859bea85fc092466ba5c3bbbc0c66c1849
MD5 d8eac4ecc4cf8042ef5fb1a3afe3603a
BLAKE2b-256 bf055c7d592ac1dc70ff9d7fcf76aa0719b39f4c53b3c2143e0b0bece3f98f37

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyerfa-2.0.1.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0e3664a2d8f47c6e54fd445d551eb59ef4f496c21e7b8827111e3f2e84f2c145
MD5 b2c2c6fb1257b2831dd06caf0d07ebab
BLAKE2b-256 abf7fcc69c5297209d23d55af07d09a361e9f8adbfe750ed541a2602dfb912ef

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyerfa-2.0.1.2-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 4ce07e10db430845a8d15d2fc39d4e4a5f89874db1dbb53f2f2356ad58d77602
MD5 bca35f7a08ab353136557a55a419180d
BLAKE2b-256 7a97220a4a9653ff8827ab3e13780bbc33ff6555bf0b8959be0e42c1eb32a53e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.2-cp39-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 9085c9b55f887dde1e35ab8ad1e90f56c4792962488a9b770366d2f309ddf5e7
MD5 791394753fde8fb8047c4f2127e22911
BLAKE2b-256 9bf6b53f7eab559a206a4abd392d77122267b10a101db71067dc01aae07054d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0a46f0e8fa765739855edd72d22d868df765dd0ce65cde5732baa1b1915c5d47
MD5 8723609fb62b3befd2b90ef13a37ee0f
BLAKE2b-256 6911f072c735985d4374ecdb86ce25cb769fe00a2bb857f12446ba7c24606a92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a3c246249e994f69a9357c6c56ba89ebf97534fc370f115f203f452facb16787
MD5 726740b1fa9b7b8b47d526ea7146039d
BLAKE2b-256 6099398483c1f39a8eb4aa8291f0b2031d368b117ca772dcb47f39ffd011b8b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 619d50214386e1e97d5129f655617bf8d97e4985b1fa377cb7ce1b0ee91bf1c6
MD5 34b85dfbca4f886756d58f20fe586181
BLAKE2b-256 3f6fa2c6ba710bca5a0b6e4899dd7db421f08a96e88b55e81b213372fa12177d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.2-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3b37a721c73a8307809db3bc6bfa659799a2fdfdcfcc523661f6e24b828f2330
MD5 6820fc1a456fb841587068a5e574dd37
BLAKE2b-256 e577fe511dd3d059071b3aadb2c79412cd8c88ed725cd4bcc574297e42e40b3e

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