not a bug, just a caution about usage

Bug #391183 reported by cagey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyEphem
Invalid
Medium
Brandon Rhodes

Bug Description

The routines which calculate rising and setting times of a Body (and presumably transit) seem not to make a local
copy of the Body to work with. The result is that if you:

> body.compute(observer)
> print body.az, body.alt
> print observer.next_rising(body)
> print body.az, body.alt

the values of body.az and body.alt are modified (ie, the final values of az and alt are those for the body where it
rises). This could be viewed as a feature. :)

- kg

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

cagey —

Yes, as you noted, this is considered a feature. The reason the routine does not work on a copy of the body is that, if it did, then the final result of its calculations would be "hidden" from the user, and the user would have to ask the body to re-calculate its position — that had just been calculated already! — to find out the circumstances of the rising or setting.

Since to find out when, say, the Moon rises, PyEphem has to go ahead and compute its position, the idea is that leaving it there for the user keeps useful information that would otherwise be lost. In nearly all real astronomical work that I know of, after when something rises, you immediately want to know where; and especially after asking about when something transits, you want to know the altitude at which it transits. Making users do a second calculation every time this happens seemed unacceptibly inefficient.

If you were surprised by this behavior, however, it means that the documentation needs to be improved. What did you read that introduced you to the rising/setting functions? Let me know, and we'll work to make that document describe much better how PyEphem works. Thanks for sharing your confusing rather than staying silent and letting the documentation suffer!

Changed in pyephem:
assignee: nobody → Brandon Craig Rhodes (brandon-rhodes)
importance: Undecided → Medium
status: New → Invalid
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.