Welcome to the Home Page! |
Download PyEphem for Windows, Linux, or as source code, directly from the Python Package Index.
PyPI PyEphem page
|
The project source code and issue tracker are hosted on GitHub. |
PyEphem Home Page¶Welcome to the home page of the PyEphem astronomy library for Python! >>> import ephem
>>> mars = ephem.Mars()
>>> mars.compute('2007/10/02 00:50:22')
>>> print mars.ra, mars.dec
6:05:56.34 23:23:40.0
>>> ephem.constellation(mars)
('Gem', 'Gemini')
Since its first release in 1998, PyEphem has given Python programmers the ability to compute planet, comet, asteroid, and Earth satellite positions. It wraps the “libastro” C library that powers the XEphem astronomy application for UNIX — whose author Elwood Downey generously gave permission for PyEphem to use his library with Python. PyEphem can also compute the angular separation between two objects in the sky, determine the constellation in which an object lies, and find the times an object rises, transits, and sets. PyEphem will continue to receive critical bugfixes and be ported to each new version of Python. But be warned that it has some rough edges!
Here’s more example code to illustrate how PyEphem works: >>> boston = ephem.Observer()
>>> boston.lat = '42.37'
>>> boston.lon = '-71.03'
>>> boston.date = '2007/10/02 00:50:22'
>>> mars.compute(boston)
>>> print mars.az, mars.alt
37:55:48.9 -14:23:11.8
>>> print(boston.next_rising(mars))
2007/10/2 02:31:51
>>> print mars.az # degrees when printed
56:52:52.1
>>> print mars.az + 0.0 # radians in math
0.992763221264
>>> print(boston.next_transit(mars))
2007/10/2 10:07:47
>>> print mars.alt # degrees when printed
71:02:16.3
>>> print mars.alt + 0.0 # radians in math
1.23984456062
Installing PyEphem¶You can try installing PyEphem with: $ pip install pyephem
Better yet,
you can use virtualenv to create a virtual environment,
and then run its If instead you want to download the Windows installer or even the raw PyEphem source code, you should visit the PyEphem entry at the Python Package Index, or use the links at the top of this page. |