2

Is there a complete list of all the functions and objects available in PyEphem? I found a list here. But it doesn't seem to contain everything. Attributes like rise_time and transit_time exist, and are briefly mentioned in the tutorial, but are not mentioned anywhere in the manual. Should I be using them? Is there an alternative?

Brandon Rhodes
  • 83,755
  • 16
  • 106
  • 147
Nabigh
  • 91
  • 6
  • did you check this? http://rhodesmill.org/pyephem/quick.html#other-functions – user 12321 Jan 16 '15 at 21:00
  • I have edited the title and question to make clear the questioner's more specific concern, based on the questioner's useful comments to my answer to their question. Would be happy to see this re-opened, as it probably affects other users. – Brandon Rhodes Jan 22 '15 at 17:59

2 Answers2

2

The six attributes rise_time rise_az transit_time transit_alt set_time set_az and circumpolar are deprecated, and a warning has been in place about them since 2007. Unfortunately — and I am not sure that I knew this at the time — Python by default does not display developer-targeted warnings, probably to not frighten users of Python applications:

$ python script_that_asks_for_next_rise.py
2014/1/2 18:04:00

The documentation about warnings at https://docs.python.org/2/library/warnings.html suggests that “…you should make sure to test your code with typically ignored warnings made visible. You can do this from the command-line by passing -Wd…” which, I guess, means that I have been doing-it-wrong for more than a decade: I never think to add -Wd to command lines when developing against third-party libraries! The result of doing so in this case is:

$ python -Wd tmp18.py
tmp18.py:15: DeprecationWarning: the ephem.Body attributes 'rise_time', 'rise_az', 'transit_time', 'transit_alt', 'set_time', 'set_az', 'circumpolar', and 'never_up' are deprecated; please convert your program to use the ephem.Observer functions next_rising(), previous_rising(), next_transit(), and so forth

  print moon.rise_time
2014/1/2 18:04:00

But since most developers probably leave -Wd off without thinking about it, it is likely that more than one developer has been surprised over the years that these attributes are present but no longer documented or supported.

In any case, I will go ahead and remove them from the next version to prevent confusion and to prevent the problems that people were having with them. The method next_pass(), which is shown in the Quick Reference, is the official successor to these six attributes.

For more information on the officially supported attributes, the most complete reference is the PyEphem “Quick Reference:”

http://rhodesmill.org/pyephem/quick.html

Brandon Rhodes
  • 83,755
  • 16
  • 106
  • 147
  • Thanks @Brandon. Is next_rising the same as rise_time? Quick reference gives the former, but the link in given in question also gives the latter along with several others not given in quick reference. – Nabigh Jan 17 '15 at 04:16
  • You might want to edit your question to mention that you are specifically interested in `next_rising()` and the difference between it and `rise_time()` — that would save the question from the concern that has led to its being put “on hold,” the concern that your question is unspecific and is just asking for links that you could Google. :) Meanwhile, I will update my answer to address this more specific question you have outlined! – Brandon Rhodes Jan 17 '15 at 18:50
  • No problem! I have edited the question title and text, using your comments here, so that it becomes the kind of specific and answerable question that SO moderators prefer — feel free to edit further! Hopefully we can get it re-opened. – Brandon Rhodes Jan 22 '15 at 18:00
1

No, there is no complete list of all the functions and objects available in PyEphem except for the source code itself.

>>> import ephem
>>> ephem.__dict__
{'AlwaysUpError': ephem.AlwaysUpError,
 'Angle': ephem.Angle,
 'Ariel': ephem.Ariel,
 'B1900': 0.3135000001639128,
 'B1950': 18262.423500000034,
 'Body': ephem.Body,
 [...]
 'star': <function ephem.star>,
 'sun_radius': 695000000.0,
 'tiny': 1.346704669748711e-08,
 'twopi': 6.283185307179586,
 'uranometria': <function ephem._libastro.uranometria>,
 'uranometria2000': <function ephem._libastro.uranometria2000>}
>>> 

NB: ellipses ([...]) are mine.

gboffi
  • 22,939
  • 8
  • 54
  • 85