brandon-rhodes / pyephem

Scientific-grade astronomy routines for Python
Other
766 stars 121 forks source link

add phase angle attribute for solar system bodies #11

Closed migueldvb closed 4 years ago

migueldvb commented 11 years ago

It would be useful to have a solar phase angle attribute (angle between Sun-body-observer) for Solar System objects.

brandon-rhodes commented 10 years ago

To help me understand the requirement: how is the solar phase angle different than the existing .phase attribute on Solar System objects?

migueldvb commented 10 years ago

The phase angle is listed as "Sun-Target-Observer" angle in the ephemeris obtained from JPL Horizons http://en.wikipedia.org/wiki/Phase_angle_%28astronomy%29 If the percentage of the illuminated surface is calculated for a spherical body the phase angle would be arccos(phase/50-1) where phase goes between 0 and 100.

ysBach commented 6 years ago

May I ask if this functionality is added? This will have enormous advantage to people like me (we need to find targets which will be at near 0 or near 100 degree phase angle for many purposes, and querying ~ all asteroids to JPL/HORIZONS is almost impossible).

Currently I am using solar elongation to find candidates with near 0 phase angle (object.elong > 170 for example), but I have no idea how to make candidate list which will be at near 100 degree phase angle .

drbitboy commented 6 years ago

@ysBach Where do you find the ephemerides for the candidates to test? Because if you had ephemerides in SPICE format, you could use the SPICE toolkit, specifically GFILUM, to find the time when phase angles are in a given range.

HORIZONS has the capability to return candidates' ephemerides as SPICE kernels, and access to HORIZONS can also be automated (cf. telnet horizons.jpl.nasa.gov 6775); I wrote an eXcel spreadsheet to use that once. Also, I think the website horizons.jpl.nasa.gov also has an API, but I have never used it.

brandon-rhodes commented 4 years ago

As the solar phase angle is (a) not returned by the C library "libastro" that PyEphem is a wrapper around, and (b) not easily computed since PyEphem returns angles instead of vectors, I am going to close this issue as impractical. I encourage folks to try out Skyfield, a library based on vectors that should make calculations like this more feasible. Thanks!