skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.41k stars 211 forks source link

Method for apparent angular separation #83

Closed davidmikolas closed 8 years ago

davidmikolas commented 8 years ago

It would be useful at some point to have a method to calculate apparent angular separation.

I'm calculating solar eclipse visibility on the earth and on planes, and to track something like "path of totality" I'm minimizing the apparent separation between moon and sun.

mpos = place.at(jd).observe(moon).apparent().position.km
spos = place.at(jd).observe(sun).apparent().position.km
mlen = np.sqrt((mpos**2).sum())
slen = np.sqrt((spos**2).sum())
sepa = ((3600.*180./np.pi) *
        np.arccos(np.dot(mpos, spos)/(mlen*slen)))  # arcsec

I've asked the question here: http://stackoverflow.com/questions/36111098/better-way-to-calculate-apparent-angular-separation-of-two-objects-in-skyfield and discussed minimization here: http://stackoverflow.com/questions/36110998/why-does-scipy-optimize-minimize-fail-when-calling-a-skyfield-based-function

brandon-rhodes commented 8 years ago

I have just released Skyfield 0.8 with the new method:

http://rhodesmill.org/skyfield/api-position.html#skyfield.positionlib.ICRF.separation_from

Enjoy! :)

davidmikolas commented 8 years ago

Yipee!!

On Wed, Mar 30, 2016 at 3:11 PM, Brandon Rhodes notifications@github.com wrote:

I have just released Skyfield 0.8 with the new method:

http://rhodesmill.org/skyfield/api-position.html#skyfield.positionlib.ICRF.separation_from

Enjoy! :)

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/skyfielders/python-skyfield/issues/83#issuecomment-203283584