Skip to main content

Convert JPL SPK ephemeris to numpy array

Project description

Author: Behrouz Safari
License: MIT

numeph

Convert JPL SPK ephemeris to numpy array

Installation

Install the latest version of numeph from PyPI:

pip install numeph

Requirements are numpy and jplephem

Save some segments of 'de440s.bsp' from 2020 to 2030:

from datetime import datetime
from numeph import SPK

t1 = datetime(2020, 1, 1)
t2 = datetime(2030, 1, 1)

spk = SPK(fname='de440s.bsp', t1=t1, t2=t2,
          segs_tup=[(0,10), (0,3), (3,399), (3,301)])

# save as txt file
spk.to_txt('de440s_2020_2030.txt')

# save as pickle
spk.to_pickle('de440s_2020_2030.pickle')

Load .txt or .pickle files:

You can load the above saved files using load_txt and load_pickle functions. The will return a dictionary of Segment objects.

from numeph import load_txt

dc = load_txt('de440s_2020_2030.txt')

To access each segment, pass the (center, target) tuple as dictionary key.

seg = dc[(3,301)]

get position of an object from a segment:

t = datetime.utcnow()
pos = seg.get_pos(t)

See more at astrodatascience.net

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

numeph-0.3.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

numeph-0.3.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file numeph-0.3.0.tar.gz.

File metadata

  • Download URL: numeph-0.3.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.61.2 importlib-metadata/4.6.1 keyring/18.0.1 rfc3986/1.5.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for numeph-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d14a1c2fafdc2c7321d9d1c98c147deebab6dee5fc6ef942c47a05c25c5db4a2
MD5 12e88269ab677340f4321ce8d1ae22e6
BLAKE2b-256 514170db710f662303bce08eac71276e9cb3cd0b6aab3b6f8ed8f6749a74d35c

See more details on using hashes here.

File details

Details for the file numeph-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: numeph-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/29.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.61.2 importlib-metadata/4.6.1 keyring/18.0.1 rfc3986/1.5.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for numeph-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e72252aafcd3b982508f84b4dc861aced197b934e61f0c35b35a25506e60e7e7
MD5 cf7d8c4eca97ef5009411089b578d49b
BLAKE2b-256 b9e37d7d179a000e7e5f0d62760c2028ec6b22df623da6110d8c07542bc72210

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