ephem.separation returns radians not degrees

Bug #774177 reported by psismurf
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyEphem
Fix Released
Medium
Brandon Rhodes

Bug Description

I've just noticed that ephem.separation returns the angular separation in radians, not in degrees as stated in the docstring. Not a huge issue, but an annoying one to finally figure out (or maybe I'm just daft!)

Running PyEphem 3.7.2.4 under Python 2.5.2.

# should return 10 degrees
In [87]: ephem.separation((radians(100),radians(20)),(radians(100),radians(10)))
Out[87]: 0.17453292519943317

# in fact it returns radians which must be converted to degrees
In [88]: degrees(ephem.separation((radians(100),radians(20)),(radians(100),radians(10))))
Out[88]: 10.000000000000012

Cheers,
Simon

Revision history for this message
Brandon Rhodes (brandon-rhodes) wrote :

Well, this brings up a thorny issue. PyEphem intends that all angles be floating-point radians, but which will “print themselves out” in a more convenient format like angles of RA or degrees of pretty much anything else. In addition, when setting an angle, you can pass a string with RA or degrees, like “3:14:58.8” and PyEphem will convert it for you.

So the intention, when the docstring says “(degrees)”, is to define what format the *string* version takes. For people who encounter the idea in the tutorial first, this has been working. But I'd not thought about people who encounter the docstring first; obviously, it can confuse them!

I could expand all of those parenthetics to say something like “(radians printed as degrees)” or “displayed as degrees” or something like that, but let me think for a few days about what way of putting it might cause the least confusion — and let me know if you yourself have any ideas!

Changed in pyephem:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Brandon Craig Rhodes (brandon-rhodes)
Revision history for this message
Brandon Rhodes (brandon-rhodes) wrote :

Your report inspired me to throw brevity to the wind and give all attributes verbose descriptions making clear the float-vs-string dichotomy in PyEphem, so that people do not have to remember that detail from the documentation and read it into every docstring they come across! Thank you. The improvement is being released tonight in Version 3.7.5.1.

Changed in pyephem:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.