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

Uploaded Source

Built Distribution

numeph-0.3.3-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: numeph-0.3.3.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.7.8

File hashes

Hashes for numeph-0.3.3.tar.gz
Algorithm Hash digest
SHA256 b4e8f17f6a4b6ba6b83b85c353b5d9dd574e21fa03447cb5a108cf7f74e72b02
MD5 395c3f03c1f0142cc42c9b93d1014308
BLAKE2b-256 2ccd630f2992427ef8557c606b4c5a86e2e6de2fca50a89cabb41075e1f2d58b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: numeph-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.7.8

File hashes

Hashes for numeph-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 81ec335dfd937c5f461aae445de49fc35d5fad1ccef1d7df1e37cd8791f8016a
MD5 0fe07b51c7ea44e74fa1d8d0ca0ab69b
BLAKE2b-256 ba3a69ca1686f1412ee53b7daae22eb0cbece8b07ebedcefd5b0182e33156c8b

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