From pierre.didelon at cea.fr Thu Aug 10 11:58:22 2023 From: pierre.didelon at cea.fr (Didelon Pierre) Date: Thu, 10 Aug 2023 15:58:22 +0000 Subject: [AstroPy] using astropy.coordinates.angular_separation() In-Reply-To: <6adb71dc550c4ab1b3019f39fcdf3c91@cea.fr> References: <6adb71dc550c4ab1b3019f39fcdf3c91@cea.fr> Message-ID: <25e7d71fb7e94154b89da408d2e02542@cea.fr> 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jzuhone at gmail.com Thu Aug 10 12:02:55 2023 From: jzuhone at gmail.com (John ZuHone) Date: Thu, 10 Aug 2023 12:02:55 -0400 Subject: [AstroPy] using astropy.coordinates.angular_separation() In-Reply-To: <25e7d71fb7e94154b89da408d2e02542@cea.fr> References: <6adb71dc550c4ab1b3019f39fcdf3c91@cea.fr> <25e7d71fb7e94154b89da408d2e02542@cea.fr> Message-ID: <1417683F-323D-43E5-B52E-6FC4B9E7F279@gmail.com> 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? 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 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 > https://mail.python.org/mailman/listinfo/astropy -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: astropy_logo.ico Type: image/vnd.microsoft.icon Size: 32988 bytes Desc: not available URL: From pierre.didelon at cea.fr Thu Aug 10 12:18:18 2023 From: pierre.didelon at cea.fr (Didelon Pierre) Date: Thu, 10 Aug 2023 16:18:18 +0000 Subject: [AstroPy] using astropy.coordinates.angular_separation() In-Reply-To: <1417683F-323D-43E5-B52E-6FC4B9E7F279@gmail.com> References: <6adb71dc550c4ab1b3019f39fcdf3c91@cea.fr> <25e7d71fb7e94154b89da408d2e02542@cea.fr>, <1417683F-323D-43E5-B52E-6FC4B9E7F279@gmail.com> Message-ID: <498e8960a2134683bc0cf55bb24bd430@cea.fr> 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 de la part de John ZuHone 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: Astronomical Coordinate Systems (astropy.coordinates) ? Astropy v2.0.16 docs.astropy.org [astropy_logo.ico] 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 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 https://mail.python.org/mailman/listinfo/astropy -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- 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: From m.shemuni at gmail.com Thu Aug 10 13:11:29 2023 From: m.shemuni at gmail.com (Mohammad Shameoni Niaei) Date: Thu, 10 Aug 2023 20:11:29 +0300 Subject: [AstroPy] using astropy.coordinates.angular_separation() In-Reply-To: <498e8960a2134683bc0cf55bb24bd430@cea.fr> References: <6adb71dc550c4ab1b3019f39fcdf3c91@cea.fr> <25e7d71fb7e94154b89da408d2e02542@cea.fr> <1417683F-323D-43E5-B52E-6FC4B9E7F279@gmail.com> <498e8960a2134683bc0cf55bb24bd430@cea.fr> Message-ID: Hello Didelon Then your best approach can be to implement your own angular_separation. The source code is available here: https://docs.astropy.org/en/stable/_modules/astropy/coordinates/angle_utilities.html#angular_separation It is only a function. You can copy and paste it to a file and import it from there... On Thu, Aug 10, 2023 at 7:39?PM Didelon Pierre wrote: > 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 de la > part de John ZuHone > *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: > > Astronomical Coordinate Systems (astropy.coordinates) ? Astropy v2.0.16 > > docs.astropy.org > > > > > > 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 > 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 > https://mail.python.org/mailman/listinfo/astropy > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- Mohammad Shameoni Niaei Astronomer -------------- next part -------------- An HTML attachment was scrubbed... URL: From parejkoj at uw.edu Thu Aug 10 13:32:13 2023 From: parejkoj at uw.edu (John Parejko) Date: Thu, 10 Aug 2023 10:32:13 -0700 Subject: [AstroPy] using astropy.coordinates.angular_separation() In-Reply-To: <498e8960a2134683bc0cf55bb24bd430@cea.fr> References: <6adb71dc550c4ab1b3019f39fcdf3c91@cea.fr> <25e7d71fb7e94154b89da408d2e02542@cea.fr> <1417683F-323D-43E5-B52E-6FC4B9E7F279@gmail.com> <498e8960a2134683bc0cf55bb24bd430@cea.fr> Message-ID: There are tools to help automatically transition code from 2 to 3. python2 is no longer supported, and no major projects are producing or updating libraries for python2, so you're just making your own life much more difficult. A few thousand lines of code should be quite easy to do: LSST transitioned about 300,000 lines of code in early 2018. https://community.lsst.org/t/python-2-no-longer-supported/2845/2 Here is the official transition tool that will take care of most of the necessary changes: https://docs.python.org/3/library/2to3.html Note that 2to3 is will be removed in python 3.13, so I definitely recommend doing that transition now. It's probably less work than implementing your own separation code. John -- ************************* John Parejko parejkoj at uw.edu Rubin Observatory, DIRAC Fellow http://staff.washington.edu/parejkoj/ Department of Physics and Astronomy University of Washington, Seattle, WA ************************** > On Aug 10, 2023, at 9:18 AM, Didelon Pierre wrote: > > 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 de la part de John ZuHone > 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: > > > > 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 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 >> https://mail.python.org/mailman/listinfo/astropy > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/astropy__;!!K-Hz7m0Vt54!ifnTLYBvhdLDK2fGtbvr2KBZVF9Vhnm9D9PuvOdAg55kZqAp-Ztrmi7UHWtbNqG3-bJTttqINltnwS88_dDs0pSi$ From richard.moffat at gmail.com Fri Aug 11 00:42:17 2023 From: richard.moffat at gmail.com (Richard Moffat) Date: Fri, 11 Aug 2023 16:42:17 +1200 Subject: [AstroPy] using astropy.coordinates.angular_separation() In-Reply-To: References: <6adb71dc550c4ab1b3019f39fcdf3c91@cea.fr> <25e7d71fb7e94154b89da408d2e02542@cea.fr> <1417683F-323D-43E5-B52E-6FC4B9E7F279@gmail.com> <498e8960a2134683bc0cf55bb24bd430@cea.fr> Message-ID: I just want to mirror what John said about converting 2.7 to 3.x. It may be a lot simpler than you think. My last two companies have converted thousands of files. Python 2.7 is dead and it is exponentially more difficult to keep as time goes on. *Noho ora mai,* *All the best,* Richard Moffat. ============================================================== richard.moffat at gmail.com ============================================================== On Fri, 11 Aug 2023 at 05:33, John Parejko wrote: > There are tools to help automatically transition code from 2 to 3. python2 > is no longer supported, and no major projects are producing or updating > libraries for python2, so you're just making your own life much more > difficult. A few thousand lines of code should be quite easy to do: LSST > transitioned about 300,000 lines of code in early 2018. > > https://community.lsst.org/t/python-2-no-longer-supported/2845/2 > > Here is the official transition tool that will take care of most of the > necessary changes: > > https://docs.python.org/3/library/2to3.html > > Note that 2to3 is will be removed in python 3.13, so I definitely > recommend doing that transition now. It's probably less work than > implementing your own separation code. > > John > > -- > ************************* > John Parejko > parejkoj at uw.edu > Rubin Observatory, DIRAC Fellow > http://staff.washington.edu/parejkoj/ > Department of Physics and Astronomy > University of Washington, Seattle, WA > ************************** > > > On Aug 10, 2023, at 9:18 AM, Didelon Pierre > wrote: > > > > 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 de la > part de John ZuHone > > 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: > > > > > > > > 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 > 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 > >> https://mail.python.org/mailman/listinfo/astropy > > > > > > _______________________________________________ > > AstroPy mailing list > > AstroPy at python.org > > > https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/astropy__;!!K-Hz7m0Vt54!ifnTLYBvhdLDK2fGtbvr2KBZVF9Vhnm9D9PuvOdAg55kZqAp-Ztrmi7UHWtbNqG3-bJTttqINltnwS88_dDs0pSi$ > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -------------- next part -------------- An HTML attachment was scrubbed... URL: