Skip to main content
https://travis-ci.org/bluephlavio/eph.svg?branch=master https://coveralls.io/repos/github/bluephlavio/eph/badge.svg?branch=master

Readme

The eph package provides some useful functions, classes and tools to retrieve, parse and manipulate ephemerides in an astropy-compatible way.

See eph-howto (jupyter notebook) for more info.

Basic Usage

import eph

req = eph.JplReq() # create the request
req.read('eph.ini', section='jplparams') # read parameters from 'jplparams' section in 'eph.ini'
req.set({
    'COMMAND': 'venus',
    'START_TIME': '2007-11-17',
    'STOP_TIME': '2017-4-22'
    'STEP_SIZE': '10d'
    }) # set parameters from dictionary
req['OBJ_DATA'] = False # set parameter dict-like
req.csv = True # set parameter as attributes
req.set(
    TABLE_TYPE='V',
    VEC_LABELS=False,
    VEC_TABLE=1
) # set position vectors output

res = req.query() # perform the request obtaining a response from Jpl Horizons service
e = res.parse() # parse the ephemeris in an astropy QTable

from astropy.io import ascii

ascii.write(e, format='csv') # write output data

The content of eph.ini can be something like this (see ftp://ssd.jpl_process.nasa.gov/pub/ssd/horizons_batch_example.long for a complete description of JPL parameters)

[jplparams]
MAKE_EPHEM=YES
REFERENCE_PLANE=ECLIPTIC
REF_SYSTEM=J2000
OUT_UNITS=AU-D

Shortcuts

eph package defines also some useful shortcut functions to easily access Jpl Horizons data. Instead of building a JplReq and get back a JplRes to parse, you can get an astropy QTable with

from eph import *
from datetime import datetime

e = get('venus', dates=['2000-1-1', datetime.now()])

Shortcut functions accept also one-date queries (non-interval) and multiple target objects. Behind the scenes eph makes multiple calls to JPL Horizons system and merge the results in one table. In this case non-key (used to join) columns are renamed with a prefix referring to the object (e.g. column X for object venus becomes venus_X). Meta info are listified and collapsed in a single value only if they take the same value for all objects.

from eph import *

e = get(['venus', 'mars'], dates='2017-04-22')

Dates has datetime.now() as default value so it can be omitted if you want present data.

from eph import *

e = get(['venus', 'mars'], table_type='V', vec_table=1) # present vector positional data for Venus and Mars

There are other shortcut functions like vec, pos, vel, elem, obs, radec, altaz, etc.. to simplify parameter settings.

For example, if you want vectors, type

e = vec('venus', dates=['2018-1-1', '2020-1-1']).

Command line tool

eph package also provides a command line tool:

$ eph venus --dates 2007-11-07 2017-04-22

This command gives you an ephemeris table of Venus starting from 2007-11-17 to 2017-4-22. You can also change the reference frame, the time-step size, the output etc.. through the options provided or setting up a config file. Check available options typing

$ eph --help

Release files for eph 1.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eph 1.1.4
File Size Uploaded
eph-1.1.4.tar.gz 62.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eph 1.1.4
File Interpreter ABI Platform
eph-1.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 132.2 kB

Release files / eph-1.1.4.tar.gz

Download URL eph-1.1.4.tar.gz
Size 62.5 kB
Tags Source
SHA-256 checksum
How to use checksums
904bc79dc624d211daee0f86261e998f0e82592120f4238b0f2b469df9f066c9
BLAKE2b-256 checksum
How to use checksums
605e564a984758a503f03697bbab4878531efc1a115a3c7b759f3dbcfec61db2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release files / eph-1.1.4-py3-none-any.whl

Download URL eph-1.1.4-py3-none-any.whl
Size 69.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ed6202efcfd6ebdf3c0a137866d35a69658d83f7dcc665c19bf9d8cfad1680e
BLAKE2b-256 checksum
How to use checksums
d1d4b7ae81840e0bd1dad425b94167c211901f59a23b2773bd21b1dda007b06c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

1.1.4 This release

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

1 release file

1.1.0

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

0.2.0

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page