[AstroPy] using astropy.coordinates.angular_separation()

Didelon Pierre pierre.didelon at cea.fr
Thu Aug 10 12:18:18 EDT 2023


Hi John


thank you for your very quick answer.

I didn't notice the inappropriate version of the doc not corresponding to the astropy version I used.
Unfortunately I will not migrate to Python 3, 'cause I don't want to "translate" more than a thousand line of code from python2 to 3 :-/

I will use another way to calculate angular distance, at least approximately,

and try to read the appropriate documentation from now on.


Best

Pierre



________________________________
De : AstroPy <astropy-bounces+pierre.didelon=cea.fr at python.org> de la part de John ZuHone <jzuhone at gmail.com>
Envoyé : jeudi 10 août 2023 18:02
À : Astronomical Python mailing list
Objet : Re: [AstroPy] using astropy.coordinates.angular_separation()

Hi Pierre,

I should note that you are looking at the page for the "stable" version of AstroPy, which is 5.3.1, whereas you are using a very old version of AstroPy, for which the docs are here:

<https://docs.astropy.org/en/v2.0.16/coordinates/index.html#module-astropy.coordinates>
Astronomical Coordinate Systems (astropy.coordinates) — Astropy v2.0.16<https://docs.astropy.org/en/v2.0.16/coordinates/index.html#module-astropy.coordinates>
docs.astropy.org<https://docs.astropy.org/en/v2.0.16/coordinates/index.html#module-astropy.coordinates>
        [astropy_logo.ico] <https://docs.astropy.org/en/v2.0.16/coordinates/index.html#module-astropy.coordinates>


Based on my casual look, this method is not in this old version. If you can, I highly recommend upgrading to the latest version, which also necessitates upgrading to Python 3.

Best,

John

On Aug 10, 2023, at 11:58 AM, Didelon Pierre <pierre.didelon at cea.fr> wrote:


Hi everyone

I hope I am not disturbing you with a silly question :-/

I try to use the astropy.coordinates.angular_separation() utility
(https://docs.astropy.org/en/stable/api/astropy.coordinates.angular_separation.html)
in python2.7 with  astropy 2.0.16
but it seems not available :-/

here is the code

import astropy.coordinates as ac
...

angsep = ac.angular_separation (pix_c_coord[0]*pi/180.,pix_ra*pi/180.,pix_c_coord[1]*pi/180.,pix_dec*pi/180.) *180./pi

and the error


angsep = ac.angular_separation (pix_c_coord[0]*pi/180.,pix_ra*pi/180.,pix_c_coord[1]*pi/180.,pix_dec*pi/180.) *180./pi
AttributeError: 'module' object has no attribute 'angular_separation'


Did I miss something?

Tank's in advance for any advice

Pierre Didelon

Astrophysic Department CEA Saclay
_______________________________________________
AstroPy mailing list
AstroPy at python.org<mailto:AstroPy at python.org>
https://mail.python.org/mailman/listinfo/astropy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/astropy/attachments/20230810/1149eeff/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: astropy_logo.ico
Type: image/vnd.microsoft.icon
Size: 32988 bytes
Desc: astropy_logo.ico
URL: <https://mail.python.org/pipermail/astropy/attachments/20230810/1149eeff/attachment-0001.ico>


More information about the AstroPy mailing list