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

Uploaded Source

Built Distributions

pyerfa-2.0.1-cp39-abi3-win_amd64.whl (348.6 kB view details)

Uploaded CPython 3.9+ Windows x86-64

pyerfa-2.0.1-cp39-abi3-win32.whl (341.4 kB view details)

Uploaded CPython 3.9+ Windows x86

pyerfa-2.0.1-cp39-abi3-musllinux_1_1_x86_64.whl (749.9 kB view details)

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

pyerfa-2.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (739.4 kB view details)

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

pyerfa-2.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (693.6 kB view details)

Uploaded CPython 3.9+ manylinux: glibc 2.17+ ARM64

pyerfa-2.0.1-cp39-abi3-macosx_11_0_arm64.whl (334.1 kB view details)

Uploaded CPython 3.9+ macOS 11.0+ ARM64

pyerfa-2.0.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.tar.gz.

File metadata

  • Download URL: pyerfa-2.0.1.tar.gz
  • Upload date:
  • Size: 817.3 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.tar.gz
Algorithm Hash digest
SHA256 c8572fd24ac779f067209dce1f2f6996d0701359724ecb89422ceb431632d554
MD5 1139b7228774f5ae031a91bac5385ad9
BLAKE2b-256 2913549e8a929ca49e690fa608e71b04611e7b2bf19ea082ed4e4418c7c748da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyerfa-2.0.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 348.6 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-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 71102e79ad9913501c061706a80ccb972b7522175a7c40a1adeab6b69f0fe405
MD5 8a0f937d582c8fc89f5765a1f80d0f33
BLAKE2b-256 10a1d2c9ec991f752e8bdafdfd06486db7610a2e8a995aed2aa634bc3259d066

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyerfa-2.0.1-cp39-abi3-win32.whl
  • Upload date:
  • Size: 341.4 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-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 be9fb433d8a9505d82e1a2c07bdf18e683956f1f817c254775ed758756edd746
MD5 3b13c2572692f8e4be1a72c12ad81548
BLAKE2b-256 dc0b7ad93ce613e763b7f82d33383dfec8a6ea8d7c99ef0c6c1a8c9fdf034e74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1-cp39-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 059d1be17d3f65958e15777657b3d5a8c8f49f7b68e62887098156c6fd6e172d
MD5 1a4ef212526c31c2d106c01af083d068
BLAKE2b-256 339d6b73d19ea408dbeaddaaab54cf98fca9342913b23d0761afef97b5102770

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 504272e6b05cab8060e6e699ac6c290ebbf32a31cd968b94e4b7319a6357d403
MD5 6f75f98971ca3657f0e3120b3724ed88
BLAKE2b-256 f868eaae2087f8c3bf842fd41f5f12406f6721fc967b64c4f768162f27fb1d19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eb0a79635e70126b16620289b649a49a3df2e5a0ae9799e32d002101c5f181a7
MD5 766b2ace5220f3a1e0b09a7549f44406
BLAKE2b-256 2fe2cd4d82c8c230ec228506c654d7cc413925d5c2e69d203abf6d6fd263d06b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 378cd4bc78a6dfa4a23f950c5151ba903e0b671254c587fcfc45aa7f05bc0a09
MD5 0059af38f4c1f9cf919015a1e767328b
BLAKE2b-256 8d2719e9787fdccce3793f266708ec772ba301c4e9b77796e9d1156d2b3dbdf3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyerfa-2.0.1-cp39-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 03af4032af0a1016203b3ee987448df2957dd8f6882b95f5d9cad3e5681ae30e
MD5 3fb5f3a24298d1b987cc34413df8d2de
BLAKE2b-256 7f7e69db5356b67dfcefd77bcd09a8ba4a0f2181163cc4500a83566345551520

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