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/

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

Uploaded Source

Built Distributions

pyerfa-2.0.1.1-pp39-pypy39_pp73-win_amd64.whl (348.8 kB view details)

Uploaded PyPy Windows x86-64

pyerfa-2.0.1.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (345.2 kB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyerfa-2.0.1.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (322.4 kB view details)

Uploaded PyPy macOS 10.9+ x86-64

pyerfa-2.0.1.1-cp39-abi3-win_amd64.whl (348.7 kB view details)

Uploaded CPython 3.9+ Windows x86-64

pyerfa-2.0.1.1-cp39-abi3-win32.whl (341.5 kB view details)

Uploaded CPython 3.9+ Windows x86

pyerfa-2.0.1.1-cp39-abi3-musllinux_1_1_x86_64.whl (750.0 kB view details)

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

pyerfa-2.0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (739.5 kB view details)

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

pyerfa-2.0.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (693.7 kB view details)

Uploaded CPython 3.9+ manylinux: glibc 2.17+ ARM64

pyerfa-2.0.1.1-cp39-abi3-macosx_11_0_arm64.whl (334.3 kB view details)

Uploaded CPython 3.9+ macOS 11.0+ ARM64

pyerfa-2.0.1.1-cp39-abi3-macosx_10_9_x86_64.whl (342.9 kB view details)

Uploaded CPython 3.9+ macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: pyerfa-2.0.1.1.tar.gz
  • Upload date:
  • Size: 817.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pyerfa-2.0.1.1.tar.gz
Algorithm Hash digest
SHA256 dbac74ef8d3d3b0f22ef0ad3bbbdb30b2a9e10570b1fa5a98be34c7be36c9a6b
MD5 0a1237c0e1a664845779a2565fb703df
BLAKE2b-256 4e09aaa59a4b4c22574fbe08e58e181933f19e455aef9b1a21a4eca026cd7d8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.1-pp39-pypy39_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 1c0c1efa701cab986aa58d03c58f77e47ea1898bff2684377d29580a055f836a
MD5 bfec59676276f17643f8d2a2fc1d4c1a
BLAKE2b-256 094c6f50b709fef4b30ea9578ab9380920ae10a71440709463aa5467eb0c4b1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08b5abb90b34e819c1fca69047a76c0d344cb0c8fe4f7c8773f032d8afd623b4
MD5 5b5addd03217e881cb2073e8c404359d
BLAKE2b-256 6c10a99835c7cbd7bb8d12c28f3a2f5123be3054b651077fb85c2c631e16b8e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0e95cf3d11f76f473bf011980e9ea367ca7e68ca675d8b32499814fb6e387d4c
MD5 a0aeaab0b98912377480cd21a189a361
BLAKE2b-256 7e8c656356457612be38b5f4267915ff63f63e41c223d6a3c8fd3e0058927426

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyerfa-2.0.1.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 94df7566ce5a5abb14e2dd1fe879204390639e9a76383ec27f10598eb24be760
MD5 726b5cbd14d1674e2671d353ae744d15
BLAKE2b-256 7cfe546bcb26bd2f498d5f4554c11bc47f08ecfd5c5b29d35584cc652e559ab7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyerfa-2.0.1.1-cp39-abi3-win32.whl
  • Upload date:
  • Size: 341.5 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pyerfa-2.0.1.1-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 30649047b7a8ce19f43e4d18a26b8a44405a6bb406df16c687330a3b937723b2
MD5 9ad218d8da8c713e4729e4dd9f02bbc9
BLAKE2b-256 0ebf605efa98814c33e04220f63d4b94eebac00b23e2f178eb71a0c83f2715ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.1-cp39-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 c50b7cdb005632931b7b56a679cf25361ed6b3aa7c21e491e65cc89cb337e66a
MD5 6691774aeb019ba2d73427d55d52197c
BLAKE2b-256 41f7c3d5c806f2de3bb80e678eb5d5c671d256a197b684200b0978d2db046c22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1db85db72ab352da6ffc790e41209d8f41feb5b175d682cf1f0e3e60e9e5cdf8
MD5 995210768a74e42d72e5f1de3def46fd
BLAKE2b-256 8c1d1f1867468bde3e68050e0a366112b6f1a70947560276873bc18626eee3fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 34ee545780246fb0d1d3f7e46a6daa152be06a26b2d27fbfe309cab9ab488ea7
MD5 79cf80cec76e3d18dc3170354fe4f518
BLAKE2b-256 074c03a12114b7d67d840aeb27c15a76fac0f33b9e309e778603d15d188a89c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 67dfc00dcdea87a9b3c0bb4596fb0cfb54ee9c1c75fdcf19411d1029a18f6eec
MD5 0ed230f1ee4c697b83c57c44076770cd
BLAKE2b-256 c32770cdedf7ff54794203017137a22b9c0f83bd9493852afdeeb1ae8485c248

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1.1-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1ce322ac30673c2aeb0ee22ced4938c1e9e26db0cbe175912a213aaff42383df
MD5 53f4f6885588acff119c3e3c84b0acd6
BLAKE2b-256 45f637c904d9e8d33199a670bf8718204627f2207a49a64779964f735bdd674f

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