From npkuin at gmail.com Fri May 1 03:34:19 2020 From: npkuin at gmail.com (Paul Kuin) Date: Fri, 1 May 2020 08:34:19 +0100 Subject: [AstroPy] VOTable problems In-Reply-To: <28E4842B-5C1A-4C75-87A1-759154E54D15@astro.physik.uni-goettingen.de> References: <29869684-3272-4038-A85A-FE6FC14D34E2@astro.physik.uni-goettingen.de> <28E4842B-5C1A-4C75-87A1-759154E54D15@astro.physik.uni-goettingen.de> Message-ID: Dear Derek, On Thu, Apr 30, 2020 at 8:04 PM Derek Homeier wrote: > > Hi Rick, > > > > astropy.units.core.UnitScaleError: The column 'mass' could not be stored in FITS format because it has a scale '(1.0)' that is not recognized by the FITS standard. Either scale the data or change the units. > > > > If one deletes the unit of the "mass" column, everything is ok. If one uses a FITS-compatible unit like "solMass", everything is ok. Thus, the problem is that the astropy implementation of converting a votable input into a FITS output won't accept non-FITS units. The IVOA standard allows one to use any reasonable units and suggests that one follow the style of the FITS standard, but "jovMass" (Jovian masses, in the same syntax as "solMass" = Solar masses) isn't a FITS standard. Generally, the IVOA standard should be the measure of things. There are lots of tables that don't want to have to use wierd units like the FITS-acceptable "solMass/1047" or "1.8982e27*solMass?. > > > the IVOA standard actually allows the user to invent any kind of units, reasonable or not. > Jovian or Jupiter masses, radii etc. per the VOUnit standard are not ?known? units either, > but simply ?unrecognised units? that a parser is expected to accept. > So transforming everything that the VOTable format would permit to FITS is a challenging task. > For FITS, the measure of things is the official standard accepted and published by the IAU, and > the principal philosophy of astropy?s fits module is to be forgiving on input, but strict with output: https://docs.astropy.org/en/latest/io/fits/usage/verification.html#verification > Further down it also states that any of these verification rules can be changed to the ?warn? or ?silent? > level if explicitly requested, but that admittedly does not make life much easier, since none of these > options are accepted by the convenience functions for directly creating HDUs from tables. > As long as one has identifiable units, the easier solution will probably still be converting to a > standard-conforming unit as suggested in my first reply: > > > tab[col] = tab[col].to(tab[col].unit.to_system(u.si)[0].bases[0]) > > Again, admittedly fairly awkward syntax (unless someone can suggest a more straightforward way > to code this), but least you don?t need to treat every unit individually. Though you might of course > prefer ?Mjup? to ?kg? in your example? > And it would certainly be nice to have an option for making `table_to_hdu` take care of this automatically. > > > astropy should simply send a warning, saying that the FITS file created doesn't conform to the nominal FITS standard, but who cares, as long as the data has been stored. > > > > The problem Doug mentioned has to do with strings: note that above I used a FIELD with the following syntax > > > > > > > > Had I used the IVOA standard syntax > > > > > > > > (i.e. strings of varying length), I would have gotten the problem with string objects mentioned by Doug. The astropy implementation doesn't implement the standard IVOA syntax in a fashion that leads to a correct translation into FITS. > > > The astropy implementation should implement the standard in a way that is correctly reading VOTable files > into functional astropy Tables. Translation into FITS format is quite a different thing, especially with the two > following somewhat distinct standards. Acceptance of physical and nonphysical units is one example you?ve > pointed out; variable-length or -width table entries another that I think is very hard to accommodate in FITS. > > > Yet another reason (other than the total lack of metadata storage) to work over the votable implementation. A great task for a younger and better programmer than me.... > > If you could file an issue on GitHub with the specific problems arising with your data, that would certainly > help keeping it on the radar. Having someone able to devote a substantial part of their workforce to that > task would of course help as well, but at least for the FITS side some familiarity with the over two decades > of development history of PyFITS and astropy io.fits combined could probably also come in handy. ;-) > > Cheers, > Derek > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy -- * * * * * * * * http://www.mssl.ucl.ac.uk/~npmk/ * * * * N.P.M. Kuin (n.kuin at ucl.ac.uk) -- phone +44-(0)1483 (prefix) -204111 (work) -- mobile +44(0)7908715953 -- skype ID: npkuin Mullard Space Science Laboratory ? University College London ? Holmbury St Mary ? Dorking ? Surrey RH5 6NT? U.K. From npkuin at gmail.com Fri May 1 03:58:37 2020 From: npkuin at gmail.com (Paul Kuin) Date: Fri, 1 May 2020 08:58:37 +0100 Subject: [AstroPy] VOTable problems In-Reply-To: <28E4842B-5C1A-4C75-87A1-759154E54D15@astro.physik.uni-goettingen.de> References: <29869684-3272-4038-A85A-FE6FC14D34E2@astro.physik.uni-goettingen.de> <28E4842B-5C1A-4C75-87A1-759154E54D15@astro.physik.uni-goettingen.de> Message-ID: Dear Derek, see below : fits does allow On Thu, Apr 30, 2020 at 8:04 PM Derek Homeier wrote: > > Hi Rick, > > > > astropy.units.core.UnitScaleError: The column 'mass' could not be stored in FITS format because it has a scale '(1.0)' that is not recognized by the FITS standard. Either scale the data or change the units. > > > > If one deletes the unit of the "mass" column, everything is ok. If one uses a FITS-compatible unit like "solMass", everything is ok. Thus, the problem is that the astropy implementation of converting a votable input into a FITS output won't accept non-FITS units. The IVOA standard allows one to use any reasonable units and suggests that one follow the style of the FITS standard, but "jovMass" (Jovian masses, in the same syntax as "solMass" = Solar masses) isn't a FITS standard. Generally, the IVOA standard should be the measure of things. There are lots of tables that don't want to have to use wierd units like the FITS-acceptable "solMass/1047" or "1.8982e27*solMass?. > > > the IVOA standard actually allows the user to invent any kind of units, reasonable or not. > Jovian or Jupiter masses, radii etc. per the VOUnit standard are not ?known? units either, > but simply ?unrecognised units? that a parser is expected to accept. > So transforming everything that the VOTable format would permit to FITS is a challenging task. > For FITS, the measure of things is the official standard accepted and published by the IAU, and > the principal philosophy of astropy?s fits module is to be forgiving on input, but strict with output: https://docs.astropy.org/en/latest/io/fits/usage/verification.html#verification > Further down it also states that any of these verification rules can be changed to the ?warn? or ?silent? > level if explicitly requested, but that admittedly does not make life much easier, since none of these > options are accepted by the convenience functions for directly creating HDUs from tables. > As long as one has identifiable units, the easier solution will probably still be converting to a > standard-conforming unit as suggested in my first reply: > > > tab[col] = tab[col].to(tab[col].unit.to_system(u.si)[0].bases[0]) > > Again, admittedly fairly awkward syntax (unless someone can suggest a more straightforward way > to code this), but least you don?t need to treat every unit individually. Though you might of course > prefer ?Mjup? to ?kg? in your example? > And it would certainly be nice to have an option for making `table_to_hdu` take care of this automatically. > > > astropy should simply send a warning, saying that the FITS file created doesn't conform to the nominal FITS standard, but who cares, as long as the data has been stored. > > > > The problem Doug mentioned has to do with strings: note that above I used a FIELD with the following syntax > > > > > > > > Had I used the IVOA standard syntax > > > > > > > > (i.e. strings of varying length), I would have gotten the problem with string objects mentioned by Doug. The astropy implementation doesn't implement the standard IVOA syntax in a fashion that leads to a correct translation into FITS. > > > The astropy implementation should implement the standard in a way that is correctly reading VOTable files > into functional astropy Tables. Translation into FITS format is quite a different thing, especially with the two > following somewhat distinct standards. Acceptance of physical and nonphysical units is one example you?ve > pointed out; variable-length or -width table entries another that I think is very hard to accommodate in FITS. > I think that when we developed the FITS standard, we did not restrict it to use only certain units. In fact, there were at the time at least two different sets of units recommended, one by HEASARC, one by the CDS. So FITS is 'flexible' on that. That is my understanding. Astropy seems to need more constraints, but the one with writing the units is clearly not needed. The FITS standard v4.0 is clear on this: using IAU units is a recommendation, the wording uses "should" not "must". Variable length tables are more different to use, but section 2.7 of the FITS standard V4.0 specified that it can be done in the binary table environment. Cheers, Paul -- * * * * * * * * http://www.mssl.ucl.ac.uk/~npmk/ * * * * N.P.M. Kuin (n.kuin at ucl.ac.uk) -- phone +44-(0)1483 (prefix) -204111 (work) -- mobile +44(0)7908715953 -- skype ID: npkuin Mullard Space Science Laboratory ? University College London ? Holmbury St Mary ? Dorking ? Surrey RH5 6NT? U.K. From Paolo.Tanga at oca.eu Fri May 1 04:01:56 2020 From: Paolo.Tanga at oca.eu (Paolo Tanga) Date: Fri, 1 May 2020 10:01:56 +0200 Subject: [AstroPy] consistency of reference frames between SkyCoord and JPL Horizons In-Reply-To: <22CE4992-8000-4540-9E3E-9923EBC785C9@swarthmore.edu> References: <17418b6b-8206-0aee-7a0d-95911be364f1@oca.eu> <22CE4992-8000-4540-9E3E-9923EBC785C9@swarthmore.edu> Message-ID: An HTML attachment was scrubbed... URL: From Paolo.Tanga at oca.eu Fri May 1 04:13:59 2020 From: Paolo.Tanga at oca.eu (Paolo Tanga) Date: Fri, 1 May 2020 10:13:59 +0200 Subject: [AstroPy] Problems with solar system ephemerides In-Reply-To: <92f5421d-d660-fd06-3a9b-54b127a46337@astro.umass.edu> References: <92f5421d-d660-fd06-3a9b-54b127a46337.ref@astro.umass.edu> <92f5421d-d660-fd06-3a9b-54b127a46337@astro.umass.edu> Message-ID: <3de5d9ee-e0df-7aec-ef0d-391838c98545@oca.eu> Hi Michael - and the list I noticed this: On 29/04/2020 17:47, Michael Brewer wrote: > > Issue #3: This is a fairly minor quibble, but the functions atciqz() > and aticq() are calculating the gravitational light deflection from > the Sun incorrectly. The third argument of erfa.ld() should be the > time delayed heliocentric position vector of the target body. I do > realize that SOFA has this problem also. I suspect (hope) this has really a very minor impact (micro-as level?). But there is another concern here. As far as I can understand from the source code of the functions that you mention (and the function they call) the gravitational light bending is ALWAYS computed for a source assumed to be "far" (=a star). This means that for a Solar System object (asteroid for intance) the result is wrong. It is easy to understand the physics: for a light beam that travels for a shorter distance in the gravity field of the Sun, bending is smaller. For typical Main Belt asteroids, the difference is of the order of 50% of the stellar light bending in the same direction (a few mas), of course larger at small Solar elongations. So, my questions are: - Can you confirm that astropy does not use a "planetary" version of the light bending, but only its "stellar" version ? - Would it be possible by having this feature corrected? (I would really like to be a SOFA expert and be able to contribute myself...) Paolo -- --------------------------------------------------------------------- Paolo Tanga Astronomer Deputy director of Laboratoire Langrange / UMR 7293 Observatoire de la C?te d'Azur Tel +33(0)492003042 Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 06304 Nice Cedex 4 - France http://www.oca.eu/tanga https://twitter.com/ziggypao From s.littlefair at sheffield.ac.uk Fri May 1 05:00:35 2020 From: s.littlefair at sheffield.ac.uk (Stuart P Littlefair) Date: Fri, 1 May 2020 10:00:35 +0100 Subject: [AstroPy] Problems with solar system ephemerides In-Reply-To: <3de5d9ee-e0df-7aec-ef0d-391838c98545@oca.eu> References: <92f5421d-d660-fd06-3a9b-54b127a46337.ref@astro.umass.edu> <92f5421d-d660-fd06-3a9b-54b127a46337@astro.umass.edu> <3de5d9ee-e0df-7aec-ef0d-391838c98545@oca.eu> Message-ID: Hi Paolo, Your suspicion is correct; the light deflection from the Sun is calculated assuming a distant source. Fixing this is not trivial, from a quick look. It might be easy enough to turn light deflection off for nearby bodies, but anything more sophisticated than that will probably require a better model of light deflection than is implemented in SOFA/ERFA. Stuart On Fri, 1 May 2020 at 09:14, Paolo Tanga wrote: > Hi Michael - and the list > > I noticed this: > > On 29/04/2020 17:47, Michael Brewer wrote: > > > > Issue #3: This is a fairly minor quibble, but the functions atciqz() > > and aticq() are calculating the gravitational light deflection from > > the Sun incorrectly. The third argument of erfa.ld() should be the > > time delayed heliocentric position vector of the target body. I do > > realize that SOFA has this problem also. > > I suspect (hope) this has really a very minor impact (micro-as level?). > > But there is another concern here. As far as I can understand from the > source code of the functions that you mention (and the function they > call) the gravitational light bending is ALWAYS computed for a source > assumed to be "far" (=a star). This means that for a Solar System object > (asteroid for intance) the result is wrong. It is easy to understand the > physics: for a light beam that travels for a shorter distance in the > gravity field of the Sun, bending is smaller. > > For typical Main Belt asteroids, the difference is of the order of 50% > of the stellar light bending in the same direction (a few mas), of > course larger at small Solar elongations. > > So, my questions are: > > - Can you confirm that astropy does not use a "planetary" version of the > light bending, but only its "stellar" version ? > > - Would it be possible by having this feature corrected? > > (I would really like to be a SOFA expert and be able to contribute > myself...) > > Paolo > > -- > --------------------------------------------------------------------- > Paolo Tanga Astronomer > Deputy director of Laboratoire Langrange / UMR 7293 > Observatoire de la C?te d'Azur Tel +33(0)492003042 > Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 > 06304 Nice Cedex 4 - France http://www.oca.eu/tanga > https://twitter.com/ziggypao > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- Stuart Littlefair ------------------------------------------------------- *I don't expect you to respond to my email outside your working hours. * *At the University of Sheffield we value and encourage flexible working patterns, so please be assured that I respect your working pattern and I am looking forward to your response when you are next working. * ------------------------------------------------------- Dept. of Physics & Astronomy, Univ. of Sheffield, Sheffield, S3 7RH. email: S.Littlefair at sheffield.ac.uk phone: +44 114 2224525 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Paolo.Tanga at oca.eu Fri May 1 06:01:06 2020 From: Paolo.Tanga at oca.eu (Paolo Tanga) Date: Fri, 1 May 2020 12:01:06 +0200 Subject: [AstroPy] Problems with solar system ephemerides In-Reply-To: References: <92f5421d-d660-fd06-3a9b-54b127a46337.ref@astro.umass.edu> <92f5421d-d660-fd06-3a9b-54b127a46337@astro.umass.edu> <3de5d9ee-e0df-7aec-ef0d-391838c98545@oca.eu> Message-ID: <088dacac-301e-be53-d9d6-2ca442e1c364@oca.eu> An HTML attachment was scrubbed... URL: From s.littlefair at sheffield.ac.uk Fri May 1 06:07:16 2020 From: s.littlefair at sheffield.ac.uk (Stuart P Littlefair) Date: Fri, 1 May 2020 11:07:16 +0100 Subject: [AstroPy] Problems with solar system ephemerides In-Reply-To: <088dacac-301e-be53-d9d6-2ca442e1c364@oca.eu> References: <92f5421d-d660-fd06-3a9b-54b127a46337.ref@astro.umass.edu> <92f5421d-d660-fd06-3a9b-54b127a46337@astro.umass.edu> <3de5d9ee-e0df-7aec-ef0d-391838c98545@oca.eu> <088dacac-301e-be53-d9d6-2ca442e1c364@oca.eu> Message-ID: Please do! If it is at all possible to provide some test data that would allow us to check the implementation is correct along with the issue that would be fantastic - although I appreciate this may depend upon implementation of frames that do not currently exist in astropy. Stuart On Fri, 1 May 2020 at 11:01, Paolo Tanga wrote: > Hi Stuart > > I investigated a little further, and it turns out that SOFA already > include that option! Provided that the iauLd function is exploited. Here is > the description from the SOFA document: > > The function iauLd is quite general. The algorithm is based on Eq. (70) > in Klioner (2003) and Eq. (7.63) in Urban & Seidelmann (2013), with some > rearrangement to minimize the impact of machine precision. Its arguments > include (among other things) the mass of the body and full details of the > geometrical arrangement. The latter means the function is valid for > solar-system targets as well as distant objects, which is not strictly true > for either iauLdsun or iauLdn. > > So this implies that if one uses iauLd everywhere (with a possibility to > fall back to iauLdsun or iauLdn for distant sources) the consistency is > ensured! > > Should I rise an issue on this - maybe somebody is able to fix? > > Paolo > On 01/05/2020 11:00, Stuart P Littlefair wrote: > > Hi Paolo, > > Your suspicion is correct; the light deflection from the Sun is calculated > assuming a distant source. > > Fixing this is not trivial, from a quick look. It might be easy enough to > turn light deflection off for nearby bodies, but anything more > sophisticated than that will probably require a better model of light > deflection than is implemented in SOFA/ERFA. > > Stuart > > On Fri, 1 May 2020 at 09:14, Paolo Tanga wrote: > >> Hi Michael - and the list >> >> I noticed this: >> >> On 29/04/2020 17:47, Michael Brewer wrote: >> > >> > Issue #3: This is a fairly minor quibble, but the functions atciqz() >> > and aticq() are calculating the gravitational light deflection from >> > the Sun incorrectly. The third argument of erfa.ld() should be the >> > time delayed heliocentric position vector of the target body. I do >> > realize that SOFA has this problem also. >> >> I suspect (hope) this has really a very minor impact (micro-as level?). >> >> But there is another concern here. As far as I can understand from the >> source code of the functions that you mention (and the function they >> call) the gravitational light bending is ALWAYS computed for a source >> assumed to be "far" (=a star). This means that for a Solar System object >> (asteroid for intance) the result is wrong. It is easy to understand the >> physics: for a light beam that travels for a shorter distance in the >> gravity field of the Sun, bending is smaller. >> >> For typical Main Belt asteroids, the difference is of the order of 50% >> of the stellar light bending in the same direction (a few mas), of >> course larger at small Solar elongations. >> >> So, my questions are: >> >> - Can you confirm that astropy does not use a "planetary" version of the >> light bending, but only its "stellar" version ? >> >> - Would it be possible by having this feature corrected? >> >> (I would really like to be a SOFA expert and be able to contribute >> myself...) >> >> Paolo >> >> -- >> --------------------------------------------------------------------- >> Paolo Tanga Astronomer >> Deputy director of Laboratoire Langrange / UMR 7293 >> Observatoire de la C?te d'Azur Tel +33(0)492003042 >> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >> 06304 Nice Cedex 4 - France http://www.oca.eu/tanga >> https://twitter.com/ziggypao >> >> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy >> > > > -- > Stuart Littlefair > > ------------------------------------------------------- > > *I don't expect you to respond to my email outside your working hours. * > > *At the University of Sheffield we value and encourage flexible working > patterns, so please be assured that I respect your working pattern and I am > looking forward to your response when you are next working. * > > ------------------------------------------------------- > > Dept. of Physics & Astronomy, > Univ. of Sheffield, Sheffield, S3 7RH. > > email: S.Littlefair at sheffield.ac.uk > phone: +44 114 2224525 > > -- > --------------------------------------------------------------------- > Paolo Tanga Astronomer > Deputy director of Laboratoire Langrange / UMR 7293 > Observatoire de la C?te d'Azur Tel +33(0)492003042 > Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 > 06304 Nice Cedex 4 - France http://www.oca.eu/tanga > https://twitter.com/ziggypao > > -- Stuart Littlefair ------------------------------------------------------- *I don't expect you to respond to my email outside your working hours. * *At the University of Sheffield we value and encourage flexible working patterns, so please be assured that I respect your working pattern and I am looking forward to your response when you are next working. * ------------------------------------------------------- Dept. of Physics & Astronomy, Univ. of Sheffield, Sheffield, S3 7RH. email: S.Littlefair at sheffield.ac.uk phone: +44 114 2224525 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Paolo.Tanga at oca.eu Fri May 1 06:14:26 2020 From: Paolo.Tanga at oca.eu (Paolo Tanga) Date: Fri, 1 May 2020 12:14:26 +0200 Subject: [AstroPy] Problems with solar system ephemerides In-Reply-To: References: <92f5421d-d660-fd06-3a9b-54b127a46337.ref@astro.umass.edu> <92f5421d-d660-fd06-3a9b-54b127a46337@astro.umass.edu> <3de5d9ee-e0df-7aec-ef0d-391838c98545@oca.eu> <088dacac-301e-be53-d9d6-2ca442e1c364@oca.eu> Message-ID: An HTML attachment was scrubbed... URL: From derek at astro.physik.uni-goettingen.de Fri May 1 09:50:19 2020 From: derek at astro.physik.uni-goettingen.de (Derek Homeier) Date: Fri, 1 May 2020 15:50:19 +0200 Subject: [AstroPy] VOTable problems In-Reply-To: References: <29869684-3272-4038-A85A-FE6FC14D34E2@astro.physik.uni-goettingen.de> <28E4842B-5C1A-4C75-87A1-759154E54D15@astro.physik.uni-goettingen.de> Message-ID: <17420D0E-2C9D-4D3C-AA2B-2358BAB20660@astro.physik.uni-goettingen.de> Dear Paul, thanks for your comments! > On 1 May 2020, at 9:58 am, Paul Kuin wrote: > >>> (i.e. strings of varying length), I would have gotten the problem with string objects mentioned by Doug. The astropy implementation doesn't implement the standard IVOA syntax in a fashion that leads to a correct translation into FITS. >>> >> The astropy implementation should implement the standard in a way that is correctly reading VOTable files >> into functional astropy Tables. Translation into FITS format is quite a different thing, especially with the two >> following somewhat distinct standards. Acceptance of physical and nonphysical units is one example you?ve >> pointed out; variable-length or -width table entries another that I think is very hard to accommodate in FITS. >> > > I think that when we developed the FITS standard, we did not restrict > it to use only certain units. In fact, there were at the time at least > two different sets of units recommended, one by HEASARC, one by the > CDS. So FITS is 'flexible' on that. That is my understanding. Astropy > seems to need more constraints, but the one with writing the units is > clearly not needed. The FITS standard v4.0 is clear on this: using IAU > units is a recommendation, the wording uses "should" not "must?. > The ?should? actually refers to the even smaller subset of IAU-recommended units (i.e. SI and derived units from Table 3 of the standard), but indeed my memory was wrong in that it nowhere states that units ?shall? only be taken from the larger set of accepted units in Tables 3+4. However Table 4 is captioned ?Additional allowed units?, which could be read to imply that any other units are not ?allowed?. I cannot speak for Astropy?s ?io.fits? developer team, but my understanding is that they want to make files written with the software as standard-compliant as possible, while allowing to read anything that can be sensibly interpreted - again, following the philosophy of being ?tolerant with input and strict with output?. And they offer the option to override the `verify()` defaults to allow writing any other units. But again, this is only possible in the low-level HDU writing functions, so when working with table objects, it is almost as good as non-existent. I?d agree it is a reasonable request to propagate this option to the `Table.write` interface. > Variable length tables are more different to use, but section 2.7 of > the FITS standard V4.0 specified that it can be done in the binary > table environment. Yes, this is supported by astropy, although I don?t have much practical experience with those. But in the present case the problem was the variable-width string columns given by References: <92f5421d-d660-fd06-3a9b-54b127a46337.ref@astro.umass.edu> <92f5421d-d660-fd06-3a9b-54b127a46337@astro.umass.edu> <3de5d9ee-e0df-7aec-ef0d-391838c98545@oca.eu> <088dacac-301e-be53-d9d6-2ca442e1c364@oca.eu> Message-ID: <1ebb6365-22a4-6cda-1736-c61c2b41a668@astro.umass.edu> Paolo and Stuart, void iauLd(double bm, double p[3], double q[3], double e[3], double em, double dlim, double p1[3]) ** Given: ** bm double mass of the gravitating body (solar masses) ** p double[3] direction from observer to source (unit vector) ** q double[3] direction from body to source (unit vector) ** e double[3] direction from body to observer (unit vector) ** em double distance from body to observer (au) ** dlim double deflection limiter (Note 4) The main issue here is that the functions atciqz() and aticq() that call ld() are treating the arguments p and q as identical (q = p). This is true for a source at infinity, but not for a source within the solar system. In that case, the argument q should be the appropriately light delayed position vector of the source as seen from the center of the Sun. Regards, Michael Brewer On 05/01/2020 06:14 AM, Paolo Tanga wrote: > > Stuart > > ok thanks! I will do, and try to figure out a test for this case > > Paolo > > On 01/05/2020 12:07, Stuart P Littlefair wrote: >> Please do! >> >> If it is at all possible to provide some test data that would allow >> us to check the implementation is correct along with the issue that >> would be fantastic - although I appreciate this may depend upon >> implementation of frames that do not currently exist in astropy. >> >> Stuart >> >> On Fri, 1 May 2020 at 11:01, Paolo Tanga > > wrote: >> >> Hi Stuart >> >> I investigated a little further, and it turns out that SOFA >> already include that option! Provided that the iauLd function is >> exploited. Here is the description from the SOFA document: >> >>> The function iauLd is quite general. The algorithm is based on >>> Eq. (70) in Klioner (2003) and Eq. (7.63) in Urban & Seidelmann >>> (2013), with some rearrangement to minimize the impact of >>> machine precision. Its arguments include (among other things) >>> the mass of the body and full details of the geometrical >>> arrangement. The latter means the function is valid for >>> solar-system targets as well as distant objects, which is not >>> strictly true for either iauLdsun or iauLdn. >>> >> So this implies that if one uses iauLd everywhere (with a >> possibility to fall back to iauLdsun or iauLdn for distant >> sources) the consistency is ensured! >> >> Should I rise an issue on this - maybe somebody is able to fix? >> >> Paolo >> >> On 01/05/2020 11:00, Stuart P Littlefair wrote: >>> Hi Paolo, >>> >>> Your suspicion is correct; the light deflection from the Sun is >>> calculated assuming a distant source. >>> >>> Fixing this is not trivial, from a quick look. It might be easy >>> enough to turn light deflection off for nearby bodies, but >>> anything more sophisticated than that will probably require a >>> better model of light deflection than is implemented in SOFA/ERFA. >>> >>> Stuart >>> >>> On Fri, 1 May 2020 at 09:14, Paolo Tanga >> > wrote: >>> >>> Hi Michael - and the list >>> >>> I noticed this: >>> >>> On 29/04/2020 17:47, Michael Brewer wrote: >>> > >>> > Issue #3: This is a fairly minor quibble, but the >>> functions atciqz() >>> > and aticq() are calculating the gravitational light >>> deflection from >>> > the Sun incorrectly. The third argument of erfa.ld() >>> should be the >>> > time delayed heliocentric position vector of the target >>> body. I do >>> > realize that SOFA has this problem also. >>> >>> I suspect (hope) this has really a very minor impact >>> (micro-as level?). >>> >>> But there is another concern here. As far as I can >>> understand from the >>> source code of the functions that you mention (and the >>> function they >>> call) the gravitational light bending is ALWAYS computed for >>> a source >>> assumed to be "far" (=a star). This means that for a Solar >>> System object >>> (asteroid for intance) the result is wrong. It is easy to >>> understand the >>> physics: for a light beam that travels for a shorter >>> distance in the >>> gravity field of the Sun, bending is smaller. >>> >>> For typical Main Belt asteroids, the difference is of the >>> order of 50% >>> of the stellar light bending in the same direction (a few >>> mas), of >>> course larger at small Solar elongations. >>> >>> So, my questions are: >>> >>> - Can you confirm that astropy does not use a "planetary" >>> version of the >>> light bending, but only its "stellar" version ? >>> >>> - Would it be possible by having this feature corrected? >>> >>> (I would really like to be a SOFA expert and be able to >>> contribute >>> myself...) >>> >>> Paolo >>> >>> -- >>> --------------------------------------------------------------------- >>> Paolo Tanga Astronomer >>> Deputy director of Laboratoire Langrange / UMR 7293 >>> Observatoire de la C?te d'Azur Tel +33(0)492003042 >>> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >>> 06304 Nice Cedex 4 - France http://www.oca.eu/tanga >>> https://twitter.com/ziggypao >>> >>> _______________________________________________ >>> AstroPy mailing list >>> AstroPy at python.org >>> https://mail.python.org/mailman/listinfo/astropy >>> >>> >>> >>> -- >>> Stuart Littlefair >>> >>> ------------------------------------------------------- >>> >>> */I don't expect you to respond to my email outside your working >>> hours. /* >>> / >>> / >>> /At the University of Sheffield we value and encourage flexible >>> working patterns, so please be assured that I respect your >>> working pattern and I am looking forward to your response when >>> you are next working. / >>> / >>> / >>> ------------------------------------------------------- >>> >>> Dept. of Physics & Astronomy, >>> Univ. of Sheffield, Sheffield, S3 7RH. >>> >>> email: S.Littlefair at sheffield.ac.uk >>> >>> phone: +44 114 2224525 >> >> -- >> --------------------------------------------------------------------- >> Paolo Tanga Astronomer >> Deputy director of Laboratoire Langrange / UMR 7293 >> Observatoire de la C?te d'Azur Tel +33(0)492003042 >> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >> 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga >> https://twitter.com/ziggypao >> >> >> >> -- >> Stuart Littlefair >> >> ------------------------------------------------------- >> >> */I don't expect you to respond to my email outside your working >> hours. /* >> / >> / >> /At the University of Sheffield we value and encourage flexible >> working patterns, so please be assured that I respect your working >> pattern and I am looking forward to your response when you are next >> working. / >> / >> / >> ------------------------------------------------------- >> >> Dept. of Physics & Astronomy, >> Univ. of Sheffield, Sheffield, S3 7RH. >> >> email: S.Littlefair at sheffield.ac.uk >> >> phone: +44 114 2224525 > -- > --------------------------------------------------------------------- > Paolo Tanga Astronomer > Deputy director of Laboratoire Langrange / UMR 7293 > Observatoire de la C?te d'Azur Tel +33(0)492003042 > Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 > 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga > https://twitter.com/ziggypao > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.littlefair at sheffield.ac.uk Fri May 1 11:27:35 2020 From: s.littlefair at sheffield.ac.uk (Stuart P Littlefair) Date: Fri, 1 May 2020 16:27:35 +0100 Subject: [AstroPy] Problems with solar system ephemerides In-Reply-To: <1ebb6365-22a4-6cda-1736-c61c2b41a668@astro.umass.edu> References: <92f5421d-d660-fd06-3a9b-54b127a46337.ref@astro.umass.edu> <92f5421d-d660-fd06-3a9b-54b127a46337@astro.umass.edu> <3de5d9ee-e0df-7aec-ef0d-391838c98545@oca.eu> <088dacac-301e-be53-d9d6-2ca442e1c364@oca.eu> <1ebb6365-22a4-6cda-1736-c61c2b41a668@astro.umass.edu> Message-ID: Agreed - there's also another point of trouble which is that the transformations strip out the distance before calling aticqz and aticq so that needs to be changed as well. We also ignore the objects space motion when calculating these transformations which affects aberrations etc. When the 4.1 release is over it is probably time to have a look at all of these issues. On Fri, 1 May 2020 at 15:51, Michael Brewer wrote: > Paolo and Stuart, > > void iauLd(double bm, double p[3], double q[3], double e[3], > double em, double dlim, double p1[3]) > ** Given: > ** bm double mass of the gravitating body (solar masses) > ** p double[3] direction from observer to source (unit vector) > ** q double[3] direction from body to source (unit vector) > ** e double[3] direction from body to observer (unit vector) > ** em double distance from body to observer (au) > ** dlim double deflection limiter (Note 4) > > The main issue here is that the functions atciqz() and aticq() that > call ld() are treating the arguments p and q as identical (q = p). This is > true for a source at infinity, but not for a source within the solar > system. In that case, the argument q should be the appropriately light > delayed position vector of the source as seen from the center of the Sun. > > Regards, > > Michael Brewer > > On 05/01/2020 06:14 AM, Paolo Tanga wrote: > > Stuart > > ok thanks! I will do, and try to figure out a test for this case > > Paolo > On 01/05/2020 12:07, Stuart P Littlefair wrote: > > Please do! > > If it is at all possible to provide some test data that would allow us to > check the implementation is correct along with the issue that would be > fantastic - although I appreciate this may depend upon implementation of > frames that do not currently exist in astropy. > > Stuart > > On Fri, 1 May 2020 at 11:01, Paolo Tanga wrote: > >> Hi Stuart >> >> I investigated a little further, and it turns out that SOFA already >> include that option! Provided that the iauLd function is exploited. Here is >> the description from the SOFA document: >> >> The function iauLd is quite general. The algorithm is based on Eq. (70) >> in Klioner (2003) and Eq. (7.63) in Urban & Seidelmann (2013), with some >> rearrangement to minimize the impact of machine precision. Its arguments >> include (among other things) the mass of the body and full details of the >> geometrical arrangement. The latter means the function is valid for >> solar-system targets as well as distant objects, which is not strictly true >> for either iauLdsun or iauLdn. >> >> So this implies that if one uses iauLd everywhere (with a possibility to >> fall back to iauLdsun or iauLdn for distant sources) the consistency is >> ensured! >> >> Should I rise an issue on this - maybe somebody is able to fix? >> >> Paolo >> On 01/05/2020 11:00, Stuart P Littlefair wrote: >> >> Hi Paolo, >> >> Your suspicion is correct; the light deflection from the Sun is >> calculated assuming a distant source. >> >> Fixing this is not trivial, from a quick look. It might be easy enough to >> turn light deflection off for nearby bodies, but anything more >> sophisticated than that will probably require a better model of light >> deflection than is implemented in SOFA/ERFA. >> >> Stuart >> >> On Fri, 1 May 2020 at 09:14, Paolo Tanga wrote: >> >>> Hi Michael - and the list >>> >>> I noticed this: >>> >>> On 29/04/2020 17:47, Michael Brewer wrote: >>> > >>> > Issue #3: This is a fairly minor quibble, but the functions atciqz() >>> > and aticq() are calculating the gravitational light deflection from >>> > the Sun incorrectly. The third argument of erfa.ld() should be the >>> > time delayed heliocentric position vector of the target body. I do >>> > realize that SOFA has this problem also. >>> >>> I suspect (hope) this has really a very minor impact (micro-as level?). >>> >>> But there is another concern here. As far as I can understand from the >>> source code of the functions that you mention (and the function they >>> call) the gravitational light bending is ALWAYS computed for a source >>> assumed to be "far" (=a star). This means that for a Solar System object >>> (asteroid for intance) the result is wrong. It is easy to understand the >>> physics: for a light beam that travels for a shorter distance in the >>> gravity field of the Sun, bending is smaller. >>> >>> For typical Main Belt asteroids, the difference is of the order of 50% >>> of the stellar light bending in the same direction (a few mas), of >>> course larger at small Solar elongations. >>> >>> So, my questions are: >>> >>> - Can you confirm that astropy does not use a "planetary" version of the >>> light bending, but only its "stellar" version ? >>> >>> - Would it be possible by having this feature corrected? >>> >>> (I would really like to be a SOFA expert and be able to contribute >>> myself...) >>> >>> Paolo >>> >>> -- >>> --------------------------------------------------------------------- >>> Paolo Tanga Astronomer >>> Deputy director of Laboratoire Langrange / UMR 7293 >>> Observatoire de la C?te d'Azur Tel +33(0)492003042 >>> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >>> 06304 Nice Cedex 4 - France http://www.oca.eu/tanga >>> https://twitter.com/ziggypao >>> >>> _______________________________________________ >>> AstroPy mailing list >>> AstroPy at python.org >>> https://mail.python.org/mailman/listinfo/astropy >>> >> >> >> -- >> Stuart Littlefair >> >> ------------------------------------------------------- >> >> *I don't expect you to respond to my email outside your working hours. * >> >> *At the University of Sheffield we value and encourage flexible working >> patterns, so please be assured that I respect your working pattern and I am >> looking forward to your response when you are next working. * >> >> ------------------------------------------------------- >> >> Dept. of Physics & Astronomy, >> Univ. of Sheffield, Sheffield, S3 7RH. >> >> email: S.Littlefair at sheffield.ac.uk >> phone: +44 114 2224525 >> >> -- >> --------------------------------------------------------------------- >> Paolo Tanga Astronomer >> Deputy director of Laboratoire Langrange / UMR 7293 >> Observatoire de la C?te d'Azur Tel +33(0)492003042 >> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >> 06304 Nice Cedex 4 - France http://www.oca.eu/tanga >> https://twitter.com/ziggypao >> >> > > -- > Stuart Littlefair > > ------------------------------------------------------- > > *I don't expect you to respond to my email outside your working hours. * > > *At the University of Sheffield we value and encourage flexible working > patterns, so please be assured that I respect your working pattern and I am > looking forward to your response when you are next working. * > > ------------------------------------------------------- > > Dept. of Physics & Astronomy, > Univ. of Sheffield, Sheffield, S3 7RH. > > email: S.Littlefair at sheffield.ac.uk > phone: +44 114 2224525 > > -- > --------------------------------------------------------------------- > Paolo Tanga Astronomer > Deputy director of Laboratoire Langrange / UMR 7293 > Observatoire de la C?te d'Azur Tel +33(0)492003042 > Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 > 06304 Nice Cedex 4 - France http://www.oca.eu/tanga > https://twitter.com/ziggypao > > > > _______________________________________________ > AstroPy mailing listAstroPy at python.orghttps://mail.python.org/mailman/listinfo/astropy > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- Stuart Littlefair ------------------------------------------------------- *I don't expect you to respond to my email outside your working hours. * *At the University of Sheffield we value and encourage flexible working patterns, so please be assured that I respect your working pattern and I am looking forward to your response when you are next working. * ------------------------------------------------------- Dept. of Physics & Astronomy, Univ. of Sheffield, Sheffield, S3 7RH. email: S.Littlefair at sheffield.ac.uk phone: +44 114 2224525 -------------- next part -------------- An HTML attachment was scrubbed... URL: From brewer at astro.umass.edu Fri May 1 17:20:36 2020 From: brewer at astro.umass.edu (Michael Brewer) Date: Fri, 1 May 2020 17:20:36 -0400 Subject: [AstroPy] consistency of reference frames between SkyCoord and JPL Horizons In-Reply-To: References: <17418b6b-8206-0aee-7a0d-95911be364f1@oca.eu> <22CE4992-8000-4540-9E3E-9923EBC785C9@swarthmore.edu> Message-ID: <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> Paolo, I can tell you how to do this. First query JPL Horizons for your target body setting the observer location to the Earth's geocenter. This will return the astrometric position of the target body in the ICRF frame referred to the Earth's geocenter including the proper light time offset. Now you want these coordinates as an astropy SkyCoord object in astropy's ICRS frame. The problem here is that astropy always refers ICRS coordinates to the solar system barycenter. This will require you to add the solar system barycentric position of the Earth's geocenter. The way to do this is: First create a SkyCoord object using the coordinates that you got from your query, call get_body_barycentric() to get the Earth's position and then add these two together to get a proper astropy SkyCoord object. This looks like this: from astropy.coordinates.solar_system import get_body_barycentric my_object_ICRS = SkyCoord( SkyCoord( JPL geocentric astrometric coordinates ).cartesian + get_body_barycentric('earth', my_time) ) Now if you want to compare the result with JPL Horizons apparent place, you need to realize that JPL's apparent place is referenced to the true equator and equinox of date whereas astropy's CIRS frame is referenced to the Celestial Intermediate Origin. Fortunately, there is a function that converts GCRS coordinates to true apparent place: from astropy.coordinates.solar_system import _apparent_position_in_true_coordinates my_object_apparent = _apparent_position_in_true_coordinates( my_object_ICRS.transform_to('gcrs') ) The result should compare to JPL Horizons to 53 mas in RA. This 53 mas is a rather mysterious offset that I pointed out to the JPL Horizons people awhile ago. It took me awhile to convince them of this, but I'm happy to see that they have now accepted it and are making a note of it in their output files. There will be some small residual offsets due to the fact that JPL Horizons uses a slightly different set of earth orientation parameters than those used by astropy, but these are usually less than 1 mas. I have raised an issue in this regard on github (Issue #10230) requesting two new built-in frames for converting to geocentric or topocentric astrometric place and true apparent place. If these ever get implemented, this process will become a lot easier. Best Regards, Michael Brewer On 05/01/2020 04:01 AM, Paolo Tanga wrote: > > Hi Eric > > thank you for your other comments. Some answers below.y > > On 01/05/2020 05:09, Eric Jensen wrote: >> Like Ben, I?m a little unclear on exactly what you are trying to >> achieve beyond what you?ve demonstrated already. (I have learned >> from your example!) You have shown that Horizons provides >> astrometric coordinates that are ICRS, and that these are >> straightforward to insert into a SkyCoord object as you show in your >> example. > > my whole point here is that this works *only* when you query Horizons > for astrometric coordinates with an observer at "@0" (= the Solar > System barycenter), and this is not explicitly explained in the > documentation. My other point is that I am not so expert in all > features in astropy, so I wanted to have a confirmation (which > essentially I got, I think). Eventually, somebody could be able to > define a "custom" frame that works for all output returned by Horizons. > >> >> If for some reason you want to use the apparent coordinates instead, >> then you need to put them into a SkyCoord frame that precesses, which >> as I understand it is what the PrecessedGeocentric frame is for. So >> with a slight modification of your example, you can do this: >> >> (...)Doing this, I get coordinates that differ by about 13 arcsec >> (mostly in RA) from the GCRS coords you create in the first part of >> your example using the ICRS coords at the barycenter. I don?t know >> what the source of that difference is, but perhaps some of the >> various GR corrections. > > Thank you for this additional example, but in my view this shows that > even in this approach you do not get consistent results. 13 arcsec are > a huge discrepancy, not for most amateur use, but for today's > standard. In fact, probably the effect is due to annual aberration > (most of it) and light bending (a few mas). But what is the interest > of including relativistic corrections in astropy, if then you cannot > get an agreement at ~mas level, at least? For professional use in the > Gaia era, this is a requirement. > >> There are indeed subtleties in converting between various coordinates >> systems, as you note, but I would say that those subtleties are >> inherent to the topic in general, not to the astropy software in >> particular. > True! And the whole topic is complex. But astropy already does a great > service to the user, by providing out of the box, accurate > transformations with all the bells and whistles. So, providing > information on how to use (at full accuracy!) astroquery.horizons (or > new reference frames to improve consistency!) I think goes in the same > direction. By the way, note that the issues in the other mail thread > by Michael Brewer also partially addresses the same problem. >> That said, examples are quite helpful, so I?d encourage you to submit >> an example based on your work here for inclusion on the examples page >> at https://docs.astropy.org/en/stable/generated/examples/ . > > I will certainly do, including warnings about how NOT to use the > Horizons output with SkyCoords... ;-) ...! > > Cheers > > Paolo > > >> >> >>> On Apr 29, 2020, at 11:23 AM, Paolo Tanga >> > wrote: >>> >>> Hi Ben >>> >>> thank you for taking your time to look into this question, and sorry >>> for the delay. >>> >>> I would say, all that I am trying to do is to use the astroquery >>> output in a SkyCoord object coherently. If one manages to do that, >>> than it is possible to take profit of all the SkyCoord methods of >>> course, to manipulate the coordinates (transform_to ) etc. >>> >>> As the SkyCoord is a fundamental part of the astropy suite, I would >>> expect that there should be a "easy" method (or at least, a >>> documented one!) to pass from an astroquery/JPL result to SkyCoord. >>> But it turns out that this is not the case. >>> >>> So, what we have learned so far, if I am correct, is that: >>> >>> - JPL apparent coordinates. Precession - you are totally right - >>> creates the difference between GCRS and the JPL apparent >>> coordinates. In the documentation I would explicitly write that >>> these cannot easily be used in a SkyCoord frame. In fact I tried >>> playing with different reference frames (including >>> GeocentricTrueEquator etc) but I see the same inconsistencies as >>> with GCRS. So, I suppose that if there is a method, it is not >>> straightforward (at least, not for me). >>> >>> - JPL astrometric coordinates. If computed with the observer at the >>> barycenter of the Solar System, they can fit a SkyCoord object in >>> ICRS. And this is the only possibility. >>> >>> I think that there could be other subtleties to check, but don't you >>> think that this should be documented somewhere? >>> >>> Note that in the case of the ephemeris of the major planets >>> (get_body()...) a SkyCoord object is directly returned, which is >>> very convenient. >>> >>> Cheers >>> >>> Paolo >>> >>> >>> On 25/04/2020 10:43, Benjamin Weiner wrote: >>>> Hello Paolo, >>>> >>>> I am not entirely sure what end result you wish to achieve, nor am >>>> I an expert on SkyCoord. However, I have a suggestion to >>>> understand further these discrepancies (and thank you for including >>>> the notebook example). In your first example: >>>> (a) JPL's barycentric coords to build ICRS at specified time, then >>>> transformed to GCRS at specified time. >>>> (b) JPL's apparent coords to build GCRS at specified time. >>>> >>>> The separation of 16 arcmin between (a) and (b) is due to the >>>> precession of the Earth's axis from 2000 to 2020. This can be seen >>>> if we substitute >>>> time = Time('2000-01-01T00:00:00', scale='utc') >>>> in the line of your notebook that sets the time. At 2000-01-01, the >>>> separation reduces to 8 arcseconds, which you have identified as >>>> coming from the aberration of starlight. >>>> >>>> I think that the discrepancy is in building the GCRS coordinates >>>> from the apparent RA/Dec. The JPL apparent coordinates are >>>> referenced to the position of the Earth's axis at the specified >>>> time. But the axes of GCRS are non-rotating with respect to the >>>> axes of BCRS and ICRS - that is, GCRS is fixed to the Earth's >>>> center, but not to the Earth's axis, and does not precess. I >>>> believe that this is correct - USNO circular 179 has more gory >>>> details on the definition of coordinate frames, see >>>> https://www.usno.navy.mil/USNO/astronomical-applications/publications/Circular_179.pdf >>>> >>>> Cheers, >>>> Ben >>>> >>>> On Fri, Apr 24, 2020 at 9:01 AM >>> > wrote: >>>> >>>> >>>> Message: 1 >>>> Date: Fri, 24 Apr 2020 15:00:22 +0200 >>>> From: Paolo Tanga > >>>> To: AstroPy at python.org >>>> Subject: [AstroPy] consistency of reference frames between SkyCoord >>>> and JPL Horizons >>>> Message-ID: >>> > >>>> Content-Type: text/plain; charset="utf-8"; Format="flowed" >>>> >>>> Hi all >>>> >>>> I am trying to plug the results by JPL Horizons into the >>>> appropriate >>>> reference system of a SkyCoord object, but it looks very trick. >>>> (bewore >>>> long message, I hope the explanation is clear for the >>>> specialists of >>>> reference systems) >>>> >>>> The Horizons server returns two types of equatorial coordinates: >>>> "astrometric" (1) and (2) "apparent". >>>> >>>> Their description is the following: >>>> >>>> - (1): astrometric RA and Dec with respect to the observing site >>>> (coordinate origin) in the reference frame of >>>> the planetary ephemeris (ICRF). Compensated for down-leg >>>> light-time >>>> delay aberration. >>>> >>>> - (2): Airless apparent RA and Dec of the target with respect >>>> to an >>>> instantaneous reference frame defined by the Earth equator of-date >>>> (z-axis) and meridian containing the Earth equinox of-date >>>> (x-axis, >>>> IAU76/80). Compensated for down-leg light-time delay, >>>> gravitational >>>> deflection of light, stellar aberration, precession & nutation. >>>> Note: >>>> equinox (RA origin) is offset -53 mas from the of-date frame >>>> defined by >>>> the IAU06/00a P & N system. >>>> >>>> My guess is none of these two systems correspond to either ICRS >>>> or GCRS >>>> as defined in astropy. The simplest possibility for me, would >>>> have been >>>> to assimilate (1), computed for the Solar System barycenter, to >>>> ICRS. >>>> But definitely (2) is not GCRS and the test below easily proves >>>> that. >>>> >>>> Verification (see the attached notebook if you want to play with) : >>>> >>>> - I queried for Solar System barycentric coordinates (1) of an >>>> asteroid >>>> at one epoch. I inserted them in a SkyCoord object as ICRS and >>>> use the >>>> transform_to(GCRS) towards geocentric, at the given epoch. >>>> >>>> - I queried again JPL Horizons for the apparent coordinates (2) >>>> from the >>>> geocenter, directly. >>>> >>>> As expected, by comparing the results I get the patent >>>> confirmation that >>>> GCRS is not the frame of (2), with a discrepancy of 16 arcmin >>>> in my >>>> case. SO, IT DOES NOT WORK, AS EXPECTED. Let's put apparent >>>> coordinates >>>> (2) aside for the moment. >>>> >>>> Second possibility (see notebook again). >>>> >>>> I take coordinates (1), for the geocentric observer. I insert >>>> them as >>>> GCRS in a SkyCoord object. I trasform_to(ICRS) (barycentric >>>> observer) >>>> and compare the result to a query of (1) directly for the >>>> barycentric >>>> observer. >>>> >>>> Again this SHOULD NOT WORK accurately. In fact the definition >>>> of (1) >>>> does not contain annual aberration and light deflection that >>>> are part of >>>> GCRS. A difference of several arcsec (mostly due to annual >>>> aberration) >>>> SHOULD show up. And in fact IT DOES, ~8 arcsec of difference. >>>> >>>> The conclusions if that using SkyCoord with the output of JPL >>>> Horizons >>>> is far from obvious to the end user... >>>> >>>> ---- >>>> >>>> So, my final questions/remarks are: >>>> >>>> - How to get a fully accurate consistency between a SkyCoord >>>> frame and >>>> JPL Horizons output, in the case of a barycentric, geocentric or >>>> topocentric observer, for both "astrometric" and "apparent" >>>> coordinates >>>> as provided by JPL? Which reference SkyCoord should use and how? >>>> >>>> - Does astropy implement GCRS correctly in the case of Solar >>>> System >>>> objects, by taking into account aberration and light deflection >>>> in the >>>> relativistic form, for an object at finite distance (different >>>> than for >>>> the stars!) ? >>>> >>>> - ...or... Am I missing something fundamental in my interpretation? >>>> >>>> - Eventually, this query to Horizons turns our to be tricky to >>>> manage as >>>> SkyCoord for the final user. I think it would be useful to >>>> provide the >>>> correct recipe and/or directly a SkyCoord as output of the query... >>>> >>>> Best regards >>>> >>>> Paolo >>>> >>>> >>>> -- >>>> Benjamin Weiner >>>> Staff Scientist / Associate Astronomer, MMT / Steward Observatory >>>> bjw at as.arizona.edu >>>> http://mingus.mmto.arizona.edu/~bjw/ >>>> >>>> >>>> _______________________________________________ >>>> AstroPy mailing list >>>> AstroPy at python.org >>>> https://mail.python.org/mailman/listinfo/astropy >>> -- >>> --------------------------------------------------------------------- >>> Paolo Tanga Astronomer >>> Deputy director of Laboratoire Langrange / UMR 7293 >>> Observatoire de la C?te d'Azur Tel +33(0)492003042 >>> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >>> 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga >>> https://twitter.com/ziggypao >>> _______________________________________________ >>> AstroPy mailing list >>> AstroPy at python.org >>> https://mail.python.org/mailman/listinfo/astropy >> > -- > --------------------------------------------------------------------- > Paolo Tanga Astronomer > Deputy director of Laboratoire Langrange / UMR 7293 > Observatoire de la C?te d'Azur Tel +33(0)492003042 > Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 > 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga > https://twitter.com/ziggypao > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy -------------- next part -------------- An HTML attachment was scrubbed... URL: From brewer at astro.umass.edu Fri May 1 18:09:29 2020 From: brewer at astro.umass.edu (Michael Brewer) Date: Fri, 1 May 2020 18:09:29 -0400 Subject: [AstroPy] consistency of reference frames between SkyCoord and JPL Horizons In-Reply-To: <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> References: <17418b6b-8206-0aee-7a0d-95911be364f1@oca.eu> <22CE4992-8000-4540-9E3E-9923EBC785C9@swarthmore.edu> <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> Message-ID: <4542fe37-4936-406b-a1a3-90b793126c7e@astro.umass.edu> Oh, I forgot. This accuracy assumes that you are using the same DE430 ephemeris that JPL Horizon uses. solar_system_ephemeris.set('de430') On 05/01/2020 05:20 PM, Michael Brewer wrote: > Paolo, > > I can tell you how to do this. First query JPL Horizons for your > target body setting the observer location to the Earth's geocenter. > This will return the astrometric position of the target body in the > ICRF frame referred to the Earth's geocenter including the proper > light time offset. Now you want these coordinates as an astropy > SkyCoord object in astropy's ICRS frame. The problem here is that > astropy always refers ICRS coordinates to the solar system barycenter. > This will require you to add the solar system barycentric position of > the Earth's geocenter. The way to do this is: First create a SkyCoord > object using the coordinates that you got from your query, call > get_body_barycentric() to get the Earth's position and then add these > two together to get a proper astropy SkyCoord object. This looks like > this: > > from astropy.coordinates.solar_system import get_body_barycentric > my_object_ICRS = SkyCoord( SkyCoord( JPL geocentric astrometric > coordinates ).cartesian + get_body_barycentric('earth', my_time) ) > > Now if you want to compare the result with JPL Horizons apparent > place, you need to realize that JPL's apparent place is referenced to > the true equator and equinox of date whereas astropy's CIRS frame is > referenced to the Celestial Intermediate Origin. Fortunately, there is > a function that converts GCRS coordinates to true apparent place: > > from astropy.coordinates.solar_system import > _apparent_position_in_true_coordinates > my_object_apparent = _apparent_position_in_true_coordinates( > my_object_ICRS.transform_to('gcrs') ) > > The result should compare to JPL Horizons to 53 mas in RA. This 53 mas > is a rather mysterious offset that I pointed out to the JPL Horizons > people awhile ago. It took me awhile to convince them of this, but I'm > happy to see that they have now accepted it and are making a note of > it in their output files. There will be some small residual offsets > due to the fact that JPL Horizons uses a slightly different set of > earth orientation parameters than those used by astropy, but these are > usually less than 1 mas. > > I have raised an issue in this regard on github (Issue #10230) > requesting two new built-in frames for converting to geocentric or > topocentric astrometric place and true apparent place. If these ever > get implemented, this process will become a lot easier. > > Best Regards, > > Michael Brewer > > > > On 05/01/2020 04:01 AM, Paolo Tanga wrote: >> >> Hi Eric >> >> thank you for your other comments. Some answers below.y >> >> On 01/05/2020 05:09, Eric Jensen wrote: >>> Like Ben, I?m a little unclear on exactly what you are trying to >>> achieve beyond what you?ve demonstrated already. (I have learned >>> from your example!) You have shown that Horizons provides >>> astrometric coordinates that are ICRS, and that these are >>> straightforward to insert into a SkyCoord object as you show in your >>> example. >> >> my whole point here is that this works *only* when you query Horizons >> for astrometric coordinates with an observer at "@0" (= the Solar >> System barycenter), and this is not explicitly explained in the >> documentation. My other point is that I am not so expert in all >> features in astropy, so I wanted to have a confirmation (which >> essentially I got, I think). Eventually, somebody could be able to >> define a "custom" frame that works for all output returned by Horizons. >> >>> >>> If for some reason you want to use the apparent coordinates instead, >>> then you need to put them into a SkyCoord frame that precesses, >>> which as I understand it is what the PrecessedGeocentric frame is >>> for. So with a slight modification of your example, you can do this: >>> >>> (...)Doing this, I get coordinates that differ by about 13 arcsec >>> (mostly in RA) from the GCRS coords you create in the first part of >>> your example using the ICRS coords at the barycenter. I don?t know >>> what the source of that difference is, but perhaps some of the >>> various GR corrections. >> >> Thank you for this additional example, but in my view this shows that >> even in this approach you do not get consistent results. 13 arcsec >> are a huge discrepancy, not for most amateur use, but for today's >> standard. In fact, probably the effect is due to annual aberration >> (most of it) and light bending (a few mas). But what is the interest >> of including relativistic corrections in astropy, if then you cannot >> get an agreement at ~mas level, at least? For professional use in the >> Gaia era, this is a requirement. >> >>> There are indeed subtleties in converting between various >>> coordinates systems, as you note, but I would say that those >>> subtleties are inherent to the topic in general, not to the astropy >>> software in particular. >> True! And the whole topic is complex. But astropy already does a >> great service to the user, by providing out of the box, accurate >> transformations with all the bells and whistles. So, providing >> information on how to use (at full accuracy!) astroquery.horizons (or >> new reference frames to improve consistency!) I think goes in the >> same direction. By the way, note that the issues in the other mail >> thread by Michael Brewer also partially addresses the same problem. >>> That said, examples are quite helpful, so I?d encourage you to >>> submit an example based on your work here for inclusion on the >>> examples page at >>> https://docs.astropy.org/en/stable/generated/examples/ . >> >> I will certainly do, including warnings about how NOT to use the >> Horizons output with SkyCoords... ;-) ...! >> >> Cheers >> >> Paolo >> >> >>> >>> >>>> On Apr 29, 2020, at 11:23 AM, Paolo Tanga >>> > wrote: >>>> >>>> Hi Ben >>>> >>>> thank you for taking your time to look into this question, and >>>> sorry for the delay. >>>> >>>> I would say, all that I am trying to do is to use the astroquery >>>> output in a SkyCoord object coherently. If one manages to do that, >>>> than it is possible to take profit of all the SkyCoord methods of >>>> course, to manipulate the coordinates (transform_to ) etc. >>>> >>>> As the SkyCoord is a fundamental part of the astropy suite, I would >>>> expect that there should be a "easy" method (or at least, a >>>> documented one!) to pass from an astroquery/JPL result to SkyCoord. >>>> But it turns out that this is not the case. >>>> >>>> So, what we have learned so far, if I am correct, is that: >>>> >>>> - JPL apparent coordinates. Precession - you are totally right - >>>> creates the difference between GCRS and the JPL apparent >>>> coordinates. In the documentation I would explicitly write that >>>> these cannot easily be used in a SkyCoord frame. In fact I tried >>>> playing with different reference frames (including >>>> GeocentricTrueEquator etc) but I see the same inconsistencies as >>>> with GCRS. So, I suppose that if there is a method, it is not >>>> straightforward (at least, not for me). >>>> >>>> - JPL astrometric coordinates. If computed with the observer at the >>>> barycenter of the Solar System, they can fit a SkyCoord object in >>>> ICRS. And this is the only possibility. >>>> >>>> I think that there could be other subtleties to check, but don't >>>> you think that this should be documented somewhere? >>>> >>>> Note that in the case of the ephemeris of the major planets >>>> (get_body()...) a SkyCoord object is directly returned, which is >>>> very convenient. >>>> >>>> Cheers >>>> >>>> Paolo >>>> >>>> >>>> On 25/04/2020 10:43, Benjamin Weiner wrote: >>>>> Hello Paolo, >>>>> >>>>> I am not entirely sure what end result you wish to achieve, nor am >>>>> I an expert on SkyCoord. However, I have a suggestion to >>>>> understand further these discrepancies (and thank you for >>>>> including the notebook example). In your first example: >>>>> (a) JPL's barycentric coords to build ICRS at specified time, then >>>>> transformed to GCRS at specified time. >>>>> (b) JPL's apparent coords to build GCRS at specified time. >>>>> >>>>> The separation of 16 arcmin between (a) and (b) is due to the >>>>> precession of the Earth's axis from 2000 to 2020. This can be >>>>> seen if we substitute >>>>> time = Time('2000-01-01T00:00:00', scale='utc') >>>>> in the line of your notebook that sets the time. At 2000-01-01, >>>>> the separation reduces to 8 arcseconds, which you have identified >>>>> as coming from the aberration of starlight. >>>>> >>>>> I think that the discrepancy is in building the GCRS coordinates >>>>> from the apparent RA/Dec. The JPL apparent coordinates are >>>>> referenced to the position of the Earth's axis at the specified >>>>> time. But the axes of GCRS are non-rotating with respect to the >>>>> axes of BCRS and ICRS - that is, GCRS is fixed to the Earth's >>>>> center, but not to the Earth's axis, and does not precess. I >>>>> believe that this is correct - USNO circular 179 has more gory >>>>> details on the definition of coordinate frames, see >>>>> https://www.usno.navy.mil/USNO/astronomical-applications/publications/Circular_179.pdf >>>>> >>>>> Cheers, >>>>> Ben >>>>> >>>>> On Fri, Apr 24, 2020 at 9:01 AM >>>> > wrote: >>>>> >>>>> >>>>> Message: 1 >>>>> Date: Fri, 24 Apr 2020 15:00:22 +0200 >>>>> From: Paolo Tanga > >>>>> To: AstroPy at python.org >>>>> Subject: [AstroPy] consistency of reference frames between >>>>> SkyCoord >>>>> and JPL Horizons >>>>> Message-ID: >>>> > >>>>> Content-Type: text/plain; charset="utf-8"; Format="flowed" >>>>> >>>>> Hi all >>>>> >>>>> I am trying to plug the results by JPL Horizons into the >>>>> appropriate >>>>> reference system of a SkyCoord object, but it looks very >>>>> trick. (bewore >>>>> long message, I hope the explanation is clear for the >>>>> specialists of >>>>> reference systems) >>>>> >>>>> The Horizons server returns two types of equatorial coordinates: >>>>> "astrometric" (1) and (2) "apparent". >>>>> >>>>> Their description is the following: >>>>> >>>>> - (1): astrometric RA and Dec with respect to the observing site >>>>> (coordinate origin) in the reference frame of >>>>> the planetary ephemeris (ICRF). Compensated for down-leg >>>>> light-time >>>>> delay aberration. >>>>> >>>>> - (2): Airless apparent RA and Dec of the target with respect >>>>> to an >>>>> instantaneous reference frame defined by the Earth equator >>>>> of-date >>>>> (z-axis) and meridian containing the Earth equinox of-date >>>>> (x-axis, >>>>> IAU76/80). Compensated for down-leg light-time delay, >>>>> gravitational >>>>> deflection of light, stellar aberration, precession & >>>>> nutation. Note: >>>>> equinox (RA origin) is offset -53 mas from the of-date frame >>>>> defined by >>>>> the IAU06/00a P & N system. >>>>> >>>>> My guess is none of these two systems correspond to either >>>>> ICRS or GCRS >>>>> as defined in astropy. The simplest possibility for me, would >>>>> have been >>>>> to assimilate (1), computed for the Solar System barycenter, >>>>> to ICRS. >>>>> But definitely (2) is not GCRS and the test below easily >>>>> proves that. >>>>> >>>>> Verification (see the attached notebook if you want to play >>>>> with) : >>>>> >>>>> - I queried for Solar System barycentric coordinates (1) of an >>>>> asteroid >>>>> at one epoch. I inserted them in a SkyCoord object as ICRS and >>>>> use the >>>>> transform_to(GCRS) towards geocentric, at the given epoch. >>>>> >>>>> - I queried again JPL Horizons for the apparent coordinates >>>>> (2) from the >>>>> geocenter, directly. >>>>> >>>>> As expected, by comparing the results I get the patent >>>>> confirmation that >>>>> GCRS is not the frame of (2), with a discrepancy of 16 arcmin >>>>> in my >>>>> case. SO, IT DOES NOT WORK, AS EXPECTED. Let's put apparent >>>>> coordinates >>>>> (2) aside for the moment. >>>>> >>>>> Second possibility (see notebook again). >>>>> >>>>> I take coordinates (1), for the geocentric observer. I insert >>>>> them as >>>>> GCRS in a SkyCoord object. I trasform_to(ICRS) (barycentric >>>>> observer) >>>>> and compare the result to a query of (1) directly for the >>>>> barycentric >>>>> observer. >>>>> >>>>> Again this SHOULD NOT WORK accurately. In fact the definition >>>>> of (1) >>>>> does not contain annual aberration and light deflection that >>>>> are part of >>>>> GCRS. A difference of several arcsec (mostly due to annual >>>>> aberration) >>>>> SHOULD show up. And in fact IT DOES, ~8 arcsec of difference. >>>>> >>>>> The conclusions if that using SkyCoord with the output of JPL >>>>> Horizons >>>>> is far from obvious to the end user... >>>>> >>>>> ---- >>>>> >>>>> So, my final questions/remarks are: >>>>> >>>>> - How to get a fully accurate consistency between a SkyCoord >>>>> frame and >>>>> JPL Horizons output, in the case of a barycentric, geocentric or >>>>> topocentric observer, for both "astrometric" and "apparent" >>>>> coordinates >>>>> as provided by JPL? Which reference SkyCoord should use and how? >>>>> >>>>> - Does astropy implement GCRS correctly in the case of Solar >>>>> System >>>>> objects, by taking into account aberration and light >>>>> deflection in the >>>>> relativistic form, for an object at finite distance (different >>>>> than for >>>>> the stars!) ? >>>>> >>>>> - ...or... Am I missing something fundamental in my >>>>> interpretation? >>>>> >>>>> - Eventually, this query to Horizons turns our to be tricky to >>>>> manage as >>>>> SkyCoord for the final user. I think it would be useful to >>>>> provide the >>>>> correct recipe and/or directly a SkyCoord as output of the >>>>> query... >>>>> >>>>> Best regards >>>>> >>>>> Paolo >>>>> >>>>> >>>>> -- >>>>> Benjamin Weiner >>>>> Staff Scientist / Associate Astronomer, MMT / Steward Observatory >>>>> bjw at as.arizona.edu >>>>> http://mingus.mmto.arizona.edu/~bjw/ >>>>> >>>>> >>>>> _______________________________________________ >>>>> AstroPy mailing list >>>>> AstroPy at python.org >>>>> https://mail.python.org/mailman/listinfo/astropy >>>> -- >>>> --------------------------------------------------------------------- >>>> Paolo Tanga Astronomer >>>> Deputy director of Laboratoire Langrange / UMR 7293 >>>> Observatoire de la C?te d'Azur Tel +33(0)492003042 >>>> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >>>> 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga >>>> https://twitter.com/ziggypao >>>> _______________________________________________ >>>> AstroPy mailing list >>>> AstroPy at python.org >>>> https://mail.python.org/mailman/listinfo/astropy >>> >> -- >> --------------------------------------------------------------------- >> Paolo Tanga Astronomer >> Deputy director of Laboratoire Langrange / UMR 7293 >> Observatoire de la C?te d'Azur Tel +33(0)492003042 >> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >> 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga >> https://twitter.com/ziggypao >> >> >> _______________________________________________ >> 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Paolo.Tanga at oca.eu Mon May 4 04:18:43 2020 From: Paolo.Tanga at oca.eu (Paolo Tanga) Date: Mon, 4 May 2020 10:18:43 +0200 Subject: [AstroPy] consistency of reference frames between SkyCoord and JPL Horizons In-Reply-To: <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> References: <17418b6b-8206-0aee-7a0d-95911be364f1@oca.eu> <22CE4992-8000-4540-9E3E-9923EBC785C9@swarthmore.edu> <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> Message-ID: Hi Michael thank you for this suggestion, very interesting. I will certainly try and make a test! I am currently using solar_system_ephemeris.set('de432s')... I suppose it does not make a different with respect to de430 but I confess I did not check. best regards Paolo -- --------------------------------------------------------------------- Paolo Tanga Astronomer Deputy director of Laboratoire Langrange / UMR 7293 Observatoire de la C?te d'Azur Tel +33(0)492003042 Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 06304 Nice Cedex 4 - France http://www.oca.eu/tanga https://twitter.com/ziggypao From Paolo.Tanga at oca.eu Thu May 7 09:59:17 2020 From: Paolo.Tanga at oca.eu (Paolo Tanga) Date: Thu, 7 May 2020 15:59:17 +0200 Subject: [AstroPy] consistency of reference frames between SkyCoord and JPL Horizons In-Reply-To: <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> References: <17418b6b-8206-0aee-7a0d-95911be364f1@oca.eu> <22CE4992-8000-4540-9E3E-9923EBC785C9@swarthmore.edu> <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> Message-ID: An HTML attachment was scrubbed... URL: From brewer at astro.umass.edu Fri May 8 17:55:42 2020 From: brewer at astro.umass.edu (Michael Brewer) Date: Fri, 8 May 2020 17:55:42 -0400 Subject: [AstroPy] consistency of reference frames between SkyCoord and JPL Horizons In-Reply-To: References: <17418b6b-8206-0aee-7a0d-95911be364f1@oca.eu> <22CE4992-8000-4540-9E3E-9923EBC785C9@swarthmore.edu> <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> Message-ID: <9c8a6657-3c7f-6593-2043-5f8210b70857@astro.umass.edu> Hi Paolo, I forgot about time. You need to tell the GCRS frame the time of the observation. But you must have figured that out as you got good agreement in position, so the error in distance is odd. I tried an example with the following script: from astropy.time import Time from astropy.coordinates import get_body_barycentric, SkyCoord, GCRS from astropy.coordinates.solar_system import _apparent_position_in_true_coordinates import astropy.units as u #Mars Geocentric JPL 2020-May-07 00:00:00 328.364842462 -14.682567251 328.634953692 -14.587885357 1.18472191315873 my_time = Time('2020-05-07T00:00:00') my_astrometric = SkyCoord( 328.364842462*u.deg, -14.682567251*u.deg, 1.18472191315873*u.au ) my_apparent = SkyCoord( 328.634953692*u.deg, -14.587885357*u.deg, 1.18472191315873*u.au ) print ('JPL ICRS', my_astrometric) my_object_ICRS = SkyCoord( my_astrometric.cartesian + get_body_barycentric('earth', my_time) ) print ('ICRS', my_object_ICRS) my_object_apparent = _apparent_position_in_true_coordinates( my_object_ICRS.transform_to(GCRS(obstime=my_time))) print ('apparent', my_object_apparent) print ('delta ra', (my_object_apparent.ra - my_apparent.ra).to(u.mas), 'delta dec', (my_object_apparent.dec - my_apparent.dec).to(u.mas), 'delta distance', (my_object_apparent.distance - my_apparent.distance).to(u.meter) ) And got this result: JPL ICRS ICRS apparent delta ra 49.5348mas delta dec -0.964467mas delta distance -6.643480019441483e-05 m The positions are off a bit more than I'd like to see, but the distance is right on. By the way, thanks to an example from Stuart Littlefair, I figured out how to do this using topocentric coordinates also. This is just a matter of setting up an EarthLocation my_loc and then doing: earth_loc = get_body_barycentric('earth', my_time) obsgeoloc, obsgeovel = my_loc.get_gcrs_posvel(my_time) earth_loc += obsgeoloc before adding earth_loc to your topocentric astrometric coordinates from Horizons and then you also need to tell the GCRS frame your location and velocity: my_object_apparent = _apparent_position_in_true_coordinates( my_object_ICRS.transform_to( GCRS(obsgeoloc=obsgeoloc, obsgeovel=obsgeovel, obstime=my_time))) Regards, Michael Brewer On 05/07/2020 09:59 AM, Paolo Tanga wrote: > > Hi Micheal > > I did the test following your instructions and I correctly found the > result that you indicate: 52.5 mas of discrepancty in RA, and > negligible in Dec (0.01 mas). > > However, I notice something strange. At the first step: > > my_object_ICRS = SkyCoord( SkyCoord( JPL geocentric astrometric > coordinates ).cartesian + get_body_barycentric('earth', my_time) ) > > I give as "JPL geocentric astrometric coordinates" ra, dec and > distance. I chose first the geocentric distance (delta, in my case > 2.0958388 au). > > Then I get > > my_object_ICRS.distance = 3.816102 au. > > Formally, this may be correct, as this is the result of the addition > of barycenter-to-Earth vector. But then, even if I am now in > geocentric ICRS, it does not represent the geocentric distance. > > At the end of the process, after transformation to GCRS and then to > apparent coordinates (by _apparent_position_in_true_coordinates) I find: > > my_object_apparent.distance = 2.962877... au, which is off the JPL > value for delta given above by ~0.9 au. > > If at the beginning I give 'r' (heliocentric distance = 2.95757466, > instead of 'delta'), I still get: > > my_object_ICRS.distance = 3.810857 but now my_object_apparent.distance > > but then: > > my_object_apparent.distance =2.957567 > > which is much closer to the geocentric distance.... So, whatever the > choice, it looks like the distance goes completely wrong and there is > no way to obtain the correct value directly from the transformations. > As ra and dec are correct, the only solution seems to apply a > correction to the distance at the end of the computation. > > Is this behavior consistent with what you would expect ? > > best regards > > Paolo > > > > > On 01/05/2020 23:20, Michael Brewer wrote: >> Paolo, >> >> I can tell you how to do this. First query JPL Horizons for your >> target body setting the observer location to the Earth's geocenter. >> This will return the astrometric position of the target body in the >> ICRF frame referred to the Earth's geocenter including the proper >> light time offset. Now you want these coordinates as an astropy >> SkyCoord object in astropy's ICRS frame. The problem here is that >> astropy always refers ICRS coordinates to the solar system >> barycenter. This will require you to add the solar system barycentric >> position of the Earth's geocenter. The way to do this is: First >> create a SkyCoord object using the coordinates that you got from your >> query, call get_body_barycentric() to get the Earth's position and >> then add these two together to get a proper astropy SkyCoord object. >> This looks like this: >> >> from astropy.coordinates.solar_system import get_body_barycentric >> my_object_ICRS = SkyCoord( SkyCoord( JPL geocentric astrometric >> coordinates ).cartesian + get_body_barycentric('earth', my_time) ) >> >> Now if you want to compare the result with JPL Horizons apparent >> place, you need to realize that JPL's apparent place is referenced to >> the true equator and equinox of date whereas astropy's CIRS frame is >> referenced to the Celestial Intermediate Origin. Fortunately, there >> is a function that converts GCRS coordinates to true apparent place: >> >> from astropy.coordinates.solar_system import >> _apparent_position_in_true_coordinates >> my_object_apparent = _apparent_position_in_true_coordinates( >> my_object_ICRS.transform_to('gcrs') ) >> >> The result should compare to JPL Horizons to 53 mas in RA. This 53 >> mas is a rather mysterious offset that I pointed out to the JPL >> Horizons people awhile ago. It took me awhile to convince them of >> this, but I'm happy to see that they have now accepted it and are >> making a note of it in their output files. There will be some small >> residual offsets due to the fact that JPL Horizons uses a slightly >> different set of earth orientation parameters than those used by >> astropy, but these are usually less than 1 mas. >> >> I have raised an issue in this regard on github (Issue #10230) >> requesting two new built-in frames for converting to geocentric or >> topocentric astrometric place and true apparent place. If these ever >> get implemented, this process will become a lot easier. >> >> Best Regards, >> >> Michael Brewer >> >> >> >> On 05/01/2020 04:01 AM, Paolo Tanga wrote: >>> >>> Hi Eric >>> >>> thank you for your other comments. Some answers below.y >>> >>> On 01/05/2020 05:09, Eric Jensen wrote: >>>> Like Ben, I?m a little unclear on exactly what you are trying to >>>> achieve beyond what you?ve demonstrated already. (I have learned >>>> from your example!) You have shown that Horizons provides >>>> astrometric coordinates that are ICRS, and that these are >>>> straightforward to insert into a SkyCoord object as you show in >>>> your example. >>> >>> my whole point here is that this works *only* when you query >>> Horizons for astrometric coordinates with an observer at "@0" (= the >>> Solar System barycenter), and this is not explicitly explained in >>> the documentation. My other point is that I am not so expert in all >>> features in astropy, so I wanted to have a confirmation (which >>> essentially I got, I think). Eventually, somebody could be able to >>> define a "custom" frame that works for all output returned by Horizons. >>> >>>> >>>> If for some reason you want to use the apparent coordinates >>>> instead, then you need to put them into a SkyCoord frame that >>>> precesses, which as I understand it is what the PrecessedGeocentric >>>> frame is for. So with a slight modification of your example, you >>>> can do this: >>>> >>>> (...)Doing this, I get coordinates that differ by about 13 arcsec >>>> (mostly in RA) from the GCRS coords you create in the first part of >>>> your example using the ICRS coords at the barycenter. I don?t know >>>> what the source of that difference is, but perhaps some of the >>>> various GR corrections. >>> >>> Thank you for this additional example, but in my view this shows >>> that even in this approach you do not get consistent results. 13 >>> arcsec are a huge discrepancy, not for most amateur use, but for >>> today's standard. In fact, probably the effect is due to annual >>> aberration (most of it) and light bending (a few mas). But what is >>> the interest of including relativistic corrections in astropy, if >>> then you cannot get an agreement at ~mas level, at least? For >>> professional use in the Gaia era, this is a requirement. >>> >>>> There are indeed subtleties in converting between various >>>> coordinates systems, as you note, but I would say that those >>>> subtleties are inherent to the topic in general, not to the astropy >>>> software in particular. >>> True! And the whole topic is complex. But astropy already does a >>> great service to the user, by providing out of the box, accurate >>> transformations with all the bells and whistles. So, providing >>> information on how to use (at full accuracy!) astroquery.horizons >>> (or new reference frames to improve consistency!) I think goes in >>> the same direction. By the way, note that the issues in the other >>> mail thread by Michael Brewer also partially addresses the same problem. >>>> That said, examples are quite helpful, so I?d encourage you to >>>> submit an example based on your work here for inclusion on the >>>> examples page at >>>> https://docs.astropy.org/en/stable/generated/examples/ . >>> >>> I will certainly do, including warnings about how NOT to use the >>> Horizons output with SkyCoords... ;-) ...! >>> >>> Cheers >>> >>> Paolo >>> >>> >>>> >>>> >>>>> On Apr 29, 2020, at 11:23 AM, Paolo Tanga >>>> > wrote: >>>>> >>>>> Hi Ben >>>>> >>>>> thank you for taking your time to look into this question, and >>>>> sorry for the delay. >>>>> >>>>> I would say, all that I am trying to do is to use the astroquery >>>>> output in a SkyCoord object coherently. If one manages to do that, >>>>> than it is possible to take profit of all the SkyCoord methods of >>>>> course, to manipulate the coordinates (transform_to ) etc. >>>>> >>>>> As the SkyCoord is a fundamental part of the astropy suite, I >>>>> would expect that there should be a "easy" method (or at least, a >>>>> documented one!) to pass from an astroquery/JPL result to >>>>> SkyCoord. But it turns out that this is not the case. >>>>> >>>>> So, what we have learned so far, if I am correct, is that: >>>>> >>>>> - JPL apparent coordinates. Precession - you are totally right - >>>>> creates the difference between GCRS and the JPL apparent >>>>> coordinates. In the documentation I would explicitly write that >>>>> these cannot easily be used in a SkyCoord frame. In fact I tried >>>>> playing with different reference frames (including >>>>> GeocentricTrueEquator etc) but I see the same inconsistencies as >>>>> with GCRS. So, I suppose that if there is a method, it is not >>>>> straightforward (at least, not for me). >>>>> >>>>> - JPL astrometric coordinates. If computed with the observer at >>>>> the barycenter of the Solar System, they can fit a SkyCoord object >>>>> in ICRS. And this is the only possibility. >>>>> >>>>> I think that there could be other subtleties to check, but don't >>>>> you think that this should be documented somewhere? >>>>> >>>>> Note that in the case of the ephemeris of the major planets >>>>> (get_body()...) a SkyCoord object is directly returned, which is >>>>> very convenient. >>>>> >>>>> Cheers >>>>> >>>>> Paolo >>>>> >>>>> >>>>> On 25/04/2020 10:43, Benjamin Weiner wrote: >>>>>> Hello Paolo, >>>>>> >>>>>> I am not entirely sure what end result you wish to achieve, nor >>>>>> am I an expert on SkyCoord. However, I have a suggestion to >>>>>> understand further these discrepancies (and thank you for >>>>>> including the notebook example). In your first example: >>>>>> (a) JPL's barycentric coords to build ICRS at specified time, >>>>>> then transformed to GCRS at specified time. >>>>>> (b) JPL's apparent coords to build GCRS at specified time. >>>>>> >>>>>> The separation of 16 arcmin between (a) and (b) is due to the >>>>>> precession of the Earth's axis from 2000 to 2020. This can be >>>>>> seen if we substitute >>>>>> time = Time('2000-01-01T00:00:00', scale='utc') >>>>>> in the line of your notebook that sets the time. At 2000-01-01, >>>>>> the separation reduces to 8 arcseconds, which you have identified >>>>>> as coming from the aberration of starlight. >>>>>> >>>>>> I think that the discrepancy is in building the GCRS coordinates >>>>>> from the apparent RA/Dec. The JPL apparent coordinates are >>>>>> referenced to the position of the Earth's axis at the specified >>>>>> time. But the axes of GCRS are non-rotating with respect to the >>>>>> axes of BCRS and ICRS - that is, GCRS is fixed to the Earth's >>>>>> center, but not to the Earth's axis, and does not precess. I >>>>>> believe that this is correct - USNO circular 179 has more gory >>>>>> details on the definition of coordinate frames, see >>>>>> https://www.usno.navy.mil/USNO/astronomical-applications/publications/Circular_179.pdf >>>>>> >>>>>> Cheers, >>>>>> Ben >>>>>> >>>>>> On Fri, Apr 24, 2020 at 9:01 AM >>>>> > wrote: >>>>>> >>>>>> >>>>>> Message: 1 >>>>>> Date: Fri, 24 Apr 2020 15:00:22 +0200 >>>>>> From: Paolo Tanga >>>>> > >>>>>> To: AstroPy at python.org >>>>>> Subject: [AstroPy] consistency of reference frames between >>>>>> SkyCoord >>>>>> and JPL Horizons >>>>>> Message-ID: >>>>> > >>>>>> Content-Type: text/plain; charset="utf-8"; Format="flowed" >>>>>> >>>>>> Hi all >>>>>> >>>>>> I am trying to plug the results by JPL Horizons into the >>>>>> appropriate >>>>>> reference system of a SkyCoord object, but it looks very >>>>>> trick. (bewore >>>>>> long message, I hope the explanation is clear for the >>>>>> specialists of >>>>>> reference systems) >>>>>> >>>>>> The Horizons server returns two types of equatorial coordinates: >>>>>> "astrometric" (1) and (2) "apparent". >>>>>> >>>>>> Their description is the following: >>>>>> >>>>>> - (1): astrometric RA and Dec with respect to the observing site >>>>>> (coordinate origin) in the reference frame of >>>>>> the planetary ephemeris (ICRF). Compensated for down-leg >>>>>> light-time >>>>>> delay aberration. >>>>>> >>>>>> - (2): Airless apparent RA and Dec of the target with respect >>>>>> to an >>>>>> instantaneous reference frame defined by the Earth equator >>>>>> of-date >>>>>> (z-axis) and meridian containing the Earth equinox of-date >>>>>> (x-axis, >>>>>> IAU76/80). Compensated for down-leg light-time delay, >>>>>> gravitational >>>>>> deflection of light, stellar aberration, precession & >>>>>> nutation. Note: >>>>>> equinox (RA origin) is offset -53 mas from the of-date frame >>>>>> defined by >>>>>> the IAU06/00a P & N system. >>>>>> >>>>>> My guess is none of these two systems correspond to either >>>>>> ICRS or GCRS >>>>>> as defined in astropy. The simplest possibility for me, would >>>>>> have been >>>>>> to assimilate (1), computed for the Solar System barycenter, >>>>>> to ICRS. >>>>>> But definitely (2) is not GCRS and the test below easily >>>>>> proves that. >>>>>> >>>>>> Verification (see the attached notebook if you want to play >>>>>> with) : >>>>>> >>>>>> - I queried for Solar System barycentric coordinates (1) of >>>>>> an asteroid >>>>>> at one epoch. I inserted them in a SkyCoord object as ICRS >>>>>> and use the >>>>>> transform_to(GCRS) towards geocentric, at the given epoch. >>>>>> >>>>>> - I queried again JPL Horizons for the apparent coordinates >>>>>> (2) from the >>>>>> geocenter, directly. >>>>>> >>>>>> As expected, by comparing the results I get the patent >>>>>> confirmation that >>>>>> GCRS is not the frame of (2), with a discrepancy of 16 arcmin >>>>>> in my >>>>>> case. SO, IT DOES NOT WORK, AS EXPECTED. Let's put apparent >>>>>> coordinates >>>>>> (2) aside for the moment. >>>>>> >>>>>> Second possibility (see notebook again). >>>>>> >>>>>> I take coordinates (1), for the geocentric observer. I insert >>>>>> them as >>>>>> GCRS in a SkyCoord object. I trasform_to(ICRS) (barycentric >>>>>> observer) >>>>>> and compare the result to a query of (1) directly for the >>>>>> barycentric >>>>>> observer. >>>>>> >>>>>> Again this SHOULD NOT WORK accurately. In fact the definition >>>>>> of (1) >>>>>> does not contain annual aberration and light deflection that >>>>>> are part of >>>>>> GCRS. A difference of several arcsec (mostly due to annual >>>>>> aberration) >>>>>> SHOULD show up. And in fact IT DOES, ~8 arcsec of difference. >>>>>> >>>>>> The conclusions if that using SkyCoord with the output of JPL >>>>>> Horizons >>>>>> is far from obvious to the end user... >>>>>> >>>>>> ---- >>>>>> >>>>>> So, my final questions/remarks are: >>>>>> >>>>>> - How to get a fully accurate consistency between a SkyCoord >>>>>> frame and >>>>>> JPL Horizons output, in the case of a barycentric, geocentric or >>>>>> topocentric observer, for both "astrometric" and "apparent" >>>>>> coordinates >>>>>> as provided by JPL? Which reference SkyCoord should use and how? >>>>>> >>>>>> - Does astropy implement GCRS correctly in the case of Solar >>>>>> System >>>>>> objects, by taking into account aberration and light >>>>>> deflection in the >>>>>> relativistic form, for an object at finite distance >>>>>> (different than for >>>>>> the stars!) ? >>>>>> >>>>>> - ...or... Am I missing something fundamental in my >>>>>> interpretation? >>>>>> >>>>>> - Eventually, this query to Horizons turns our to be tricky >>>>>> to manage as >>>>>> SkyCoord for the final user. I think it would be useful to >>>>>> provide the >>>>>> correct recipe and/or directly a SkyCoord as output of the >>>>>> query... >>>>>> >>>>>> Best regards >>>>>> >>>>>> Paolo >>>>>> >>>>>> >>>>>> -- >>>>>> Benjamin Weiner >>>>>> Staff Scientist / Associate Astronomer, MMT / Steward Observatory >>>>>> bjw at as.arizona.edu >>>>>> http://mingus.mmto.arizona.edu/~bjw/ >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> AstroPy mailing list >>>>>> AstroPy at python.org >>>>>> https://mail.python.org/mailman/listinfo/astropy >>>>> -- >>>>> --------------------------------------------------------------------- >>>>> Paolo Tanga Astronomer >>>>> Deputy director of Laboratoire Langrange / UMR 7293 >>>>> Observatoire de la C?te d'Azur Tel +33(0)492003042 >>>>> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >>>>> 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga >>>>> https://twitter.com/ziggypao >>>>> _______________________________________________ >>>>> AstroPy mailing list >>>>> AstroPy at python.org >>>>> https://mail.python.org/mailman/listinfo/astropy >>>> >>> -- >>> --------------------------------------------------------------------- >>> Paolo Tanga Astronomer >>> Deputy director of Laboratoire Langrange / UMR 7293 >>> Observatoire de la C?te d'Azur Tel +33(0)492003042 >>> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >>> 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga >>> https://twitter.com/ziggypao >>> >>> >>> _______________________________________________ >>> 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 > -- > --------------------------------------------------------------------- > Paolo Tanga Astronomer > Deputy director of Laboratoire Langrange / UMR 7293 > Observatoire de la C?te d'Azur Tel +33(0)492003042 > Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 > 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga > https://twitter.com/ziggypao > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy -------------- next part -------------- An HTML attachment was scrubbed... URL: From Paolo.Tanga at oca.eu Sat May 9 04:00:10 2020 From: Paolo.Tanga at oca.eu (Paolo Tanga) Date: Sat, 9 May 2020 10:00:10 +0200 Subject: [AstroPy] consistency of reference frames between SkyCoord and JPL Horizons In-Reply-To: <9c8a6657-3c7f-6593-2043-5f8210b70857@astro.umass.edu> References: <17418b6b-8206-0aee-7a0d-95911be364f1@oca.eu> <22CE4992-8000-4540-9E3E-9923EBC785C9@swarthmore.edu> <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> <9c8a6657-3c7f-6593-2043-5f8210b70857@astro.umass.edu> Message-ID: <44ea2f2e-0ad1-2f01-0aaa-094db91d5a8c@oca.eu> An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ekgeponodiajhmkl.png Type: image/png Size: 74735 bytes Desc: not available URL: From ejensen1 at swarthmore.edu Sat May 9 11:30:58 2020 From: ejensen1 at swarthmore.edu (Eric Jensen) Date: Sat, 9 May 2020 11:30:58 -0400 Subject: [AstroPy] Effect of observer elevation on sunset time Message-ID: <7B3DF8E3-FFAF-4AB4-A74E-AC7764B188B0@swarthmore.edu> Hi all, I was just working with astroplan to calculate some sunset times (actually nautical twilight in the example below), and I noticed that specifying the observatory elevation doesn?t seem to make any difference in the results, contrary to my expectations. Example code: from astropy.coordinates import EarthLocation import astroplan from astropy.time import Time import astropy.units as u location = EarthLocation.from_geodetic(-16.5097*u.deg, 28.3*u.deg, 2390*u.m) # Same location, but zero elevation location_sealevel = EarthLocation.from_geodetic(-16.5097*u.deg, 28.3*u.deg, 0*u.m) teide = astroplan.Observer(location=location, name="Teide", timezone="Atlantic/Canary") teide_sealevel = astroplan.Observer(location=location_sealevel, name="Teide sea level", timezone="Atlantic/Canary") now = Time.now() n = 1000 sun_set = teide.sun_set_time(now, which="next", horizon=-12*u.deg, n_grid_points=n) sun_set_sealevel = teide_sealevel.sun_set_time(now, which="next", horizon=-12*u.deg, n_grid_points=n) print("Sunset at altitude: {0.iso}, JD: {0.jd}".format(sun_set)) print("Sunset at sea level: {0.iso}, JD: {0.jd}".format(sun_set_sealevel)) print("Difference: {}".format((sun_set - sun_set_sealevel).to(u.s))) This yields the output: Sunset at altitude: 2020-05-09 20:41:33.933, JD: 2458979.3621982955 Sunset at sea level: 2020-05-09 20:41:33.933, JD: 2458979.3621982983 Difference: -0.00024139881134033203 s i.e. basically no difference. There are three reasons I could think of: 1. The effect of observer elevation simply isn?t implemented in astroplan. 2. There?s something wrong with my code. 3. There?s something wrong with my thinking that there should be a few minutes difference (later sunset / earlier sunrise) at a few thousand meters elevation vs. at sea level. My guess is #1, but I?m curious to hear if others have different thoughts. I?m using astropy 4.0.1 and astroplan 0.6. Thanks, Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3946 bytes Desc: not available URL: From Paolo.Tanga at oca.eu Sat May 9 11:27:27 2020 From: Paolo.Tanga at oca.eu (Paolo Tanga) Date: Sat, 9 May 2020 17:27:27 +0200 Subject: [AstroPy] consistency of reference frames between SkyCoord and JPL Horizons In-Reply-To: <44ea2f2e-0ad1-2f01-0aaa-094db91d5a8c@oca.eu> References: <17418b6b-8206-0aee-7a0d-95911be364f1@oca.eu> <22CE4992-8000-4540-9E3E-9923EBC785C9@swarthmore.edu> <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> <9c8a6657-3c7f-6593-2043-5f8210b70857@astro.umass.edu> <44ea2f2e-0ad1-2f01-0aaa-094db91d5a8c@oca.eu> Message-ID: An HTML attachment was scrubbed... URL: -------------- next part -------------- { "cells": [ { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "from astropy.table import Table\n", "import numpy as np\n", "from astroquery.jplhorizons import Horizons\n", "from astropy import coordinates as coord\n", "from astropy.coordinates import GCRS, ICRS, Distance, solar_system_ephemeris\n", "from astropy.time import Time, TimeDelta\n", "import astropy.units as u" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from astropy.coordinates.solar_system import get_body_barycentric\n", "from astropy.coordinates.solar_system import _apparent_position_in_true_coordinates\n", "\n", "solar_system_ephemeris.set('de430') " ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "time = Time('2020-04-09T00:00:00', scale='utc')" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING: ErfaWarning: ERFA function \"taiutc\" yielded 1 of \"dubious year (Note 4)\" [astropy._erfa.core]\n" ] } ], "source": [ "dt = TimeDelta(1000.0,format='jd')\n", "time_start = time - dt\n", "time_end = time + dt" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING: ErfaWarning: ERFA function \"d2dtf\" yielded 1 of \"dubious year (Note 5)\" [astropy._erfa.core]\n" ] } ], "source": [ "asteroid = Horizons(id='Eris', location='500', epochs={'start':time_start.iso, 'stop':time_end.iso,\n", "... 'step':'1d'}) # geocentric ICRS\n", "ast_eph = asteroid.ephemerides(quantities='1,2,19,20,21,23',extra_precision=True)\n", "\n", "times = Time(ast_eph['datetime_jd'],format='jd',scale='utc')" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING: ErfaWarning: ERFA function \"utctai\" yielded 370 of \"dubious year (Note 3)\" [astropy._erfa.core]\n", "WARNING: ErfaWarning: ERFA function \"taiutc\" yielded 370 of \"dubious year (Note 4)\" [astropy._erfa.core]\n" ] } ], "source": [ "# Build SkyCoord object in ICRS - this will be the geocentric direction to the asteroid, shifted to ICRS barycenter\n", "ast_coord_ICRS = coord.SkyCoord(ra=ast_eph['RA'],dec=ast_eph['DEC'],distance=ast_eph['delta'],frame='icrs')\n", "# Move origin to geocenter\n", "ast_ICRS_geoc = coord.SkyCoord(ast_coord_ICRS.cartesian + get_body_barycentric('earth', times))" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "my_object_apparent = _apparent_position_in_true_coordinates(ast_ICRS_geoc.transform_to(GCRS(obstime=times)))" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "d_ra= (my_object_apparent.ra - ast_eph['RA_app']).to(u.mas)*np.cos(my_object_apparent.dec.to(u.rad))\n", "d_dec=(my_object_apparent.dec - ast_eph['DEC_app']).to(u.mas)" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(-10.0, 10.0)" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY8AAAEJCAYAAABsc6siAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4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u4w4P144mvMP8sW9drO+nqhpWDH5hw3qZA88jyR8CYLKarY/j7w8ro5wXXrgH2P9gTqzCfks3fY7CtJbASaJqh61UYfK/2wfo/sdE8AJ4hvsL8Z8FyKvevKivM60Ox1UFYxP1CRCYH236D/bGjqvdX8d7dgAdEpAyr/7lZVb8CEJGfAs8F+1YBFwTv+T/gcbEhVVZivwBU9UsRCYdkKcGeAG7LYrr+irW2eCbI2s5T1ZOSnOtZ4JospusKETkpuCYrsWw1qrpSRG4ExgXHjcKefrKVLrDf3dMa/PdUcq6MXC9gpIicEGy/T1XDOpfRWIurmcBG4PxsXq8q0nUDVjb+j+Dvq0Rt9NadgBeCbQ2AD4GfAh2ylK5hwKUiUgJswm6YCpSIyOXYE3QhdmP/aRavF9jD0huquiGyLW3XS1VLReQq4C2xE04AHgp2Xw08LSI3YbnrcOin6t6/yoeUqowPT+Kccy5l9aq1lXPOuezw4OGccy5lHjycc86lzIOHc865lHnwcM65HCcij4jIUhGZWs3jTxeRr0TkSxF5KiNp8tZWzjmX20TkEKyD4L9Udc/tHNsbGxjxcFVdJSIdVLW6Y8FVm+c8nHMux6nqe1i/jHIisquIvBaMkfW+iPQLdv0UuFeDgSwzETjAg4dzzuWrB4ERqrofcBXwj2B7H6CPiHwoNpDjMZn48PrQw9w553YowQCPBxIbUQJsaBGw+3pvbK6TrsB7IrKXqq5OZxo8eDjnXP4pwIZdH5Bk33xssq5twBwR+RoLJuOSHFurBDjnnMsjasO2zxGRHwKI6R/sfhHLdSAi7bBirNnpToMHD+ecy3EiMgr4GOgrIvNF5EJsXvkLRWQKNs3u0ODw14EVIvIVNj/6SFVdkfY0eVNd55xzqfKch3POuZR58HDOOZcyDx7OOedS5sHDOedcyjx4OOecS5kHD+eccynz4OGccy5l/w+iLmbwE6YaRAAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "plt.plot(times.jd,d_ra-53.*u.mas,'b-',times.jd,d_dec,'r-')\n", "plt.ylim([-10,10])\n", "# plt.xlim([2459000,2459120])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.2" } }, "nbformat": 4, "nbformat_minor": 2 } From adrianmpw at gmail.com Sat May 9 14:12:50 2020 From: adrianmpw at gmail.com (Adrian Price-Whelan) Date: Sat, 9 May 2020 14:12:50 -0400 Subject: [AstroPy] Effect of observer elevation on sunset time In-Reply-To: <7B3DF8E3-FFAF-4AB4-A74E-AC7764B188B0@swarthmore.edu> References: <7B3DF8E3-FFAF-4AB4-A74E-AC7764B188B0@swarthmore.edu> Message-ID: Hi Eric, I'm not sure yet what the root of the problem is, but it doesn't seem to be an astroplan issue - see the bottom of this notebook, which computes the difference in Sun altitude for the two elevations with astropy's AltAz frame (used internally by astroplan): https://gist.github.com/628c6ffed4f652d2278e970981f67854 Erik T. might have more thoughts? best, Adrian On Sat, May 9, 2020 at 11:31 AM Eric Jensen wrote: > Hi all, > > I was just working with astroplan to calculate some sunset times (actually > nautical twilight in the example below), and I noticed that specifying the > observatory elevation doesn?t seem to make any difference in the results, > contrary to my expectations. > > Example code: > > from astropy.coordinates import EarthLocation > import astroplan > from astropy.time import Time > import astropy.units as u > > location = EarthLocation.from_geodetic(-16.5097*u.deg, > 28.3*u.deg, > 2390*u.m) > # Same location, but zero elevation > location_sealevel = EarthLocation.from_geodetic(-16.5097*u.deg, > 28.3*u.deg, > 0*u.m) > teide = astroplan.Observer(location=location, > name="Teide", > timezone="Atlantic/Canary") > teide_sealevel = astroplan.Observer(location=location_sealevel, > name="Teide sea level", > timezone="Atlantic/Canary") > > now = Time.now() > n = 1000 > sun_set = teide.sun_set_time(now, which="next", > horizon=-12*u.deg, > n_grid_points=n) > sun_set_sealevel = teide_sealevel.sun_set_time(now, which="next", > horizon=-12*u.deg, > n_grid_points=n) > print("Sunset at altitude: {0.iso}, JD: {0.jd}".format(sun_set)) > print("Sunset at sea level: {0.iso}, JD: {0.jd}".format(sun_set_sealevel)) > print("Difference: {}".format((sun_set - sun_set_sealevel).to(u.s))) > > This yields the output: > > Sunset at altitude: 2020-05-09 20:41:33.933, JD: 2458979.3621982955 > Sunset at sea level: 2020-05-09 20:41:33.933, JD: 2458979.3621982983 > Difference: -0.00024139881134033203 s > > > i.e. basically no difference. There are three reasons I could think of: > > 1. The effect of observer elevation simply isn?t implemented in > astroplan. > 2. There?s something wrong with my code. > 3. There?s something wrong with my thinking that there should be a few > minutes difference (later sunset / earlier sunrise) at a few thousand > meters elevation vs. at sea level. > > My guess is #1, but I?m curious to hear if others have different > thoughts. I?m using astropy 4.0.1 and astroplan 0.6. > > Thanks, > > Eric > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- Adrian M. Price-Whelan Flatiron Institute, NYC http://adrn.github.io (he / him) -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.littlefair at sheffield.ac.uk Sat May 9 14:24:53 2020 From: s.littlefair at sheffield.ac.uk (Stuart P Littlefair) Date: Sat, 9 May 2020 19:24:53 +0100 Subject: [AstroPy] Effect of observer elevation on sunset time In-Reply-To: References: Message-ID: <237BF5AE-FD98-4117-94F3-25A6CEFA02DE@sheffield.ac.uk> I should probably think about this more before I embarrass myself but - isn?t this right? The sun is 93 million miles away so a tangential movement of a few thousand metres is going to make a negligible angular distance, no? Is the apparent difference in sunset times at high altitudes more of a refraction effect? Stuart Littlefair Dept. of Physics & Astronomy Univ. of Sheffield, Sheffield, S3 7RH email: s.littlefair at shef.ac.uk Phone: +44 114 2224525 Sent from my iPhone > On 9 May 2020, at 19:13, Adrian Price-Whelan wrote: > > ? > Hi Eric, > > I'm not sure yet what the root of the problem is, but it doesn't seem to be an astroplan issue - see the bottom of this notebook, which computes the difference in Sun altitude for the two elevations with astropy's AltAz frame (used internally by astroplan): > https://gist.github.com/628c6ffed4f652d2278e970981f67854 > > Erik T. might have more thoughts? > > best, > Adrian > >> On Sat, May 9, 2020 at 11:31 AM Eric Jensen wrote: >> Hi all, >> >> I was just working with astroplan to calculate some sunset times (actually nautical twilight in the example below), and I noticed that specifying the observatory elevation doesn?t seem to make any difference in the results, contrary to my expectations. >> >> Example code: >> >> from astropy.coordinates import EarthLocation >> import astroplan >> from astropy.time import Time >> import astropy.units as u >> >> location = EarthLocation.from_geodetic(-16.5097*u.deg, >> 28.3*u.deg, >> 2390*u.m) >> # Same location, but zero elevation >> location_sealevel = EarthLocation.from_geodetic(-16.5097*u.deg, >> 28.3*u.deg, >> 0*u.m) >> teide = astroplan.Observer(location=location, >> name="Teide", >> timezone="Atlantic/Canary") >> teide_sealevel = astroplan.Observer(location=location_sealevel, >> name="Teide sea level", >> timezone="Atlantic/Canary") >> >> now = Time.now() >> n = 1000 >> sun_set = teide.sun_set_time(now, which="next", >> horizon=-12*u.deg, >> n_grid_points=n) >> sun_set_sealevel = teide_sealevel.sun_set_time(now, which="next", >> horizon=-12*u.deg, >> n_grid_points=n) >> print("Sunset at altitude: {0.iso}, JD: {0.jd}".format(sun_set)) >> print("Sunset at sea level: {0.iso}, JD: {0.jd}".format(sun_set_sealevel)) >> print("Difference: {}".format((sun_set - sun_set_sealevel).to(u.s))) >> >> This yields the output: >> >> Sunset at altitude: 2020-05-09 20:41:33.933, JD: 2458979.3621982955 >> Sunset at sea level: 2020-05-09 20:41:33.933, JD: 2458979.3621982983 >> Difference: -0.00024139881134033203 s >> >> i.e. basically no difference. There are three reasons I could think of: >> >> 1. The effect of observer elevation simply isn?t implemented in astroplan. >> 2. There?s something wrong with my code. >> 3. There?s something wrong with my thinking that there should be a few minutes difference (later sunset / earlier sunrise) at a few thousand meters elevation vs. at sea level. >> >> My guess is #1, but I?m curious to hear if others have different thoughts. I?m using astropy 4.0.1 and astroplan 0.6. >> >> Thanks, >> >> Eric >> >> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy > > > -- > Adrian M. Price-Whelan > Flatiron Institute, NYC > http://adrn.github.io > (he / him) > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy -------------- next part -------------- An HTML attachment was scrubbed... URL: From sergio.pasra at gmail.com Sat May 9 14:41:04 2020 From: sergio.pasra at gmail.com (Sergio Pascual) Date: Sat, 9 May 2020 20:41:04 +0200 Subject: [AstroPy] Effect of observer elevation on sunset time In-Reply-To: <237BF5AE-FD98-4117-94F3-25A6CEFA02DE@sheffield.ac.uk> References: <237BF5AE-FD98-4117-94F3-25A6CEFA02DE@sheffield.ac.uk> Message-ID: Hello, I don't have my copy of Green's Spherical Astronomy with me, but I remember there is as section about the effect of height on topocentric coordinates, and hence, in sun set and rise times. The affect is about a few minutes, depending on height and latitude. Regards El s?b., 9 may. 2020 a las 20:25, Stuart P Littlefair (< s.littlefair at sheffield.ac.uk>) escribi?: > I should probably think about this more before I embarrass myself but - > isn?t this right? > > The sun is 93 million miles away so a tangential movement of a few > thousand metres is going to make a negligible angular distance, no? > > Is the apparent difference in sunset times at high altitudes more of a > refraction effect? > > Stuart Littlefair > Dept. of Physics & Astronomy > Univ. of Sheffield, Sheffield, S3 7RH > > email: s.littlefair at shef.ac.uk > Phone: +44 114 2224525 > Sent from my iPhone > > On 9 May 2020, at 19:13, Adrian Price-Whelan wrote: > > ? > Hi Eric, > > I'm not sure yet what the root of the problem is, but it doesn't seem to > be an astroplan issue - see the bottom of this notebook, which computes the > difference in Sun altitude for the two elevations with astropy's AltAz > frame (used internally by astroplan): > https://gist.github.com/628c6ffed4f652d2278e970981f67854 > > Erik T. might have more thoughts? > > best, > Adrian > > On Sat, May 9, 2020 at 11:31 AM Eric Jensen > wrote: > >> Hi all, >> >> I was just working with astroplan to calculate some sunset times >> (actually nautical twilight in the example below), and I noticed that >> specifying the observatory elevation doesn?t seem to make any difference in >> the results, contrary to my expectations. >> >> Example code: >> >> from astropy.coordinates import EarthLocation >> import astroplan >> from astropy.time import Time >> import astropy.units as u >> >> location = EarthLocation.from_geodetic(-16.5097*u.deg, >> 28.3*u.deg, >> 2390*u.m) >> # Same location, but zero elevation >> location_sealevel = EarthLocation.from_geodetic(-16.5097*u.deg, >> 28.3*u.deg, >> 0*u.m) >> teide = astroplan.Observer(location=location, >> name="Teide", >> timezone="Atlantic/Canary") >> teide_sealevel = astroplan.Observer(location=location_sealevel, >> name="Teide sea level", >> timezone="Atlantic/Canary") >> >> now = Time.now() >> n = 1000 >> sun_set = teide.sun_set_time(now, which="next", >> horizon=-12*u.deg, >> n_grid_points=n) >> sun_set_sealevel = teide_sealevel.sun_set_time(now, which="next", >> horizon=-12*u.deg, >> n_grid_points=n) >> print("Sunset at altitude: {0.iso}, JD: {0.jd}".format(sun_set)) >> print("Sunset at sea level: {0.iso}, JD: {0.jd}".format(sun_set_sealevel)) >> print("Difference: {}".format((sun_set - sun_set_sealevel).to(u.s))) >> >> This yields the output: >> >> Sunset at altitude: 2020-05-09 20:41:33.933, JD: 2458979.3621982955 >> Sunset at sea level: 2020-05-09 20:41:33.933, JD: 2458979.3621982983 >> Difference: -0.00024139881134033203 s >> >> >> i.e. basically no difference. There are three reasons I could think of: >> >> 1. The effect of observer elevation simply isn?t implemented in >> astroplan. >> 2. There?s something wrong with my code. >> 3. There?s something wrong with my thinking that there should be a few >> minutes difference (later sunset / earlier sunrise) at a few thousand >> meters elevation vs. at sea level. >> >> My guess is #1, but I?m curious to hear if others have different >> thoughts. I?m using astropy 4.0.1 and astroplan 0.6. >> >> Thanks, >> >> Eric >> >> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy >> > > > -- > Adrian M. Price-Whelan > Flatiron Institute, NYC > http://adrn.github.io > (he / him) > _______________________________________________ > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wtylergee at gmail.com Sat May 9 14:45:13 2020 From: wtylergee at gmail.com (Wilfred Tyler Gee) Date: Sat, 9 May 2020 08:45:13 -1000 Subject: [AstroPy] Effect of observer elevation on sunset time In-Reply-To: References: <237BF5AE-FD98-4117-94F3-25A6CEFA02DE@sheffield.ac.uk> Message-ID: Hi all, This was discussed some back in https://github.com/astropy/astroplan/issues/242 Eric, you might want to look at changing your pressure in addition to your elevation. On Sat, May 9, 2020 at 8:41 AM Sergio Pascual wrote: > Hello, > > I don't have my copy of Green's Spherical Astronomy with me, but I > remember there is as section about the effect of height on topocentric > coordinates, and hence, in sun set and rise times. The affect is about a > few minutes, depending on height and latitude. > > Regards > > El s?b., 9 may. 2020 a las 20:25, Stuart P Littlefair (< > s.littlefair at sheffield.ac.uk>) escribi?: > >> I should probably think about this more before I embarrass myself but - >> isn?t this right? >> >> The sun is 93 million miles away so a tangential movement of a few >> thousand metres is going to make a negligible angular distance, no? >> >> Is the apparent difference in sunset times at high altitudes more of a >> refraction effect? >> >> Stuart Littlefair >> Dept. of Physics & Astronomy >> Univ. of Sheffield, Sheffield, S3 7RH >> >> email: s.littlefair at shef.ac.uk >> Phone: +44 114 2224525 >> Sent from my iPhone >> >> On 9 May 2020, at 19:13, Adrian Price-Whelan wrote: >> >> ? >> Hi Eric, >> >> I'm not sure yet what the root of the problem is, but it doesn't seem to >> be an astroplan issue - see the bottom of this notebook, which computes the >> difference in Sun altitude for the two elevations with astropy's AltAz >> frame (used internally by astroplan): >> https://gist.github.com/628c6ffed4f652d2278e970981f67854 >> >> Erik T. might have more thoughts? >> >> best, >> Adrian >> >> On Sat, May 9, 2020 at 11:31 AM Eric Jensen >> wrote: >> >>> Hi all, >>> >>> I was just working with astroplan to calculate some sunset times >>> (actually nautical twilight in the example below), and I noticed that >>> specifying the observatory elevation doesn?t seem to make any difference in >>> the results, contrary to my expectations. >>> >>> Example code: >>> >>> from astropy.coordinates import EarthLocation >>> import astroplan >>> from astropy.time import Time >>> import astropy.units as u >>> >>> location = EarthLocation.from_geodetic(-16.5097*u.deg, >>> 28.3*u.deg, >>> 2390*u.m) >>> # Same location, but zero elevation >>> location_sealevel = EarthLocation.from_geodetic(-16.5097*u.deg, >>> 28.3*u.deg, >>> 0*u.m) >>> teide = astroplan.Observer(location=location, >>> name="Teide", >>> timezone="Atlantic/Canary") >>> teide_sealevel = astroplan.Observer(location=location_sealevel, >>> name="Teide sea level", >>> timezone="Atlantic/Canary") >>> >>> now = Time.now() >>> n = 1000 >>> sun_set = teide.sun_set_time(now, which="next", >>> horizon=-12*u.deg, >>> n_grid_points=n) >>> sun_set_sealevel = teide_sealevel.sun_set_time(now, which="next", >>> horizon=-12*u.deg, >>> n_grid_points=n) >>> print("Sunset at altitude: {0.iso}, JD: {0.jd}".format(sun_set)) >>> print("Sunset at sea level: {0.iso}, JD: >>> {0.jd}".format(sun_set_sealevel)) >>> print("Difference: {}".format((sun_set - sun_set_sealevel).to(u.s))) >>> >>> This yields the output: >>> >>> Sunset at altitude: 2020-05-09 20:41:33.933, JD: 2458979.3621982955 >>> Sunset at sea level: 2020-05-09 20:41:33.933, JD: 2458979.3621982983 >>> Difference: -0.00024139881134033203 s >>> >>> >>> i.e. basically no difference. There are three reasons I could think >>> of: >>> >>> 1. The effect of observer elevation simply isn?t implemented in >>> astroplan. >>> 2. There?s something wrong with my code. >>> 3. There?s something wrong with my thinking that there should be a few >>> minutes difference (later sunset / earlier sunrise) at a few thousand >>> meters elevation vs. at sea level. >>> >>> My guess is #1, but I?m curious to hear if others have different >>> thoughts. I?m using astropy 4.0.1 and astroplan 0.6. >>> >>> Thanks, >>> >>> Eric >>> >>> _______________________________________________ >>> AstroPy mailing list >>> AstroPy at python.org >>> https://mail.python.org/mailman/listinfo/astropy >>> >> >> >> -- >> Adrian M. Price-Whelan >> Flatiron Institute, NYC >> http://adrn.github.io >> (he / him) >> _______________________________________________ >> 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 >> > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- ~Wilfred Tyler Gee -------------- next part -------------- An HTML attachment was scrubbed... URL: From ejensen1 at swarthmore.edu Sat May 9 18:31:32 2020 From: ejensen1 at swarthmore.edu (Eric Jensen) Date: Sat, 9 May 2020 18:31:32 -0400 Subject: [AstroPy] Effect of observer elevation on sunset time In-Reply-To: References: <237BF5AE-FD98-4117-94F3-25A6CEFA02DE@sheffield.ac.uk> Message-ID: Hi all, Thanks for everyone?s comments. To be clear, I?m not talking about refraction effects, but rather about the position of the ?true horizon? due to the curvature of the Earth. It?s the same effect as when you look up in the sky after sunset and see a cloud or an airplane directly overhead (so at the same geodetic latitude and longitude that you are) that is still lit by the sun. Something higher up can see to a more distant horizon than something at sea level. I had noticed the github issue that Wilfred mentioned (thanks!), but I hadn?t read it carefully enough - now I see that it does indeed discuss this, though the person raising the issue ultimately gets around it by calculating the correction for the true horizon himself, and applying that correction by using the true horizon?s elevation (-2 degrees relative to the uncorrected horizon) to find the true time of sunset. So it?s clear that that correction isn?t applied. So I guess my question now is, why not? It seems more practical to me, at least for the sun, since it?s the elevation relative to the true horizon that determines how dark it is. I could see this being added as an option to sun_set_time (and I can look into making a PR if others think it?s useful), but I?d still be interested in hearing any thoughts about why it isn?t the default behavior. Is the altitude in the alt-az coordinate system formally defined as being that for an observer at zero elevation? Thanks again, Eric > On May 9, 2020, at 2:45 PM, Wilfred Tyler Gee wrote: > > Hi all, > > This was discussed some back in https://github.com/astropy/astroplan/issues/242 > > Eric, you might want to look at changing your pressure in addition to your elevation. > > On Sat, May 9, 2020 at 8:41 AM Sergio Pascual > wrote: > Hello, > > I don't have my copy of Green's Spherical Astronomy with me, but I remember there is as section about the effect of height on topocentric coordinates, and hence, in sun set and rise times. The affect is about a few minutes, depending on height and latitude. > > Regards > > El s?b., 9 may. 2020 a las 20:25, Stuart P Littlefair (>) escribi?: > I should probably think about this more before I embarrass myself but - isn?t this right? > > The sun is 93 million miles away so a tangential movement of a few thousand metres is going to make a negligible angular distance, no? > > Is the apparent difference in sunset times at high altitudes more of a refraction effect? > > Stuart Littlefair > Dept. of Physics & Astronomy > Univ. of Sheffield, Sheffield, S3 7RH > > email: s.littlefair at shef.ac.uk > Phone: +44 114 2224525 > Sent from my iPhone > >> On 9 May 2020, at 19:13, Adrian Price-Whelan > wrote: >> >> ? >> Hi Eric, >> >> I'm not sure yet what the root of the problem is, but it doesn't seem to be an astroplan issue - see the bottom of this notebook, which computes the difference in Sun altitude for the two elevations with astropy's AltAz frame (used internally by astroplan): >> https://gist.github.com/628c6ffed4f652d2278e970981f67854 >> >> Erik T. might have more thoughts? >> >> best, >> Adrian >> >> On Sat, May 9, 2020 at 11:31 AM Eric Jensen > wrote: >> Hi all, >> >> I was just working with astroplan to calculate some sunset times (actually nautical twilight in the example below), and I noticed that specifying the observatory elevation doesn?t seem to make any difference in the results, contrary to my expectations. >> >> Example code: >> >> from astropy.coordinates import EarthLocation >> import astroplan >> from astropy.time import Time >> import astropy.units as u >> >> location = EarthLocation.from_geodetic(-16.5097*u.deg, >> 28.3*u.deg, >> 2390*u.m) >> # Same location, but zero elevation >> location_sealevel = EarthLocation.from_geodetic(-16.5097*u.deg, >> 28.3*u.deg, >> 0*u.m) >> teide = astroplan.Observer(location=location, >> name="Teide", >> timezone="Atlantic/Canary") >> teide_sealevel = astroplan.Observer(location=location_sealevel, >> name="Teide sea level", >> timezone="Atlantic/Canary") >> >> now = Time.now() >> n = 1000 >> sun_set = teide.sun_set_time(now, which="next", >> horizon=-12*u.deg, >> n_grid_points=n) >> sun_set_sealevel = teide_sealevel.sun_set_time(now, which="next", >> horizon=-12*u.deg, >> n_grid_points=n) >> print("Sunset at altitude: {0.iso}, JD: {0.jd}".format(sun_set)) >> print("Sunset at sea level: {0.iso}, JD: {0.jd}".format(sun_set_sealevel)) >> print("Difference: {}".format((sun_set - sun_set_sealevel).to(u.s))) >> >> This yields the output: >> >> Sunset at altitude: 2020-05-09 20:41:33.933, JD: 2458979.3621982955 >> Sunset at sea level: 2020-05-09 20:41:33.933, JD: 2458979.3621982983 >> Difference: -0.00024139881134033203 s >> >> i.e. basically no difference. There are three reasons I could think of: >> >> 1. The effect of observer elevation simply isn?t implemented in astroplan. >> 2. There?s something wrong with my code. >> 3. There?s something wrong with my thinking that there should be a few minutes difference (later sunset / earlier sunrise) at a few thousand meters elevation vs. at sea level. >> >> My guess is #1, but I?m curious to hear if others have different thoughts. I?m using astropy 4.0.1 and astroplan 0.6. >> >> Thanks, >> >> Eric >> >> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy >> >> >> -- >> Adrian M. Price-Whelan >> Flatiron Institute, NYC >> http://adrn.github.io >> (he / him) >> _______________________________________________ >> 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 > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > > > -- > ~Wilfred Tyler Gee > _______________________________________________ > 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: smime.p7s Type: application/pkcs7-signature Size: 3946 bytes Desc: not available URL: From brewer at astro.umass.edu Sat May 9 19:31:13 2020 From: brewer at astro.umass.edu (Michael Brewer) Date: Sat, 9 May 2020 19:31:13 -0400 Subject: [AstroPy] consistency of reference frames between SkyCoord and JPL Horizons In-Reply-To: References: <17418b6b-8206-0aee-7a0d-95911be364f1@oca.eu> <22CE4992-8000-4540-9E3E-9923EBC785C9@swarthmore.edu> <3c42b8fc-8b42-e692-e45b-b360aca3f510@astro.umass.edu> <9c8a6657-3c7f-6593-2043-5f8210b70857@astro.umass.edu> <44ea2f2e-0ad1-2f01-0aaa-094db91d5a8c@oca.eu> Message-ID: <49833c31-8c25-3cc9-44b1-9d3e6bab195c@astro.umass.edu> Paolo, The current version of Astropy treats all target bodies as if they are at infinite distance for the gravitational deflection of light. The issue with going forward in time is likely due to inaccurate EOP predictions. Best, Michael Brewer On 05/09/2020 11:27 AM, Paolo Tanga wrote: > > A couple more intriguing (troublesome?) elements. > > - I repeated the exercise with distant TNOs (e.g. Quaoar), and it > appears that the amplitude of the spikes in RA,Dec difference, > decreases with the object distance (in agreement with an origin > related to light deflection discrepancy for stars vs. nearby targets). > > - I realized (strikingly visible for Quaoar and Eris) that there is an > epoch at which the behavior of the secondary fluctuations changes > dramatically. Starting from my origin (April 9, 2020) and going back > in time by ~1000 days, basically only the spikes remain, and the > agreement is at ~mas level (-53 mas in RA). Forward in time, around > end of July, the curve starts to show suddenly the fluctuations, with > some added short-period variations. > > In the attachment, the python notebook showing these phenomena.... > > The origin of this, for the moment, is mysterious to me. > > Paolo > > On 09/05/2020 10:00, Paolo Tanga wrote: >> >> Hi Michael >> >> yes, I figured out time was required. Concerning distance, it was a >> bug in my script, making confusion with a previous test in the same >> Jupyter notebook..... Sorry for that. Of course now it works perfectly! >> >> Thank you also for the topocentric example. The whole procedure looks >> now robust! >> >>> The positions are off a bit more than I'd like to see, >> Intrigued by this, I reworked my example (asteroid Apollonia) to >> perform the computation of the "apparent position in true >> coordinates" over 1000 days, interval of 1 day. >> >> I then plotted the difference wrt JPL in RA*cos(Dec) (blue, after >> substraction of 53 mas) and Dec (red). The result looks instructive >> and non-trivial: >> >> >> The spikes correspond to the minimum solar elongations (I plotted it >> to compare), which may point out to the "wrong" computation of light >> deflection for a finite-distance object. But the other fluctuations >> away from conjunction are still significant and harder to understand. >> RA have those secondary peaks at 7-8 mas far from conjunction that >> are puzzling (and nearly absent in Dec!)... >> >> regards >> >> Paolo >> >> On 08/05/2020 23:55, Michael Brewer wrote: >>> Hi Paolo, >>> >>> I forgot about time. You need to tell the GCRS frame the time of >>> the observation. But you must have figured that out as you got good >>> agreement in position, so the error in distance is odd. I tried an >>> example with the following script: >>> >>> from astropy.time import Time >>> from astropy.coordinates import get_body_barycentric, SkyCoord, GCRS >>> from astropy.coordinates.solar_system import >>> _apparent_position_in_true_coordinates >>> import astropy.units as u >>> >>> #Mars Geocentric JPL 2020-May-07 00:00:00 328.364842462 >>> -14.682567251 328.634953692 -14.587885357 1.18472191315873 >>> >>> my_time = Time('2020-05-07T00:00:00') >>> my_astrometric = SkyCoord( 328.364842462*u.deg, -14.682567251*u.deg, >>> 1.18472191315873*u.au ) >>> my_apparent = SkyCoord( 328.634953692*u.deg, -14.587885357*u.deg, >>> 1.18472191315873*u.au ) >>> >>> print ('JPL ICRS', my_astrometric) >>> >>> my_object_ICRS = SkyCoord( my_astrometric.cartesian + >>> get_body_barycentric('earth', my_time) ) >>> >>> print ('ICRS', my_object_ICRS) >>> >>> my_object_apparent = _apparent_position_in_true_coordinates( >>> my_object_ICRS.transform_to(GCRS(obstime=my_time))) >>> >>> print ('apparent', my_object_apparent) >>> >>> print ('delta ra', (my_object_apparent.ra - my_apparent.ra).to(u.mas), >>> 'delta dec', (my_object_apparent.dec - >>> my_apparent.dec).to(u.mas), >>> 'delta distance', (my_object_apparent.distance - >>> my_apparent.distance).to(u.meter) ) >>> >>> And got this result: >>> >>> JPL ICRS >> (328.36484246, -14.68256725, 1.18472191)> >>> ICRS >> (282.36772087, -24.4176493, 1.42516501)> >>> apparent >> obsgeoloc=(0., 0., 0.) m, obsgeovel=(0., 0., 0.) m / s): (ra, dec, >>> distance) in (deg, deg, AU) >>> (328.63496745, -14.58788562, 1.18472191)> >>> delta ra 49.5348mas delta dec -0.964467mas delta distance >>> -6.643480019441483e-05 m >>> >>> The positions are off a bit more than I'd like to see, but the >>> distance is right on. >>> >>> By the way, thanks to an example from Stuart Littlefair, I figured >>> out how to do this using topocentric coordinates also. This is just >>> a matter of setting up an EarthLocation my_loc and then doing: >>> >>> earth_loc = get_body_barycentric('earth', my_time) >>> obsgeoloc, obsgeovel = my_loc.get_gcrs_posvel(my_time) >>> earth_loc += obsgeoloc >>> >>> before adding earth_loc to your topocentric astrometric coordinates >>> from Horizons and then you also need to tell the GCRS frame your >>> location and velocity: >>> >>> my_object_apparent = _apparent_position_in_true_coordinates( >>> my_object_ICRS.transform_to( >>> GCRS(obsgeoloc=obsgeoloc, obsgeovel=obsgeovel, >>> obstime=my_time))) >>> >>> >>> Regards, >>> >>> Michael Brewer >>> >>> >>> On 05/07/2020 09:59 AM, Paolo Tanga wrote: >>>> >>>> Hi Micheal >>>> >>>> I did the test following your instructions and I correctly found >>>> the result that you indicate: 52.5 mas of discrepancty in RA, and >>>> negligible in Dec (0.01 mas). >>>> >>>> However, I notice something strange. At the first step: >>>> >>>> my_object_ICRS = SkyCoord( SkyCoord( JPL geocentric astrometric >>>> coordinates ).cartesian + get_body_barycentric('earth', my_time) ) >>>> >>>> I give as "JPL geocentric astrometric coordinates" ra, dec and >>>> distance. I chose first the geocentric distance (delta, in my case >>>> 2.0958388 au). >>>> >>>> Then I get >>>> >>>> my_object_ICRS.distance = 3.816102 au. >>>> >>>> Formally, this may be correct, as this is the result of the >>>> addition of barycenter-to-Earth vector. But then, even if I am now >>>> in geocentric ICRS, it does not represent the geocentric distance. >>>> >>>> At the end of the process, after transformation to GCRS and then to >>>> apparent coordinates (by _apparent_position_in_true_coordinates) I >>>> find: >>>> >>>> my_object_apparent.distance = 2.962877... au, which is off the JPL >>>> value for delta given above by ~0.9 au. >>>> >>>> If at the beginning I give 'r' (heliocentric distance = 2.95757466, >>>> instead of 'delta'), I still get: >>>> >>>> my_object_ICRS.distance = 3.810857 but now my_object_apparent.distance >>>> >>>> but then: >>>> >>>> my_object_apparent.distance =2.957567 >>>> >>>> which is much closer to the geocentric distance.... So, whatever >>>> the choice, it looks like the distance goes completely wrong and >>>> there is no way to obtain the correct value directly from the >>>> transformations. As ra and dec are correct, the only solution seems >>>> to apply a correction to the distance at the end of the computation. >>>> >>>> Is this behavior consistent with what you would expect ? >>>> >>>> best regards >>>> >>>> Paolo >>>> >>>> >>>> >>>> >>>> On 01/05/2020 23:20, Michael Brewer wrote: >>>>> Paolo, >>>>> >>>>> I can tell you how to do this. First query JPL Horizons for your >>>>> target body setting the observer location to the Earth's >>>>> geocenter. This will return the astrometric position of the target >>>>> body in the ICRF frame referred to the Earth's geocenter including >>>>> the proper light time offset. Now you want these coordinates as an >>>>> astropy SkyCoord object in astropy's ICRS frame. The problem here >>>>> is that astropy always refers ICRS coordinates to the solar system >>>>> barycenter. This will require you to add the solar system >>>>> barycentric position of the Earth's geocenter. The way to do this >>>>> is: First create a SkyCoord object using the coordinates that you >>>>> got from your query, call get_body_barycentric() to get the >>>>> Earth's position and then add these two together to get a proper >>>>> astropy SkyCoord object. This looks like this: >>>>> >>>>> from astropy.coordinates.solar_system import get_body_barycentric >>>>> my_object_ICRS = SkyCoord( SkyCoord( JPL geocentric astrometric >>>>> coordinates ).cartesian + get_body_barycentric('earth', my_time) ) >>>>> >>>>> Now if you want to compare the result with JPL Horizons apparent >>>>> place, you need to realize that JPL's apparent place is referenced >>>>> to the true equator and equinox of date whereas astropy's CIRS >>>>> frame is referenced to the Celestial Intermediate Origin. >>>>> Fortunately, there is a function that converts GCRS coordinates to >>>>> true apparent place: >>>>> >>>>> from astropy.coordinates.solar_system import >>>>> _apparent_position_in_true_coordinates >>>>> my_object_apparent = _apparent_position_in_true_coordinates( >>>>> my_object_ICRS.transform_to('gcrs') ) >>>>> >>>>> The result should compare to JPL Horizons to 53 mas in RA. This 53 >>>>> mas is a rather mysterious offset that I pointed out to the JPL >>>>> Horizons people awhile ago. It took me awhile to convince them of >>>>> this, but I'm happy to see that they have now accepted it and are >>>>> making a note of it in their output files. There will be some >>>>> small residual offsets due to the fact that JPL Horizons uses a >>>>> slightly different set of earth orientation parameters than those >>>>> used by astropy, but these are usually less than 1 mas. >>>>> >>>>> I have raised an issue in this regard on github (Issue #10230) >>>>> requesting two new built-in frames for converting to geocentric or >>>>> topocentric astrometric place and true apparent place. If these >>>>> ever get implemented, this process will become a lot easier. >>>>> >>>>> Best Regards, >>>>> >>>>> Michael Brewer >>>>> >>>>> >>>>> >>>>> On 05/01/2020 04:01 AM, Paolo Tanga wrote: >>>>>> >>>>>> Hi Eric >>>>>> >>>>>> thank you for your other comments. Some answers below.y >>>>>> >>>>>> On 01/05/2020 05:09, Eric Jensen wrote: >>>>>>> Like Ben, I?m a little unclear on exactly what you are trying to >>>>>>> achieve beyond what you?ve demonstrated already. (I have >>>>>>> learned from your example!) You have shown that Horizons >>>>>>> provides astrometric coordinates that are ICRS, and that these >>>>>>> are straightforward to insert into a SkyCoord object as you show >>>>>>> in your example. >>>>>> >>>>>> my whole point here is that this works *only* when you query >>>>>> Horizons for astrometric coordinates with an observer at "@0" (= >>>>>> the Solar System barycenter), and this is not explicitly >>>>>> explained in the documentation. My other point is that I am not >>>>>> so expert in all features in astropy, so I wanted to have a >>>>>> confirmation (which essentially I got, I think). Eventually, >>>>>> somebody could be able to define a "custom" frame that works for >>>>>> all output returned by Horizons. >>>>>> >>>>>>> >>>>>>> If for some reason you want to use the apparent coordinates >>>>>>> instead, then you need to put them into a SkyCoord frame that >>>>>>> precesses, which as I understand it is what the >>>>>>> PrecessedGeocentric frame is for. So with a slight modification >>>>>>> of your example, you can do this: >>>>>>> >>>>>>> (...)Doing this, I get coordinates that differ by about 13 >>>>>>> arcsec (mostly in RA) from the GCRS coords you create in the >>>>>>> first part of your example using the ICRS coords at the >>>>>>> barycenter. I don?t know what the source of that difference is, >>>>>>> but perhaps some of the various GR corrections. >>>>>> >>>>>> Thank you for this additional example, but in my view this shows >>>>>> that even in this approach you do not get consistent results. 13 >>>>>> arcsec are a huge discrepancy, not for most amateur use, but for >>>>>> today's standard. In fact, probably the effect is due to annual >>>>>> aberration (most of it) and light bending (a few mas). But what >>>>>> is the interest of including relativistic corrections in astropy, >>>>>> if then you cannot get an agreement at ~mas level, at least? For >>>>>> professional use in the Gaia era, this is a requirement. >>>>>> >>>>>>> There are indeed subtleties in converting between various >>>>>>> coordinates systems, as you note, but I would say that those >>>>>>> subtleties are inherent to the topic in general, not to the >>>>>>> astropy software in particular. >>>>>> True! And the whole topic is complex. But astropy already does a >>>>>> great service to the user, by providing out of the box, accurate >>>>>> transformations with all the bells and whistles. So, providing >>>>>> information on how to use (at full accuracy!) astroquery.horizons >>>>>> (or new reference frames to improve consistency!) I think goes in >>>>>> the same direction. By the way, note that the issues in the other >>>>>> mail thread by Michael Brewer also partially addresses the same >>>>>> problem. >>>>>>> That said, examples are quite helpful, so I?d encourage you to >>>>>>> submit an example based on your work here for inclusion on the >>>>>>> examples page at >>>>>>> https://docs.astropy.org/en/stable/generated/examples/ . >>>>>> >>>>>> I will certainly do, including warnings about how NOT to use the >>>>>> Horizons output with SkyCoords... ;-) ...! >>>>>> >>>>>> Cheers >>>>>> >>>>>> Paolo >>>>>> >>>>>> >>>>>>> >>>>>>> >>>>>>>> On Apr 29, 2020, at 11:23 AM, Paolo Tanga >>>>>>> > wrote: >>>>>>>> >>>>>>>> Hi Ben >>>>>>>> >>>>>>>> thank you for taking your time to look into this question, and >>>>>>>> sorry for the delay. >>>>>>>> >>>>>>>> I would say, all that I am trying to do is to use the >>>>>>>> astroquery output in a SkyCoord object coherently. If one >>>>>>>> manages to do that, than it is possible to take profit of all >>>>>>>> the SkyCoord methods of course, to manipulate the coordinates >>>>>>>> (transform_to ) etc. >>>>>>>> >>>>>>>> As the SkyCoord is a fundamental part of the astropy suite, I >>>>>>>> would expect that there should be a "easy" method (or at least, >>>>>>>> a documented one!) to pass from an astroquery/JPL result to >>>>>>>> SkyCoord. But it turns out that this is not the case. >>>>>>>> >>>>>>>> So, what we have learned so far, if I am correct, is that: >>>>>>>> >>>>>>>> - JPL apparent coordinates. Precession - you are totally right >>>>>>>> - creates the difference between GCRS and the JPL apparent >>>>>>>> coordinates. In the documentation I would explicitly write that >>>>>>>> these cannot easily be used in a SkyCoord frame. In fact I >>>>>>>> tried playing with different reference frames (including >>>>>>>> GeocentricTrueEquator etc) but I see the same inconsistencies >>>>>>>> as with GCRS. So, I suppose that if there is a method, it is >>>>>>>> not straightforward (at least, not for me). >>>>>>>> >>>>>>>> - JPL astrometric coordinates. If computed with the observer at >>>>>>>> the barycenter of the Solar System, they can fit a SkyCoord >>>>>>>> object in ICRS. And this is the only possibility. >>>>>>>> >>>>>>>> I think that there could be other subtleties to check, but >>>>>>>> don't you think that this should be documented somewhere? >>>>>>>> >>>>>>>> Note that in the case of the ephemeris of the major planets >>>>>>>> (get_body()...) a SkyCoord object is directly returned, which >>>>>>>> is very convenient. >>>>>>>> >>>>>>>> Cheers >>>>>>>> >>>>>>>> Paolo >>>>>>>> >>>>>>>> >>>>>>>> On 25/04/2020 10:43, Benjamin Weiner wrote: >>>>>>>>> Hello Paolo, >>>>>>>>> >>>>>>>>> I am not entirely sure what end result you wish to achieve, >>>>>>>>> nor am I an expert on SkyCoord. However, I have a >>>>>>>>> suggestion to understand further these discrepancies (and >>>>>>>>> thank you for including the notebook example). In your first >>>>>>>>> example: >>>>>>>>> (a) JPL's barycentric coords to build ICRS at specified time, >>>>>>>>> then transformed to GCRS at specified time. >>>>>>>>> (b) JPL's apparent coords to build GCRS at specified time. >>>>>>>>> >>>>>>>>> The separation of 16 arcmin between (a) and (b) is due to the >>>>>>>>> precession of the Earth's axis from 2000 to 2020. This can be >>>>>>>>> seen if we substitute >>>>>>>>> time = Time('2000-01-01T00:00:00', scale='utc') >>>>>>>>> in the line of your notebook that sets the time. At >>>>>>>>> 2000-01-01, the separation reduces to 8 arcseconds, which you >>>>>>>>> have identified as coming from the aberration of starlight. >>>>>>>>> >>>>>>>>> I think that the discrepancy is in building the GCRS >>>>>>>>> coordinates from the apparent RA/Dec. The JPL apparent >>>>>>>>> coordinates are referenced to the position of the Earth's axis >>>>>>>>> at the specified time. But the axes of GCRS are non-rotating >>>>>>>>> with respect to the axes of BCRS and ICRS - that is, GCRS is >>>>>>>>> fixed to the Earth's center, but not to the Earth's axis, and >>>>>>>>> does not precess. I believe that this is correct - USNO >>>>>>>>> circular 179 has more gory details on the definition of >>>>>>>>> coordinate frames, see >>>>>>>>> https://www.usno.navy.mil/USNO/astronomical-applications/publications/Circular_179.pdf >>>>>>>>> >>>>>>>>> Cheers, >>>>>>>>> Ben >>>>>>>>> >>>>>>>>> On Fri, Apr 24, 2020 at 9:01 AM >>>>>>>> > wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> Message: 1 >>>>>>>>> Date: Fri, 24 Apr 2020 15:00:22 +0200 >>>>>>>>> From: Paolo Tanga >>>>>>>> > >>>>>>>>> To: AstroPy at python.org >>>>>>>>> Subject: [AstroPy] consistency of reference frames between >>>>>>>>> SkyCoord >>>>>>>>> and JPL Horizons >>>>>>>>> Message-ID: >>>>>>>> > >>>>>>>>> Content-Type: text/plain; charset="utf-8"; Format="flowed" >>>>>>>>> >>>>>>>>> Hi all >>>>>>>>> >>>>>>>>> I am trying to plug the results by JPL Horizons into the >>>>>>>>> appropriate >>>>>>>>> reference system of a SkyCoord object, but it looks very >>>>>>>>> trick. (bewore >>>>>>>>> long message, I hope the explanation is clear for the >>>>>>>>> specialists of >>>>>>>>> reference systems) >>>>>>>>> >>>>>>>>> The Horizons server returns two types of equatorial >>>>>>>>> coordinates: >>>>>>>>> "astrometric" (1) and (2) "apparent". >>>>>>>>> >>>>>>>>> Their description is the following: >>>>>>>>> >>>>>>>>> - (1): astrometric RA and Dec with respect to the >>>>>>>>> observing site >>>>>>>>> (coordinate origin) in the reference frame of >>>>>>>>> the planetary ephemeris (ICRF). Compensated for down-leg >>>>>>>>> light-time >>>>>>>>> delay aberration. >>>>>>>>> >>>>>>>>> - (2): Airless apparent RA and Dec of the target with >>>>>>>>> respect to an >>>>>>>>> instantaneous reference frame defined by the Earth equator >>>>>>>>> of-date >>>>>>>>> (z-axis) and meridian containing the Earth equinox of-date >>>>>>>>> (x-axis, >>>>>>>>> IAU76/80). Compensated for down-leg light-time delay, >>>>>>>>> gravitational >>>>>>>>> deflection of light, stellar aberration, precession & >>>>>>>>> nutation. Note: >>>>>>>>> equinox (RA origin) is offset -53 mas from the of-date >>>>>>>>> frame defined by >>>>>>>>> the IAU06/00a P & N system. >>>>>>>>> >>>>>>>>> My guess is none of these two systems correspond to either >>>>>>>>> ICRS or GCRS >>>>>>>>> as defined in astropy. The simplest possibility for me, >>>>>>>>> would have been >>>>>>>>> to assimilate (1), computed for the Solar System >>>>>>>>> barycenter, to ICRS. >>>>>>>>> But definitely (2) is not GCRS and the test below easily >>>>>>>>> proves that. >>>>>>>>> >>>>>>>>> Verification (see the attached notebook if you want to >>>>>>>>> play with) : >>>>>>>>> >>>>>>>>> - I queried for Solar System barycentric coordinates (1) >>>>>>>>> of an asteroid >>>>>>>>> at one epoch. I inserted them in a SkyCoord object as ICRS >>>>>>>>> and use the >>>>>>>>> transform_to(GCRS) towards geocentric, at the given epoch. >>>>>>>>> >>>>>>>>> - I queried again JPL Horizons for the apparent >>>>>>>>> coordinates (2) from the >>>>>>>>> geocenter, directly. >>>>>>>>> >>>>>>>>> As expected, by comparing the results I get the patent >>>>>>>>> confirmation that >>>>>>>>> GCRS is not the frame of (2), with a discrepancy of 16 >>>>>>>>> arcmin in my >>>>>>>>> case. SO, IT DOES NOT WORK, AS EXPECTED. Let's put >>>>>>>>> apparent coordinates >>>>>>>>> (2) aside for the moment. >>>>>>>>> >>>>>>>>> Second possibility (see notebook again). >>>>>>>>> >>>>>>>>> I take coordinates (1), for the geocentric observer. I >>>>>>>>> insert them as >>>>>>>>> GCRS in a SkyCoord object. I trasform_to(ICRS) >>>>>>>>> (barycentric observer) >>>>>>>>> and compare the result to a query of (1) directly for the >>>>>>>>> barycentric >>>>>>>>> observer. >>>>>>>>> >>>>>>>>> Again this SHOULD NOT WORK accurately. In fact the >>>>>>>>> definition of (1) >>>>>>>>> does not contain annual aberration and light deflection >>>>>>>>> that are part of >>>>>>>>> GCRS. A difference of several arcsec (mostly due to annual >>>>>>>>> aberration) >>>>>>>>> SHOULD show up. And in fact IT DOES, ~8 arcsec of difference. >>>>>>>>> >>>>>>>>> The conclusions if that using SkyCoord with the output of >>>>>>>>> JPL Horizons >>>>>>>>> is far from obvious to the end user... >>>>>>>>> >>>>>>>>> ---- >>>>>>>>> >>>>>>>>> So, my final questions/remarks are: >>>>>>>>> >>>>>>>>> - How to get a fully accurate consistency between a >>>>>>>>> SkyCoord frame and >>>>>>>>> JPL Horizons output, in the case of a barycentric, >>>>>>>>> geocentric or >>>>>>>>> topocentric observer, for both "astrometric" and >>>>>>>>> "apparent" coordinates >>>>>>>>> as provided by JPL? Which reference SkyCoord should use >>>>>>>>> and how? >>>>>>>>> >>>>>>>>> - Does astropy implement GCRS correctly in the case of >>>>>>>>> Solar System >>>>>>>>> objects, by taking into account aberration and light >>>>>>>>> deflection in the >>>>>>>>> relativistic form, for an object at finite distance >>>>>>>>> (different than for >>>>>>>>> the stars!) ? >>>>>>>>> >>>>>>>>> - ...or... Am I missing something fundamental in my >>>>>>>>> interpretation? >>>>>>>>> >>>>>>>>> - Eventually, this query to Horizons turns our to be >>>>>>>>> tricky to manage as >>>>>>>>> SkyCoord for the final user. I think it would be useful to >>>>>>>>> provide the >>>>>>>>> correct recipe and/or directly a SkyCoord as output of the >>>>>>>>> query... >>>>>>>>> >>>>>>>>> Best regards >>>>>>>>> >>>>>>>>> Paolo >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Benjamin Weiner >>>>>>>>> Staff Scientist / Associate Astronomer, MMT / Steward Observatory >>>>>>>>> bjw at as.arizona.edu >>>>>>>>> http://mingus.mmto.arizona.edu/~bjw/ >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> AstroPy mailing list >>>>>>>>> AstroPy at python.org >>>>>>>>> https://mail.python.org/mailman/listinfo/astropy >>>>>>>> -- >>>>>>>> --------------------------------------------------------------------- >>>>>>>> Paolo Tanga Astronomer >>>>>>>> Deputy director of Laboratoire Langrange / UMR 7293 >>>>>>>> Observatoire de la C?te d'Azur Tel +33(0)492003042 >>>>>>>> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >>>>>>>> 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga >>>>>>>> https://twitter.com/ziggypao >>>>>>>> _______________________________________________ >>>>>>>> AstroPy mailing list >>>>>>>> AstroPy at python.org >>>>>>>> https://mail.python.org/mailman/listinfo/astropy >>>>>>> >>>>>> -- >>>>>> --------------------------------------------------------------------- >>>>>> Paolo Tanga Astronomer >>>>>> Deputy director of Laboratoire Langrange / UMR 7293 >>>>>> Observatoire de la C?te d'Azur Tel +33(0)492003042 >>>>>> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >>>>>> 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga >>>>>> https://twitter.com/ziggypao >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> 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 >>>> -- >>>> --------------------------------------------------------------------- >>>> Paolo Tanga Astronomer >>>> Deputy director of Laboratoire Langrange / UMR 7293 >>>> Observatoire de la C?te d'Azur Tel +33(0)492003042 >>>> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >>>> 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga >>>> https://twitter.com/ziggypao >>>> >>>> >>>> _______________________________________________ >>>> 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 >> -- >> --------------------------------------------------------------------- >> Paolo Tanga Astronomer >> Deputy director of Laboratoire Langrange / UMR 7293 >> Observatoire de la C?te d'Azur Tel +33(0)492003042 >> Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 >> 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga >> https://twitter.com/ziggypao >> >> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy > -- > --------------------------------------------------------------------- > Paolo Tanga Astronomer > Deputy director of Laboratoire Langrange / UMR 7293 > Observatoire de la C?te d'Azur Tel +33(0)492003042 > Bv de l'Observatoire - CS 34229 Fax +33(0)492003121 > 06304 Nice Cedex 4 - Francehttp://www.oca.eu/tanga > https://twitter.com/ziggypao > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.littlefair at sheffield.ac.uk Mon May 11 04:57:35 2020 From: s.littlefair at sheffield.ac.uk (Stuart P Littlefair) Date: Mon, 11 May 2020 09:57:35 +0100 Subject: [AstroPy] Effect of observer elevation on sunset time In-Reply-To: References: <237BF5AE-FD98-4117-94F3-25A6CEFA02DE@sheffield.ac.uk> Message-ID: Hi Eric, The alt-az system reflects where a perfect theodolite would point to see the source, so there isn't a concept of an apparent horizon in the alt-az coordinate system. A general correction for apparent horizon doesn't make much sense either, since increased altitude does not necessarily lead to a lower apparent horizon compared to a sea-level observer (for example, in mountain ranges). But it does make a lot of sense in the context of most astronomical observatories, so I'd think a keyword argument to astroplan's sun_set_time would be a useful addition. Something like: sun_set = teide.sun_set_time(now, which="next", horizon=-12*u.deg, use_apparent_horizon=True) On Sat, 9 May 2020 at 23:32, Eric Jensen wrote: > Hi all, > > Thanks for everyone?s comments. To be clear, I?m not talking about > refraction effects, but rather about the position of the ?true horizon? due > to the curvature of the Earth. It?s the same effect as when you look up in > the sky after sunset and see a cloud or an airplane directly overhead (so > at the same geodetic latitude and longitude that you are) that is still lit > by the sun. Something higher up can see to a more distant horizon than > something at sea level. > > I had noticed the github issue that Wilfred mentioned (thanks!), but I > hadn?t read it carefully enough - now I see that it does indeed discuss > this, though the person raising the issue ultimately gets around it by > calculating the correction for the true horizon himself, and applying that > correction by using the true horizon?s elevation (-2 degrees relative to > the uncorrected horizon) to find the true time of sunset. > > So it?s clear that that correction isn?t applied. So I guess my question > now is, why not? It seems more practical to me, at least for the sun, > since it?s the elevation relative to the true horizon that determines how > dark it is. > > I could see this being added as an option to sun_set_time (and I can look > into making a PR if others think it?s useful), but I?d still be interested > in hearing any thoughts about why it isn?t the default behavior. Is the > altitude in the alt-az coordinate system formally defined as being that for > an observer at zero elevation? > > Thanks again, > > Eric > > > On May 9, 2020, at 2:45 PM, Wilfred Tyler Gee wrote: > > Hi all, > > This was discussed some back in > https://github.com/astropy/astroplan/issues/242 > > Eric, you might want to look at changing your pressure in addition to your > elevation. > > On Sat, May 9, 2020 at 8:41 AM Sergio Pascual > wrote: > >> Hello, >> >> I don't have my copy of Green's Spherical Astronomy with me, but I >> remember there is as section about the effect of height on topocentric >> coordinates, and hence, in sun set and rise times. The affect is about a >> few minutes, depending on height and latitude. >> >> Regards >> >> El s?b., 9 may. 2020 a las 20:25, Stuart P Littlefair (< >> s.littlefair at sheffield.ac.uk>) escribi?: >> >>> I should probably think about this more before I embarrass myself but - >>> isn?t this right? >>> >>> The sun is 93 million miles away so a tangential movement of a few >>> thousand metres is going to make a negligible angular distance, no? >>> >>> Is the apparent difference in sunset times at high altitudes more of a >>> refraction effect? >>> >>> Stuart Littlefair >>> Dept. of Physics & Astronomy >>> Univ. of Sheffield, Sheffield, S3 7RH >>> >>> email: s.littlefair at shef.ac.uk >>> Phone: +44 114 2224525 >>> Sent from my iPhone >>> >>> On 9 May 2020, at 19:13, Adrian Price-Whelan >>> wrote: >>> >>> ? >>> Hi Eric, >>> >>> I'm not sure yet what the root of the problem is, but it doesn't seem to >>> be an astroplan issue - see the bottom of this notebook, which computes the >>> difference in Sun altitude for the two elevations with astropy's AltAz >>> frame (used internally by astroplan): >>> https://gist.github.com/628c6ffed4f652d2278e970981f67854 >>> >>> Erik T. might have more thoughts? >>> >>> best, >>> Adrian >>> >>> On Sat, May 9, 2020 at 11:31 AM Eric Jensen >>> wrote: >>> >>>> Hi all, >>>> >>>> I was just working with astroplan to calculate some sunset times >>>> (actually nautical twilight in the example below), and I noticed that >>>> specifying the observatory elevation doesn?t seem to make any difference in >>>> the results, contrary to my expectations. >>>> >>>> Example code: >>>> >>>> from astropy.coordinates import EarthLocation >>>> import astroplan >>>> from astropy.time import Time >>>> import astropy.units as u >>>> >>>> location = EarthLocation.from_geodetic(-16.5097*u.deg, >>>> 28.3*u.deg, >>>> 2390*u.m) >>>> # Same location, but zero elevation >>>> location_sealevel = EarthLocation.from_geodetic(-16.5097*u.deg, >>>> 28.3*u.deg, >>>> 0*u.m) >>>> teide = astroplan.Observer(location=location, >>>> name="Teide", >>>> timezone="Atlantic/Canary") >>>> teide_sealevel = astroplan.Observer(location=location_sealevel, >>>> name="Teide sea level", >>>> timezone="Atlantic/Canary") >>>> >>>> now = Time.now() >>>> n = 1000 >>>> sun_set = teide.sun_set_time(now, which="next", >>>> horizon=-12*u.deg, >>>> n_grid_points=n) >>>> sun_set_sealevel = teide_sealevel.sun_set_time(now, which="next", >>>> horizon=-12*u.deg, >>>> n_grid_points=n) >>>> print("Sunset at altitude: {0.iso}, JD: {0.jd}".format(sun_set)) >>>> print("Sunset at sea level: {0.iso}, JD: >>>> {0.jd}".format(sun_set_sealevel)) >>>> print("Difference: {}".format((sun_set - sun_set_sealevel).to(u.s))) >>>> >>>> This yields the output: >>>> >>>> Sunset at altitude: 2020-05-09 20:41:33.933, JD: 2458979.3621982955 >>>> Sunset at sea level: 2020-05-09 20:41:33.933, JD: 2458979.3621982983 >>>> Difference: -0.00024139881134033203 s >>>> >>>> >>>> i.e. basically no difference. There are three reasons I could think >>>> of: >>>> >>>> 1. The effect of observer elevation simply isn?t implemented in >>>> astroplan. >>>> 2. There?s something wrong with my code. >>>> 3. There?s something wrong with my thinking that there should be a few >>>> minutes difference (later sunset / earlier sunrise) at a few thousand >>>> meters elevation vs. at sea level. >>>> >>>> My guess is #1, but I?m curious to hear if others have different >>>> thoughts. I?m using astropy 4.0.1 and astroplan 0.6. >>>> >>>> Thanks, >>>> >>>> Eric >>>> >>>> _______________________________________________ >>>> AstroPy mailing list >>>> AstroPy at python.org >>>> https://mail.python.org/mailman/listinfo/astropy >>>> >>> >>> >>> -- >>> Adrian M. Price-Whelan >>> Flatiron Institute, NYC >>> http://adrn.github.io >>> (he / him) >>> _______________________________________________ >>> 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 >>> >> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy >> > > > -- > ~Wilfred Tyler Gee > _______________________________________________ > 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 > -- Stuart Littlefair ------------------------------------------------------- *I don't expect you to respond to my email outside your working hours. * *At the University of Sheffield we value and encourage flexible working patterns, so please be assured that I respect your working pattern and I am looking forward to your response when you are next working. * ------------------------------------------------------- Dept. of Physics & Astronomy, Univ. of Sheffield, Sheffield, S3 7RH. email: S.Littlefair at sheffield.ac.uk phone: +44 114 2224525 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dianasco at astro.uni-bonn.de Tue May 12 04:49:48 2020 From: dianasco at astro.uni-bonn.de (Diana Scognamiglio) Date: Tue, 12 May 2020 10:49:48 +0200 Subject: [AstroPy] Fwd: Info LevMarLSQFitter Message-ID: An embedded message was scrubbed... From: "Diana Scognamiglio" Subject: Info LevMarLSQFitter Date: Mon, 11 May 2020 20:14:45 +0200 Size: 3065 URL: From dianasco at astro.uni-bonn.de Tue May 12 04:53:01 2020 From: dianasco at astro.uni-bonn.de (Diana Scognamiglio) Date: Tue, 12 May 2020 10:53:01 +0200 Subject: [AstroPy] Info LevMarLSQFitter Message-ID: Dear Astropy Staff, I am Diana Scognamiglio and I have some problems to deep understand how LevMarLSQFitter works. I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter classe, coding these lines: ini_mod = EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0)fitter = fitting.LevMarLSQFitter()fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6, estimate_jacobian=False) I have figured out that if I change the initial parameters in ini_mod (i.e., ini_flux, ini_r_eff, etc), I counterintuitively obtain always a different result although the galaxy I am fitting is the same. How does the fit depend on those initial parameters? Please, can you help me with this issue? Thank you in advance. I wait for hearing from you. Best regards, Diana Scognamiglio -------------- next part -------------- An HTML attachment was scrubbed... URL: From jvmirca at gmail.com Tue May 12 05:17:59 2020 From: jvmirca at gmail.com (=?UTF-8?B?WsOpIFZpbsOtY2l1cw==?=) Date: Tue, 12 May 2020 17:17:59 +0800 Subject: [AstroPy] Info LevMarLSQFitter In-Reply-To: References: Message-ID: Hi Diana, >From my understanding, LevMarLSQFitter uses the least-squares function as the objective to be minimized using the Levenberg-Marquardt algorithm. Because Sersic2D is a non-linear model on the parameters to be fitted, the problem is most likely non-convex, which means that Levenberg-Marquardt only guarantees to find a local solution, which will depend on the initial value for those parameters. Best, Z? On Tue, May 12, 2020 at 4:53 PM Diana Scognamiglio < dianasco at astro.uni-bonn.de> wrote: > Dear Astropy Staff, > > I am Diana Scognamiglio and I have some problems to deep understand how > LevMarLSQFitter works. > > I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter classe, > coding these lines: > > > > > > ini_mod = > EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0) > > fitter = fitting.LevMarLSQFitter() > > fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6, > estimate_jacobian=False) > > > > I have figured out that if I change the initial parameters in ini_mod > (i.e., ini_flux, ini_r_eff, etc), I counterintuitively obtain always a > different result although the galaxy I am fitting is the same. How does the > fit depend on those initial parameters? > > Please, can you help me with this issue? > > Thank you in advance. > > I wait for hearing from you. > > Best regards, > > Diana Scognamiglio > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- Z? Vin?cius https://mirca.github.io -------------- next part -------------- An HTML attachment was scrubbed... URL: From pdzwig at summaventures.com Tue May 12 08:16:32 2020 From: pdzwig at summaventures.com (Peter Dzwig) Date: Tue, 12 May 2020 13:16:32 +0100 Subject: [AstroPy] Info LevMarLSQFitter In-Reply-To: References: Message-ID: <7dd9896c-ae85-036f-367f-3e6f55d07550@summaventures.com> Diana, How much are you varying the parameters in ini? Are you varying them by only a very small amount or by a substantial amount. I was going to suggest that you might be finding local minima in the solution when I read Z?'s comments. Do you consistently get the same results if you repeat the run with identical values? I am trying to understand whether your issue is: (a) the algorithm itself; (b) sensitivity to initial conditions; or (c) some issue with your code. Peter Dzwig On 12/05/2020 10:17, Z? Vin?cius wrote: > Hi Diana, > > From my understanding, LevMarLSQFitter uses the least-squares function > as the objective to be minimized using the Levenberg-Marquardt algorithm. > > Because?Sersic2D is a non-linear model on the parameters to be fitted, > the problem is most likely non-convex, which means that > Levenberg-Marquardt only guarantees to find a local solution, which will > depend on the initial value for those parameters. > > Best, > Z? > > On Tue, May 12, 2020 at 4:53 PM Diana Scognamiglio > > wrote: > > __ > > Dear Astropy Staff, > > I am Diana Scognamiglio and I have some problems to deep understand > how LevMarLSQFitter works. > > I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter > classe, coding these lines: > > ? > > ? > > ini_mod = > EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0) > > fitter = fitting.LevMarLSQFitter() > > fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6, > estimate_jacobian=False) > > ? > > I have figured out that if I change the initial parameters in > ini_mod (i.e., ini_flux, ini_r_eff, etc), I counterintuitively > obtain always a different result although the galaxy I am fitting is > the same. How does the fit depend on those initial parameters? > > Please, can you help me with this issue? > > Thank you in advance. > > I wait for hearing from you. > > Best regards, > > Diana Scognamiglio > > ? > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > > > > -- > Z? Vin?cius > https://mirca.github.io > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- Dr. Peter Dzwig From peter.erwin at gmail.com Tue May 12 08:36:11 2020 From: peter.erwin at gmail.com (Peter Erwin) Date: Tue, 12 May 2020 14:36:11 +0200 Subject: [AstroPy] Info LevMarLSQFitter In-Reply-To: References: Message-ID: Hi Z?, As an aside, the fact that the Sersic2D model is nonlinear in its parameters is formally irrelevant, since Levernberg-Marquardt is by design a *non-linear least-squares* algorithm. (Levenberg?s original 1944 paper describing the algorithm was titled "A Method for the Solution of Certain Non-Linear Problems in Least Squares?.) In practice, I find that Levenberg-Marquardt *usually* finds the global minimum in galaxy image-fitting problems (e.g., I get the same solution when running Imfit with Levenberg-Marquardt or with the Differential Evolution algorithm, which doesn?t use initial values), though there *are* cases where L-M does get trapped in local minima. (The fact that Diana says she ?always? gets a different result for different starting parameters maybe suggests something else is the problem.) Diana ? have you tried using an alternate fitting algorithm, such as the SimplexLSQFitter class? (Simplex fitters tend to be less likely to be trapped by local minima than Levenberg-Marquardt, though they?re usually significantly slower.) cheers, Peter [Erwin] > On May 12, 2020, at 11:17 AM, Z? Vin?cius wrote: > > Hi Diana, > > From my understanding, LevMarLSQFitter uses the least-squares function as the objective to be minimized using the Levenberg-Marquardt algorithm. > > Because Sersic2D is a non-linear model on the parameters to be fitted, the problem is most likely non-convex, which means that Levenberg-Marquardt only guarantees to find a local solution, which will depend on the initial value for those parameters. > > Best, > Z? > > On Tue, May 12, 2020 at 4:53 PM Diana Scognamiglio wrote: > Dear Astropy Staff, > > I am Diana Scognamiglio and I have some problems to deep understand how LevMarLSQFitter works. > > I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter classe, coding these lines: > > > > ini_mod = > EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0) > > fitter = fitting.LevMarLSQFitter() > > fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6, > estimate_jacobian=False) > > > I have figured out that if I change the initial parameters in ini_mod (i.e., ini_flux, ini_r_eff, etc), I counterintuitively obtain always a different result although the galaxy I am fitting is the same. How does the fit depend on those initial parameters? > > Please, can you help me with this issue? > > Thank you in advance. > > I wait for hearing from you. > > Best regards, > > Diana Scognamiglio > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > > > -- > Z? Vin?cius > https://mirca.github.io > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy ============================================================= Peter Erwin Max-Planck-Insitute for Extraterrestrial erwin at mpe.mpg.de Physics, Giessenbachstrasse tel. +49 (0)176 2481 7713 85748 Garching, Germany fax +49 (0)89 30000 3495 https://www.mpe.mpg.de/~erwin From pebarrett at gmail.com Wed May 13 10:41:22 2020 From: pebarrett at gmail.com (Paul Barrett) Date: Wed, 13 May 2020 10:41:22 -0400 Subject: [AstroPy] Info LevMarLSQFitter In-Reply-To: References: Message-ID: Personally, I would suggest ditching the Levenberg-Marquardt and Simplex algorithms and using an interior point method, which is more versatile and robust in finding the global minimum. Interior point methods more easily handle constraints and provide better convergence information. cvxopt is a nice Python package for second order problems, which appears to be your problem. However, if your problem is nonconvex, i.e., has local minima, then you might want to consider using a branch-and-bound algorithm, which will find the global minimum, although the algorithm is not as efficient. The algorithm also works with integer parameters, which are inherently nonconvex. Cheers, Paul On Tue, May 12, 2020 at 8:36 AM Peter Erwin wrote: > Hi Z?, > > As an aside, the fact that the Sersic2D model is nonlinear in its > parameters is formally > irrelevant, since Levernberg-Marquardt is by design a *non-linear > least-squares* algorithm. > (Levenberg?s original 1944 paper describing the algorithm was titled "A > Method for the Solution > of Certain Non-Linear Problems in Least Squares?.) > > In practice, I find that Levenberg-Marquardt *usually* finds the global > minimum > in galaxy image-fitting problems (e.g., I get the same solution when > running Imfit > with Levenberg-Marquardt or with the Differential Evolution algorithm, > which > doesn?t use initial values), though there *are* cases where L-M does get > trapped in > local minima. (The fact that Diana says she ?always? gets a different > result for > different starting parameters maybe suggests something else is the > problem.) > > > Diana ? have you tried using an alternate fitting algorithm, such as the > SimplexLSQFitter > class? (Simplex fitters tend to be less likely to be trapped by local > minima than > Levenberg-Marquardt, though they?re usually significantly slower.) > > > cheers, > > Peter [Erwin] > > > On May 12, 2020, at 11:17 AM, Z? Vin?cius wrote: > > > > Hi Diana, > > > > From my understanding, LevMarLSQFitter uses the least-squares function > as the objective to be minimized using the Levenberg-Marquardt algorithm. > > > > Because Sersic2D is a non-linear model on the parameters to be fitted, > the problem is most likely non-convex, which means that Levenberg-Marquardt > only guarantees to find a local solution, which will depend on the initial > value for those parameters. > > > > Best, > > Z? > > > > On Tue, May 12, 2020 at 4:53 PM Diana Scognamiglio < > dianasco at astro.uni-bonn.de> wrote: > > Dear Astropy Staff, > > > > I am Diana Scognamiglio and I have some problems to deep understand how > LevMarLSQFitter works. > > > > I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter > classe, coding these lines: > > > > > > > > ini_mod = > > EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, > x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0) > > > > fitter = fitting.LevMarLSQFitter() > > > > fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, > maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6, > > estimate_jacobian=False) > > > > > > I have figured out that if I change the initial parameters in ini_mod > (i.e., ini_flux, ini_r_eff, etc), I counterintuitively obtain always a > different result although the galaxy I am fitting is the same. How does the > fit depend on those initial parameters? > > > > Please, can you help me with this issue? > > > > Thank you in advance. > > > > I wait for hearing from you. > > > > Best regards, > > > > Diana Scognamiglio > > > > > > _______________________________________________ > > AstroPy mailing list > > AstroPy at python.org > > https://mail.python.org/mailman/listinfo/astropy > > > > > > -- > > Z? Vin?cius > > https://mirca.github.io > > _______________________________________________ > > AstroPy mailing list > > AstroPy at python.org > > https://mail.python.org/mailman/listinfo/astropy > > ============================================================= > Peter Erwin Max-Planck-Insitute for Extraterrestrial > erwin at mpe.mpg.de Physics, Giessenbachstrasse > tel. +49 (0)176 2481 7713 85748 Garching, Germany > fax +49 (0)89 30000 3495 https://www.mpe.mpg.de/~erwin > > > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jvmirca at gmail.com Wed May 13 12:59:09 2020 From: jvmirca at gmail.com (=?UTF-8?B?WsOpIFZpbsOtY2l1cw==?=) Date: Thu, 14 May 2020 00:59:09 +0800 Subject: [AstroPy] Info LevMarLSQFitter In-Reply-To: References: Message-ID: Hi Peter, As an aside, the fact that the Sersic2D model is nonlinear in its > parameters is formally > irrelevant, since Levernberg-Marquardt is by design a *non-linear > least-squares* algorithm. > (Levenberg?s original 1944 paper describing the algorithm was titled "A > Method for the Solution > of Certain Non-Linear Problems in Least Squares?.) The thing is that if the model were linear in its parameters, then the problem would be convex, and LM would find the global unique optimum no matter the initial point. But if that were the case, I'd advise other methods to get that solution. Best, Z? On Wed, May 13, 2020 at 10:42 PM Paul Barrett wrote: > Personally, I would suggest ditching the Levenberg-Marquardt and Simplex > algorithms and using an interior point method, which is more versatile and > robust in finding the global minimum. Interior point methods more easily > handle constraints and provide better convergence information. cvxopt is a > nice Python package for second order problems, which appears to be your > problem. However, if your problem is nonconvex, i.e., has local minima, > then you might want to consider using a branch-and-bound algorithm, which > will find the global minimum, although the algorithm is not as efficient. > The algorithm also works with integer parameters, which are inherently > nonconvex. > > Cheers, > Paul > > > > On Tue, May 12, 2020 at 8:36 AM Peter Erwin wrote: > >> Hi Z?, >> >> As an aside, the fact that the Sersic2D model is nonlinear in its >> parameters is formally >> irrelevant, since Levernberg-Marquardt is by design a *non-linear >> least-squares* algorithm. >> (Levenberg?s original 1944 paper describing the algorithm was titled "A >> Method for the Solution >> of Certain Non-Linear Problems in Least Squares?.) >> >> In practice, I find that Levenberg-Marquardt *usually* finds the global >> minimum >> in galaxy image-fitting problems (e.g., I get the same solution when >> running Imfit >> with Levenberg-Marquardt or with the Differential Evolution algorithm, >> which >> doesn?t use initial values), though there *are* cases where L-M does get >> trapped in >> local minima. (The fact that Diana says she ?always? gets a different >> result for >> different starting parameters maybe suggests something else is the >> problem.) >> >> >> Diana ? have you tried using an alternate fitting algorithm, such as the >> SimplexLSQFitter >> class? (Simplex fitters tend to be less likely to be trapped by local >> minima than >> Levenberg-Marquardt, though they?re usually significantly slower.) >> >> >> cheers, >> >> Peter [Erwin] >> >> > On May 12, 2020, at 11:17 AM, Z? Vin?cius wrote: >> > >> > Hi Diana, >> > >> > From my understanding, LevMarLSQFitter uses the least-squares function >> as the objective to be minimized using the Levenberg-Marquardt algorithm. >> > >> > Because Sersic2D is a non-linear model on the parameters to be fitted, >> the problem is most likely non-convex, which means that Levenberg-Marquardt >> only guarantees to find a local solution, which will depend on the initial >> value for those parameters. >> > >> > Best, >> > Z? >> > >> > On Tue, May 12, 2020 at 4:53 PM Diana Scognamiglio < >> dianasco at astro.uni-bonn.de> wrote: >> > Dear Astropy Staff, >> > >> > I am Diana Scognamiglio and I have some problems to deep understand how >> LevMarLSQFitter works. >> > >> > I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter >> classe, coding these lines: >> > >> > >> > >> > ini_mod = >> > EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, >> x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0) >> > >> > fitter = fitting.LevMarLSQFitter() >> > >> > fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, >> maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6, >> > estimate_jacobian=False) >> > >> > >> > I have figured out that if I change the initial parameters in ini_mod >> (i.e., ini_flux, ini_r_eff, etc), I counterintuitively obtain always a >> different result although the galaxy I am fitting is the same. How does the >> fit depend on those initial parameters? >> > >> > Please, can you help me with this issue? >> > >> > Thank you in advance. >> > >> > I wait for hearing from you. >> > >> > Best regards, >> > >> > Diana Scognamiglio >> > >> > >> > _______________________________________________ >> > AstroPy mailing list >> > AstroPy at python.org >> > https://mail.python.org/mailman/listinfo/astropy >> > >> > >> > -- >> > Z? Vin?cius >> > https://mirca.github.io >> > _______________________________________________ >> > AstroPy mailing list >> > AstroPy at python.org >> > https://mail.python.org/mailman/listinfo/astropy >> >> ============================================================= >> Peter Erwin Max-Planck-Insitute for Extraterrestrial >> erwin at mpe.mpg.de Physics, Giessenbachstrasse >> tel. +49 (0)176 2481 7713 85748 Garching, Germany >> fax +49 (0)89 30000 3495 https://www.mpe.mpg.de/~erwin >> >> >> >> >> _______________________________________________ >> 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 > -- Z? Vin?cius https://mirca.github.io -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter.erwin at gmail.com Wed May 13 16:10:31 2020 From: peter.erwin at gmail.com (Peter Erwin) Date: Wed, 13 May 2020 22:10:31 +0200 Subject: [AstroPy] Info LevMarLSQFitter In-Reply-To: References: Message-ID: Hi Z?, If the model is linear in its parameters, then it?s a linear least-squares problem and you can find the best estimator directly (e.g., via matrix inversion or orthogonal decomposition), without needing something like Levenberg-Marquardt. https://en.wikipedia.org/wiki/Linear_least_squares The fact that the galaxy-fitting problem *can* be (but is not guaranteed to be) non-convex does not mean gradient-descent methods like L-M are *useless*; it depends on what the actual fit-statistic (e.g., chi^2) landscape is like. The primary justification for something like L-M is that it is *fast*. My experience with fitting galaxy images is that it is about an order of magnitude faster than the simplex and about *two* orders of magnitude faster than Differential Evolution, which is considered relatively fast for a genetic-algorithms approach. If the L-M fit converges in less than a second, then you don?t lose much with a slower but more robust algorithm. But if the L-M fit takes an hour to converge, then waiting ten or a hundred hours for convergence with another algorithm may be a bit of a problem. (Or if you want to fit several tens of thousands of different images?) cheers, Peter > On May 13, 2020, at 6:59 PM, Z? Vin?cius wrote: > > Hi Peter, > > As an aside, the fact that the Sersic2D model is nonlinear in its parameters is formally > irrelevant, since Levernberg-Marquardt is by design a *non-linear least-squares* algorithm. > (Levenberg?s original 1944 paper describing the algorithm was titled "A Method for the Solution > of Certain Non-Linear Problems in Least Squares?.) > > The thing is that if the model were linear in its parameters, then the problem would be convex, and LM would find the global unique optimum > no matter the initial point. But if that were the case, I'd advise other methods to get that solution. > > Best, > Z? > > On Wed, May 13, 2020 at 10:42 PM Paul Barrett wrote: > Personally, I would suggest ditching the Levenberg-Marquardt and Simplex algorithms and using an interior point method, which is more versatile and robust in finding the global minimum. Interior point methods more easily handle constraints and provide better convergence information. cvxopt is a nice Python package for second order problems, which appears to be your problem. However, if your problem is nonconvex, i.e., has local minima, then you might want to consider using a branch-and-bound algorithm, which will find the global minimum, although the algorithm is not as efficient. The algorithm also works with integer parameters, which are inherently nonconvex. > > Cheers, > Paul > > > > On Tue, May 12, 2020 at 8:36 AM Peter Erwin wrote: > Hi Z?, > > As an aside, the fact that the Sersic2D model is nonlinear in its parameters is formally > irrelevant, since Levernberg-Marquardt is by design a *non-linear least-squares* algorithm. > (Levenberg?s original 1944 paper describing the algorithm was titled "A Method for the Solution > of Certain Non-Linear Problems in Least Squares?.) > > In practice, I find that Levenberg-Marquardt *usually* finds the global minimum > in galaxy image-fitting problems (e.g., I get the same solution when running Imfit > with Levenberg-Marquardt or with the Differential Evolution algorithm, which > doesn?t use initial values), though there *are* cases where L-M does get trapped in > local minima. (The fact that Diana says she ?always? gets a different result for > different starting parameters maybe suggests something else is the problem.) > > > Diana ? have you tried using an alternate fitting algorithm, such as the SimplexLSQFitter > class? (Simplex fitters tend to be less likely to be trapped by local minima than > Levenberg-Marquardt, though they?re usually significantly slower.) > > > cheers, > > Peter [Erwin] > > > On May 12, 2020, at 11:17 AM, Z? Vin?cius wrote: > > > > Hi Diana, > > > > From my understanding, LevMarLSQFitter uses the least-squares function as the objective to be minimized using the Levenberg-Marquardt algorithm. > > > > Because Sersic2D is a non-linear model on the parameters to be fitted, the problem is most likely non-convex, which means that Levenberg-Marquardt only guarantees to find a local solution, which will depend on the initial value for those parameters. > > > > Best, > > Z? > > > > On Tue, May 12, 2020 at 4:53 PM Diana Scognamiglio wrote: > > Dear Astropy Staff, > > > > I am Diana Scognamiglio and I have some problems to deep understand how LevMarLSQFitter works. > > > > I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter classe, coding these lines: > > > > > > > > ini_mod = > > EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0) > > > > fitter = fitting.LevMarLSQFitter() > > > > fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6, > > estimate_jacobian=False) > > > > > > I have figured out that if I change the initial parameters in ini_mod (i.e., ini_flux, ini_r_eff, etc), I counterintuitively obtain always a different result although the galaxy I am fitting is the same. How does the fit depend on those initial parameters? > > > > Please, can you help me with this issue? > > > > Thank you in advance. > > > > I wait for hearing from you. > > > > Best regards, > > > > Diana Scognamiglio > > > > > > _______________________________________________ > > AstroPy mailing list > > AstroPy at python.org > > https://mail.python.org/mailman/listinfo/astropy > > > > > > -- > > Z? Vin?cius > > https://mirca.github.io > > _______________________________________________ > > AstroPy mailing list > > AstroPy at python.org > > https://mail.python.org/mailman/listinfo/astropy > > ============================================================= > Peter Erwin Max-Planck-Insitute for Extraterrestrial > erwin at mpe.mpg.de Physics, Giessenbachstrasse > tel. +49 (0)176 2481 7713 85748 Garching, Germany > fax +49 (0)89 30000 3495 https://www.mpe.mpg.de/~erwin > > > > > _______________________________________________ > 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 > > > -- > Z? Vin?cius > https://mirca.github.io > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy ============================================================= Peter Erwin Max-Planck-Insitute for Extraterrestrial erwin at mpe.mpg.de Physics, Giessenbachstrasse tel. +49 (0)176 2481 7713 85748 Garching, Germany fax +49 (0)89 30000 3495 https://www.mpe.mpg.de/~erwin From jvmirca at gmail.com Wed May 13 23:06:27 2020 From: jvmirca at gmail.com (=?UTF-8?B?WsOpIFZpbsOtY2l1cw==?=) Date: Thu, 14 May 2020 11:06:27 +0800 Subject: [AstroPy] Info LevMarLSQFitter In-Reply-To: References: Message-ID: Hi Peter, If the model is linear in its parameters, then it?s a linear least-squares > problem and > you can find the best estimator directly (e.g., via matrix inversion or > orthogonal > decomposition), without needing something like Levenberg-Marquardt. > > https://en.wikipedia.org/wiki/Linear_least_squares > Exactly, for which LM will find the unique solution. The fact that the galaxy-fitting problem *can* be (but is not guaranteed to > be) > non-convex does not mean gradient-descent methods like L-M are *useless*; > it depends on what the actual fit-statistic (e.g., chi^2) landscape is > like. > I'd say it's better to consider optimization problems to be non-convex until proven otherwise. And from Diana's experiment of getting different solutions for different initial points, I'd consider that a good indicator of non-convexity. The primary justification for something like L-M is that it is *fast*. My > experience > with fitting galaxy images is that it is about an order of magnitude > faster than > the simplex and about *two* orders of magnitude faster than Differential > Evolution, which is considered relatively fast for a genetic-algorithms > approach. > If the L-M fit converges in less than a second, then you don?t lose much > with a > slower but more robust algorithm. But if the L-M fit takes an hour to > converge, > then waiting ten or a hundred hours for convergence with another algorithm > may be a bit of a problem. (Or if you want to fit several tens of > thousands of > different images?) > It seems to me that the key here is to have a reasonable initial guess for the parameters of the Sersic2D model. Diana: I have figured out that if I change the initial parameters in ini_mod > (i.e., ini_flux, ini_r_eff, etc), I counterintuitively obtain always a > different result although the galaxy I am fitting is the same. How does the > fit depend on those initial parameters? > Your problem is likely to be nonconvex, so it's not so counter-intuitive that you get different results for different initial points: it's just the nature of LM, it will converge to the nearest local minima. Best, Z? On Thu, May 14, 2020 at 4:11 AM Peter Erwin wrote: > Hi Z?, > > If the model is linear in its parameters, then it?s a linear least-squares > problem and > you can find the best estimator directly (e.g., via matrix inversion or > orthogonal > decomposition), without needing something like Levenberg-Marquardt. > > https://en.wikipedia.org/wiki/Linear_least_squares > > > The fact that the galaxy-fitting problem *can* be (but is not guaranteed > to be) > non-convex does not mean gradient-descent methods like L-M are *useless*; > it depends on what the actual fit-statistic (e.g., chi^2) landscape is > like. > > The primary justification for something like L-M is that it is *fast*. My > experience > with fitting galaxy images is that it is about an order of magnitude > faster than > the simplex and about *two* orders of magnitude faster than Differential > Evolution, which is considered relatively fast for a genetic-algorithms > approach. > If the L-M fit converges in less than a second, then you don?t lose much > with a > slower but more robust algorithm. But if the L-M fit takes an hour to > converge, > then waiting ten or a hundred hours for convergence with another algorithm > may be a bit of a problem. (Or if you want to fit several tens of > thousands of > different images?) > > > cheers, > > Peter > > > > On May 13, 2020, at 6:59 PM, Z? Vin?cius wrote: > > > > Hi Peter, > > > > As an aside, the fact that the Sersic2D model is nonlinear in its > parameters is formally > > irrelevant, since Levernberg-Marquardt is by design a *non-linear > least-squares* algorithm. > > (Levenberg?s original 1944 paper describing the algorithm was titled "A > Method for the Solution > > of Certain Non-Linear Problems in Least Squares?.) > > > > The thing is that if the model were linear in its parameters, then the > problem would be convex, and LM would find the global unique optimum > > no matter the initial point. But if that were the case, I'd advise other > methods to get that solution. > > > > Best, > > Z? > > > > On Wed, May 13, 2020 at 10:42 PM Paul Barrett > wrote: > > Personally, I would suggest ditching the Levenberg-Marquardt and Simplex > algorithms and using an interior point method, which is more versatile and > robust in finding the global minimum. Interior point methods more easily > handle constraints and provide better convergence information. cvxopt is a > nice Python package for second order problems, which appears to be your > problem. However, if your problem is nonconvex, i.e., has local minima, > then you might want to consider using a branch-and-bound algorithm, which > will find the global minimum, although the algorithm is not as efficient. > The algorithm also works with integer parameters, which are inherently > nonconvex. > > > > Cheers, > > Paul > > > > > > > > On Tue, May 12, 2020 at 8:36 AM Peter Erwin > wrote: > > Hi Z?, > > > > As an aside, the fact that the Sersic2D model is nonlinear in its > parameters is formally > > irrelevant, since Levernberg-Marquardt is by design a *non-linear > least-squares* algorithm. > > (Levenberg?s original 1944 paper describing the algorithm was titled "A > Method for the Solution > > of Certain Non-Linear Problems in Least Squares?.) > > > > In practice, I find that Levenberg-Marquardt *usually* finds the global > minimum > > in galaxy image-fitting problems (e.g., I get the same solution when > running Imfit > > with Levenberg-Marquardt or with the Differential Evolution algorithm, > which > > doesn?t use initial values), though there *are* cases where L-M does get > trapped in > > local minima. (The fact that Diana says she ?always? gets a different > result for > > different starting parameters maybe suggests something else is the > problem.) > > > > > > Diana ? have you tried using an alternate fitting algorithm, such as the > SimplexLSQFitter > > class? (Simplex fitters tend to be less likely to be trapped by local > minima than > > Levenberg-Marquardt, though they?re usually significantly slower.) > > > > > > cheers, > > > > Peter [Erwin] > > > > > On May 12, 2020, at 11:17 AM, Z? Vin?cius wrote: > > > > > > Hi Diana, > > > > > > From my understanding, LevMarLSQFitter uses the least-squares function > as the objective to be minimized using the Levenberg-Marquardt algorithm. > > > > > > Because Sersic2D is a non-linear model on the parameters to be fitted, > the problem is most likely non-convex, which means that Levenberg-Marquardt > only guarantees to find a local solution, which will depend on the initial > value for those parameters. > > > > > > Best, > > > Z? > > > > > > On Tue, May 12, 2020 at 4:53 PM Diana Scognamiglio < > dianasco at astro.uni-bonn.de> wrote: > > > Dear Astropy Staff, > > > > > > I am Diana Scognamiglio and I have some problems to deep understand > how LevMarLSQFitter works. > > > > > > I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter > classe, coding these lines: > > > > > > > > > > > > ini_mod = > > > EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, > x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0) > > > > > > fitter = fitting.LevMarLSQFitter() > > > > > > fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, > maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6, > > > estimate_jacobian=False) > > > > > > > > > I have figured out that if I change the initial parameters in ini_mod > (i.e., ini_flux, ini_r_eff, etc), I counterintuitively obtain always a > different result although the galaxy I am fitting is the same. How does the > fit depend on those initial parameters? > > > > > > Please, can you help me with this issue? > > > > > > Thank you in advance. > > > > > > I wait for hearing from you. > > > > > > Best regards, > > > > > > Diana Scognamiglio > > > > > > > > > _______________________________________________ > > > AstroPy mailing list > > > AstroPy at python.org > > > https://mail.python.org/mailman/listinfo/astropy > > > > > > > > > -- > > > Z? Vin?cius > > > https://mirca.github.io > > > _______________________________________________ > > > AstroPy mailing list > > > AstroPy at python.org > > > https://mail.python.org/mailman/listinfo/astropy > > > > ============================================================= > > Peter Erwin Max-Planck-Insitute for Extraterrestrial > > erwin at mpe.mpg.de Physics, Giessenbachstrasse > > tel. +49 (0)176 2481 7713 85748 Garching, Germany > > fax +49 (0)89 30000 3495 https://www.mpe.mpg.de/~erwin > > > > > > > > > > _______________________________________________ > > 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 > > > > > > -- > > Z? Vin?cius > > https://mirca.github.io > > _______________________________________________ > > AstroPy mailing list > > AstroPy at python.org > > https://mail.python.org/mailman/listinfo/astropy > > ============================================================= > Peter Erwin Max-Planck-Insitute for Extraterrestrial > erwin at mpe.mpg.de Physics, Giessenbachstrasse > tel. +49 (0)176 2481 7713 85748 Garching, Germany > fax +49 (0)89 30000 3495 https://www.mpe.mpg.de/~erwin > > > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- Z? Vin?cius https://mirca.github.io -------------- next part -------------- An HTML attachment was scrubbed... URL: From dianasco at astro.uni-bonn.de Thu May 14 10:00:32 2020 From: dianasco at astro.uni-bonn.de (Diana Scognamiglio) Date: Thu, 14 May 2020 16:00:32 +0200 Subject: [AstroPy] Info LevMarLSQFitter In-Reply-To: References: Message-ID: Dear Z?, Peter, Peter and Paul, thanks for your reply. I didn't find yet the solution to my problem. The problems could be due to the fact that the fit just converges in a local minimum and not in the global one or to the fact the the fit is not well constrained...in any case it sometimes completely fails giving for example flux=0! I should use some particular constraints for the fitting I guess...and probably it will be the best solution. About the Peter (Dwing)?s questions: I chose these ranges for the initial parameters: n_Sersic=[1.0,2.0,3.0,4.0,5.0,6.0] and R_eff=[1.0,5.0, 10.0, 30.0, 50.0,100.0], and ini_flux=[100, 1000]. If I repeat the run (using the same initial parameters), yes I get the same results. I also used the SimplexLSQFitter, but the things doesn?t change. Thanks again. Cheers, Diana On Tue, 12 May 2020 14:36:11 +0200 Peter Erwin wrote: > Hi Z?, > > As an aside, the fact that the Sersic2D model is nonlinear in its parameters is formally > irrelevant, since Levernberg-Marquardt is by design a *non-linear least-squares* algorithm. > (Levenberg?s original 1944 paper describing the algorithm was titled "A Method for the Solution of Certain Non-Linear Problems in Least Squares?.) > > In practice, I find that Levenberg-Marquardt *usually* finds the global minimum > in galaxy image-fitting problems (e.g., I get the same solution when running Imfit > with Levenberg-Marquardt or with the Differential Evolution algorithm, which > doesn?t use initial values), though there *are* cases where L-M does get trapped in > local minima. (The fact that Diana says she ?always? gets a different result for different starting parameters maybe suggests something else is the problem.) > > > Diana ? have you tried using an alternate fitting algorithm, such as the SimplexLSQFitter > class? (Simplex fitters tend to be less likely to be trapped by local minima than > Levenberg-Marquardt, though they?re usually significantly slower.) > > > cheers, > > Peter [Erwin] > >> On May 12, 2020, at 11:17 AM, Z? Vin?cius wrote: >> >> Hi Diana, >> >> From my understanding, LevMarLSQFitter uses the least-squares function as the objective to be minimized using the Levenberg-Marquardt algorithm. >> >> Because Sersic2D is a non-linear model on the parameters to be fitted, the problem is most likely non-convex, which means that Levenberg-Marquardt only guarantees to find a local solution, which will depend on the initial value for those parameters. >> >> Best, >> Z? >> >> On Tue, May 12, 2020 at 4:53 PM Diana Scognamiglio wrote: >> Dear Astropy Staff, >> >> I am Diana Scognamiglio and I have some problems to deep understand how LevMarLSQFitter works. >> >> I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter classe, coding these lines: >> >> >> ini_mod = >> EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0) >> >> fitter = fitting.LevMarLSQFitter() >> >> fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6, >> estimate_jacobian=False) I have figured out that if I change the initial parameters in ini_mod (i.e., ini_flux, ini_r_eff, etc), I counterintuitively obtain always a different result although the galaxy I am fitting is the same. How does the fit depend on those initial parameters? >> >> Please, can you help me with this issue? >> >> Thank you in advance. >> >> I wait for hearing from you. >> >> Best regards, >> >> Diana Scognamiglio >> >> >> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy >> >> >> -- >> Z? Vin?cius >> https://mirca.github.io >> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy > > ============================================================= > Peter Erwin Max-Planck-Insitute for Extraterrestrial erwin at mpe.mpg.de Physics, Giessenbachstrasse > tel. +49 (0)176 2481 7713 85748 Garching, Germany > fax +49 (0)89 30000 3495 https://www.mpe.mpg.de/~erwin > > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy From jvmirca at gmail.com Thu May 14 10:09:54 2020 From: jvmirca at gmail.com (=?UTF-8?B?WsOpIFZpbsOtY2l1cw==?=) Date: Thu, 14 May 2020 22:09:54 +0800 Subject: [AstroPy] Info LevMarLSQFitter In-Reply-To: References: Message-ID: Dear Diana, I should use some particular constraints for the fitting I guess...and > probably it will be the best solution. > Absolutely! I would definitely take advantage of imposing the constraints on the parameters in whatever fitting algorithm I would use. That's possibly the only way to make sure that you don't get physically unreasonable results. Best, Z? On Thu, May 14, 2020 at 10:00 PM Diana Scognamiglio < dianasco at astro.uni-bonn.de> wrote: > Dear Z?, Peter, Peter and Paul, > thanks for your reply. > I didn't find yet the solution to my problem. > The problems could be due to the fact that the fit just converges in a > local > minimum and not in the global one or to the fact the the fit is not well > constrained...in any case it sometimes completely fails giving for example > flux=0! > I should use some particular constraints for the fitting I guess...and > probably it will be the best solution. > > About the Peter (Dwing)?s questions: I chose these ranges for the initial > parameters: n_Sersic=[1.0,2.0,3.0,4.0,5.0,6.0] and R_eff=[1.0,5.0, 10.0, > 30.0, 50.0,100.0], and ini_flux=[100, 1000]. > If I repeat the run (using the same initial parameters), yes I get the > same > results. > > I also used the SimplexLSQFitter, but the things doesn?t change. > > Thanks again. > Cheers, > Diana > > On Tue, 12 May 2020 14:36:11 +0200 > Peter Erwin wrote: > > Hi Z?, > > > > As an aside, the fact that the Sersic2D model is nonlinear in its > parameters is formally > > irrelevant, since Levernberg-Marquardt is by design a *non-linear > least-squares* algorithm. > > (Levenberg?s original 1944 paper describing the algorithm was titled "A > Method for the Solution of Certain Non-Linear Problems in Least Squares?.) > > > > In practice, I find that Levenberg-Marquardt *usually* finds the global > minimum > > in galaxy image-fitting problems (e.g., I get the same solution when > running Imfit > > with Levenberg-Marquardt or with the Differential Evolution algorithm, > which > > doesn?t use initial values), though there *are* cases where L-M does get > trapped in > > local minima. (The fact that Diana says she ?always? gets a different > result for different starting parameters maybe suggests something else is > the problem.) > > > > > > Diana ? have you tried using an alternate fitting algorithm, such as the > SimplexLSQFitter > > class? (Simplex fitters tend to be less likely to be trapped by local > minima than > > Levenberg-Marquardt, though they?re usually significantly slower.) > > > > > > cheers, > > > > Peter [Erwin] > > > >> On May 12, 2020, at 11:17 AM, Z? Vin?cius wrote: > >> > >> Hi Diana, > >> > >> From my understanding, LevMarLSQFitter uses the least-squares function > as the objective to be minimized using the Levenberg-Marquardt algorithm. > >> > >> Because Sersic2D is a non-linear model on the parameters to be fitted, > the problem is most likely non-convex, which means that Levenberg-Marquardt > only guarantees to find a local solution, which will depend on the initial > value for those parameters. > >> > >> Best, > >> Z? > >> > >> On Tue, May 12, 2020 at 4:53 PM Diana Scognamiglio < > dianasco at astro.uni-bonn.de> wrote: > >> Dear Astropy Staff, > >> > >> I am Diana Scognamiglio and I have some problems to deep understand how > LevMarLSQFitter works. > >> > >> I am trying to fit a mock Sersic galaxy using the LevMarLSQFitter > classe, coding these lines: > >> > >> > >> ini_mod = > >> EllipSersic2D(flux=ini_flux, r_eff=ini_r_eff, n=ini_n, > x_0=stampsize/2.0, y_0=stampsize/2.0, g1=0.0, g2=0.0) > >> > >> fitter = fitting.LevMarLSQFitter() > >> > >> fit_mod = fitter(ini_mod, x_array, y_array, stamp, weights=weights, > maxiter = 1000, acc=1.0e-7, epsilon=1.0e-6, > >> estimate_jacobian=False) I have figured out that if I change the > initial parameters in ini_mod (i.e., ini_flux, ini_r_eff, etc), I > counterintuitively obtain always a different result although the galaxy I > am fitting is the same. How does the fit depend on those initial parameters? > >> > >> Please, can you help me with this issue? > >> > >> Thank you in advance. > >> > >> I wait for hearing from you. > >> > >> Best regards, > >> > >> Diana Scognamiglio > >> > >> > >> _______________________________________________ > >> AstroPy mailing list > >> AstroPy at python.org > >> https://mail.python.org/mailman/listinfo/astropy > >> > >> > >> -- > >> Z? Vin?cius > >> https://mirca.github.io > >> _______________________________________________ > >> AstroPy mailing list > >> AstroPy at python.org > >> https://mail.python.org/mailman/listinfo/astropy > > > > ============================================================= > > Peter Erwin Max-Planck-Insitute for Extraterrestrial > erwin at mpe.mpg.de Physics, Giessenbachstrasse > > tel. +49 (0)176 2481 7713 85748 Garching, Germany > > fax +49 (0)89 30000 3495 https://www.mpe.mpg.de/~erwin > > > > > > _______________________________________________ > > AstroPy mailing list > > AstroPy at python.org > > https://mail.python.org/mailman/listinfo/astropy > > > > > > > > > > -- Z? Vin?cius https://mirca.github.io -------------- next part -------------- An HTML attachment was scrubbed... URL: From cbrasseur at stsci.edu Thu May 21 12:24:36 2020 From: cbrasseur at stsci.edu (Clara Brasseur) Date: Thu, 21 May 2020 16:24:36 +0000 Subject: [AstroPy] Kudos for Thomas Robitaille (astrofrog) Message-ID: <9863B97F-4B30-46FF-98A8-015DA26B46A1@stsci.edu> Shout out to Thomas Robitaille (astrofrog) for adding the fallback and warning when a memory error is encountered opening a memmap fits file in readonly mode. In addition to the fallback keeping my code from crashing, the informative warning allowed me to understand why I was encountering memory errors in the first place and to adjust my memmap mode accordingly. -Clara -- Software Engineer, Archive Sciences Branch Space Telescope Science Institute 3700 San Martin Dr, Baltimore, MD 21218 cbrasseur at stsci.edu 410-338-6769 -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas.robitaille at gmail.com Mon May 25 14:59:47 2020 From: thomas.robitaille at gmail.com (Thomas Robitaille) Date: Mon, 25 May 2020 19:59:47 +0100 Subject: [AstroPy] astropy v4.1rc1 release candidate Message-ID: Hi everyone, The first astropy v4.1 release candidate (RC) is now available and ready for testing! https://pypi.python.org/pypi/astropy/4.1rc1 You should be able to install the RC by doing: pip install astropy --pre or pip install astropy==4.1rc1 You can find the documentation corresponding to this release at: https://docs.astropy.org/en/v4.1rc1/ including the 'What's new in v4.1?' page. We would appreciate if you could try out this RC and report back any success or failure via the following wiki page: https://github.com/astropy/astropy/wiki/astropy-v4.1-release-candidate-(RC)-Testing For example, you can try running the test suite as mentioned on the wiki page. In addition, if you maintain any packages that use astropy, please check that your package(s) works well with this RC and let us know if there are any issues or whether everything works fine. There is a section to list packages that work/don't work at the bottom of the wiki page. Please also open an issue in the astropy core package issue tracker for any issues you encounter (and open separate issues for separate problems you run into). If you use conda, be sure to either remove the existing conda astropy package or make a new environment before installing the RC. Note that there are no conda packages for the RC. Thanks! Tom From afonsoangelarodrigues at gmail.com Thu May 28 03:43:46 2020 From: afonsoangelarodrigues at gmail.com (Angela Rodrigues) Date: Thu, 28 May 2020 17:43:46 +1000 Subject: [AstroPy] Fwd: Help with finding absorption lines In-Reply-To: References: Message-ID: Hello, I have been trying to use astropy to extract lines of absorption from a mineral spectrum. so I have the attached hdr file with the spectral analysis from a mineral. The code to extract the data from the file is as follows: import spectral.io.envi as envi lib = envi.open('GFZ_HySpex_REMin.hdr') a=lib.metadata wvl = a.get('wavelength') wvl = [int(float(i)) for i in wvl] import matplotlib.pyplot as plt plt.plot(wvl,spectra[13]) #grab spectra for parisite names = lib.names spectra_parisite = spectra[8] plt.plot(wvl, spectra_parisite) I wanted to extract the absorption lines as in the documentation example here . Here's what I've done: w = np.array(wvl) import astropy.units as u w = w*u.nm spectra_parisite = spectra_parisite*u.Jy from specutils import Spectrum1D, SpectralRegion spectrum = Spectrum1D(spectral_axis = w, flux = spectra_parisite) from matplotlib import pyplot as plt plt.plot(spectrum.spectral_axis, spectrum.flux) plt.xlabel('Spectral Axis ({})'.format(spectrum.spectral_axis.unit)) plt.ylabel('Flux Axis({})'.format(spectrum.flux.unit)) plt.grid(True) from specutils.manipulation import noise_region_uncertainty noise_region = SpectralRegion(450*u.nm, 2500*u.nm) spectrum2 = noise_region_uncertainty(spectrum, noise_region) from specutils.fitting import find_lines_threshold lines = find_lines_threshold(spectrum2, noise_factor=0) lines[lines['line_type'] == 'absorption'] lines[lines['line_type'] == 'emission'] # Derivative technique from specutils.fitting import find_lines_derivative lines = find_lines_derivative(spectrum2, flux_threshold=0) lines[lines['line_type'] == 'absorption'] However, I get no absorption feature lines. Am I doing something wrong? The emission zones seem to be alright, but I really need the absorption loci. Thank you so much for your help!! Warm regards, Angela Rodrigues -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: GFZ_HySpex_REMin Type: application/octet-stream Size: 45696 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: GFZ_HySpex_REMin.hdr Type: application/octet-stream Size: 6193 bytes Desc: not available URL: From pdzwig at summaventures.com Thu May 28 05:15:19 2020 From: pdzwig at summaventures.com (Peter Dzwig) Date: Thu, 28 May 2020 10:15:19 +0100 Subject: [AstroPy] Fwd: Help with finding absorption lines In-Reply-To: References: Message-ID: <0a1ff555-121e-ee1d-a9c0-49aca9d51e01@summaventures.com> Angela, first thing to be said is that I sympathize. :-) I have had similar issues although my datasets are very different (QSOs); the second is that I can't open either of your files. Perhaps you tell us what format they are in. I tried running similar code to yours (despite the different context). I found that the answers, from both thresholding and derivative, I got were quite sensitive to the data density per unit wavelength, the amount of noise in the data and the threshold that you set. Unless the data is sufficiently dense both thresholding and derivative will produce inaccurate or even false results. In the end I found the best solution was to make a table of all the lines that I was interested in and simply overplot them on my spectrum. I can then see what's where and (using a combination of astropy and numpy) re-plot and re-examine pertinent parts of the spectrum, but as ever the limiting factor is data density. I guess in your case the lines that you would plot would be Calcium, Cerium, Lanthanum, Carbon, Flourine - and Neodymium? and some of their molecular forms. Tables for most are available from NIST: https://www.nist.gov/pml/atomic-spectra-database There probably is a best approach - a tutorial would be a good idea - and I will watch this space to see what solutions others offer. Regards, Peter Dzwig On 28/05/2020 08:43, Angela Rodrigues wrote: > Hello, > > I have been trying to use astropy to extract lines of absorption from a > mineral spectrum. > so I have the attached hdr file with the spectral analysis from a mineral. > The code to extract the data from the file is as follows: > > import spectral.io.envi as envi > lib = envi.open('GFZ_HySpex_REMin.hdr') > > a=lib.metadata > wvl = a.get('wavelength') > wvl = [int(float(i)) for i in wvl] > > import matplotlib.pyplot as plt > plt.plot(wvl,spectra[13]) > > #grab spectra for parisite > names = lib.names > > spectra_parisite = spectra[8] > plt.plot(wvl, spectra_parisite) > > > I wanted to extract the absorption lines as in the documentation example > here . > Here's what I've done: > > > w = np.array(wvl) > > import astropy.units as u > w = w*u.nm > spectra_parisite = spectra_parisite*u.Jy > from specutils import Spectrum1D, SpectralRegion > spectrum = Spectrum1D(spectral_axis = w, flux = spectra_parisite) > > from matplotlib import pyplot as plt > plt.plot(spectrum.spectral_axis, spectrum.flux) > plt.xlabel('Spectral Axis ({})'.format(spectrum.spectral_axis.unit)) > plt.ylabel('Flux Axis({})'.format(spectrum.flux.unit)) > plt.grid(True) > > from specutils.manipulation import noise_region_uncertainty > noise_region = SpectralRegion(450*u.nm, 2500*u.nm) > spectrum2 = noise_region_uncertainty(spectrum, noise_region) > > from specutils.fitting import find_lines_threshold > lines = find_lines_threshold(spectrum2, noise_factor=0) > lines[lines['line_type'] == 'absorption'] > lines[lines['line_type'] == 'emission'] > > # Derivative technique > from specutils.fitting import find_lines_derivative > lines = find_lines_derivative(spectrum2, flux_threshold=0) > lines[lines['line_type'] == 'absorption']? > > > However, I get no absorption feature lines. Am I doing something wrong? > The emission zones seem to be alright, but I really need the absorption > loci. > Thank you so much for your help!! > Warm regards, > Angela Rodrigues > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- Dr. Peter Dzwig From afonsoangelarodrigues at gmail.com Thu May 28 05:55:04 2020 From: afonsoangelarodrigues at gmail.com (Angela Rodrigues) Date: Thu, 28 May 2020 19:55:04 +1000 Subject: [AstroPy] Fwd: Help with finding absorption lines In-Reply-To: <0a1ff555-121e-ee1d-a9c0-49aca9d51e01@summaventures.com> References: <0a1ff555-121e-ee1d-a9c0-49aca9d51e01@summaventures.com> Message-ID: Hi Dr. Peter Thank you kindly for your reply. Here's a folder with the file (it's an hdr file): https://drive.google.com/file/d/1Rb25_mzAKq7ZqFI9fPyOX8TnTtspYxpF/view?usp=sharing I am looking for really small shifts that reflect chemistry, and therefore, I cannot just eyeball it, I need the actual values. Indeed it is a complicated task to do without specialized software. Regarding the threshold, I've changed it multiple times between 0 and 20, and still no absorption values... Thank you so much for looking into it! :) Peter Dzwig escreveu no dia quinta, 28/05/2020 ?(s) 19:15: > Angela, > > first thing to be said is that I sympathize. :-) I have had similar > issues although my datasets are very different (QSOs); the second is > that I can't open either of your files. Perhaps you tell us what format > they are in. > > I tried running similar code to yours (despite the different context). I > found that the answers, from both thresholding and derivative, I got > were quite sensitive to the data density per unit wavelength, the amount > of noise in the data and the threshold that you set. > > Unless the data is sufficiently dense both thresholding and derivative > will produce inaccurate or even false results. > > In the end I found the best solution was to make a table of all the > lines that I was interested in and simply overplot them on my spectrum. > I can then see what's where and (using a combination of astropy and > numpy) re-plot and re-examine pertinent parts of the spectrum, but as > ever the limiting factor is data density. > > I guess in your case the lines that you would plot would be Calcium, > Cerium, Lanthanum, Carbon, Flourine - and Neodymium? and some of their > molecular forms. Tables for most are available from NIST: > https://www.nist.gov/pml/atomic-spectra-database > > There probably is a best approach - a tutorial would be a good idea - > and I will watch this space to see what solutions others offer. > > Regards, > > Peter Dzwig > > On 28/05/2020 08:43, Angela Rodrigues wrote: > > Hello, > > > > I have been trying to use astropy to extract lines of absorption from a > > mineral spectrum. > > so I have the attached hdr file with the spectral analysis from a > mineral. > > The code to extract the data from the file is as follows: > > > > import spectral.io.envi as envi > > lib = envi.open('GFZ_HySpex_REMin.hdr') > > > > a=lib.metadata > > wvl = a.get('wavelength') > > wvl = [int(float(i)) for i in wvl] > > > > import matplotlib.pyplot as plt > > plt.plot(wvl,spectra[13]) > > > > #grab spectra for parisite > > names = lib.names > > > > spectra_parisite = spectra[8] > > plt.plot(wvl, spectra_parisite) > > > > > > I wanted to extract the absorption lines as in the documentation example > > here . > > Here's what I've done: > > > > > > w = np.array(wvl) > > > > import astropy.units as u > > w = w*u.nm > > spectra_parisite = spectra_parisite*u.Jy > > from specutils import Spectrum1D, SpectralRegion > > spectrum = Spectrum1D(spectral_axis = w, flux = spectra_parisite) > > > > from matplotlib import pyplot as plt > > plt.plot(spectrum.spectral_axis, spectrum.flux) > > plt.xlabel('Spectral Axis ({})'.format(spectrum.spectral_axis.unit)) > > plt.ylabel('Flux Axis({})'.format(spectrum.flux.unit)) > > plt.grid(True) > > > > from specutils.manipulation import noise_region_uncertainty > > noise_region = SpectralRegion(450*u.nm, 2500*u.nm) > > spectrum2 = noise_region_uncertainty(spectrum, noise_region) > > > > from specutils.fitting import find_lines_threshold > > lines = find_lines_threshold(spectrum2, noise_factor=0) > > lines[lines['line_type'] == 'absorption'] > > lines[lines['line_type'] == 'emission'] > > > > # Derivative technique > > from specutils.fitting import find_lines_derivative > > lines = find_lines_derivative(spectrum2, flux_threshold=0) > > lines[lines['line_type'] == 'absorption'] > > > > > > However, I get no absorption feature lines. Am I doing something wrong? > > The emission zones seem to be alright, but I really need the absorption > > loci. > > Thank you so much for your help!! > > Warm regards, > > Angela Rodrigues > > > > _______________________________________________ > > AstroPy mailing list > > AstroPy at python.org > > https://mail.python.org/mailman/listinfo/astropy > > > > -- > > Dr. Peter Dzwig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From xavier at ucolick.org Thu May 28 08:22:10 2020 From: xavier at ucolick.org (J. Xavier Prochaska) Date: Thu, 28 May 2020 05:22:10 -0700 Subject: [AstroPy] Fwd: Help with finding absorption lines In-Reply-To: References: <0a1ff555-121e-ee1d-a9c0-49aca9d51e01@summaventures.com> Message-ID: Consider linetools -- https://github.com/linetools/linetools and ALIS -- https://github.com/rcooke-ast/ALIS Built by scientists who study absorption lines for a living.. X On Thu, May 28, 2020 at 2:55 AM Angela Rodrigues < afonsoangelarodrigues at gmail.com> wrote: > Hi Dr. Peter > > Thank you kindly for your reply. > > Here's a folder with the file (it's an hdr file): > > https://drive.google.com/file/d/1Rb25_mzAKq7ZqFI9fPyOX8TnTtspYxpF/view?usp=sharing > > I am looking for really small shifts that reflect chemistry, and > therefore, I cannot just eyeball it, I need the actual values. > Indeed it is a complicated task to do without specialized software. > Regarding the threshold, I've changed it multiple times between 0 and 20, > and still no absorption values... > > Thank you so much for looking into it! :) > > > Peter Dzwig escreveu no dia quinta, 28/05/2020 > ?(s) 19:15: > >> Angela, >> >> first thing to be said is that I sympathize. :-) I have had similar >> issues although my datasets are very different (QSOs); the second is >> that I can't open either of your files. Perhaps you tell us what format >> they are in. >> >> I tried running similar code to yours (despite the different context). I >> found that the answers, from both thresholding and derivative, I got >> were quite sensitive to the data density per unit wavelength, the amount >> of noise in the data and the threshold that you set. >> >> Unless the data is sufficiently dense both thresholding and derivative >> will produce inaccurate or even false results. >> >> In the end I found the best solution was to make a table of all the >> lines that I was interested in and simply overplot them on my spectrum. >> I can then see what's where and (using a combination of astropy and >> numpy) re-plot and re-examine pertinent parts of the spectrum, but as >> ever the limiting factor is data density. >> >> I guess in your case the lines that you would plot would be Calcium, >> Cerium, Lanthanum, Carbon, Flourine - and Neodymium? and some of their >> molecular forms. Tables for most are available from NIST: >> https://www.nist.gov/pml/atomic-spectra-database >> >> There probably is a best approach - a tutorial would be a good idea - >> and I will watch this space to see what solutions others offer. >> >> Regards, >> >> Peter Dzwig >> >> On 28/05/2020 08:43, Angela Rodrigues wrote: >> > Hello, >> > >> > I have been trying to use astropy to extract lines of absorption from a >> > mineral spectrum. >> > so I have the attached hdr file with the spectral analysis from a >> mineral. >> > The code to extract the data from the file is as follows: >> > >> > import spectral.io.envi as envi >> > lib = envi.open('GFZ_HySpex_REMin.hdr') >> > >> > a=lib.metadata >> > wvl = a.get('wavelength') >> > wvl = [int(float(i)) for i in wvl] >> > >> > import matplotlib.pyplot as plt >> > plt.plot(wvl,spectra[13]) >> > >> > #grab spectra for parisite >> > names = lib.names >> > >> > spectra_parisite = spectra[8] >> > plt.plot(wvl, spectra_parisite) >> > >> > >> > I wanted to extract the absorption lines as in the documentation example >> > here . >> > Here's what I've done: >> > >> > >> > w = np.array(wvl) >> > >> > import astropy.units as u >> > w = w*u.nm >> > spectra_parisite = spectra_parisite*u.Jy >> > from specutils import Spectrum1D, SpectralRegion >> > spectrum = Spectrum1D(spectral_axis = w, flux = spectra_parisite) >> > >> > from matplotlib import pyplot as plt >> > plt.plot(spectrum.spectral_axis, spectrum.flux) >> > plt.xlabel('Spectral Axis ({})'.format(spectrum.spectral_axis.unit)) >> > plt.ylabel('Flux Axis({})'.format(spectrum.flux.unit)) >> > plt.grid(True) >> > >> > from specutils.manipulation import noise_region_uncertainty >> > noise_region = SpectralRegion(450*u.nm, 2500*u.nm) >> > spectrum2 = noise_region_uncertainty(spectrum, noise_region) >> > >> > from specutils.fitting import find_lines_threshold >> > lines = find_lines_threshold(spectrum2, noise_factor=0) >> > lines[lines['line_type'] == 'absorption'] >> > lines[lines['line_type'] == 'emission'] >> > >> > # Derivative technique >> > from specutils.fitting import find_lines_derivative >> > lines = find_lines_derivative(spectrum2, flux_threshold=0) >> > lines[lines['line_type'] == 'absorption'] >> > >> > >> > However, I get no absorption feature lines. Am I doing something wrong? >> > The emission zones seem to be alright, but I really need the absorption >> > loci. >> > Thank you so much for your help!! >> > Warm regards, >> > Angela Rodrigues >> > >> > _______________________________________________ >> > AstroPy mailing list >> > AstroPy at python.org >> > https://mail.python.org/mailman/listinfo/astropy >> > >> >> -- >> >> Dr. Peter Dzwig >> > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- -- ---------------------------------------------- J. Xavier Prochaska UCO/Lick Observatory 1156 High St. UC Santa Cruz Santa Cruz, CA 95064 Affiliate of IPMU Affiliate of LBNL http://www.ucolick.org/~xavier/ https://aaii.ucsc.edu/ http://www.ucolick.org/f-4 831-459-2135 (Direct) 831-459-2991 (UCO/Lick Main) 831-459-5244 (Fax) -------------- next part -------------- An HTML attachment was scrubbed... URL: From pdzwig at summaventures.com Thu May 28 09:53:19 2020 From: pdzwig at summaventures.com (Peter Dzwig) Date: Thu, 28 May 2020 14:53:19 +0100 Subject: [AstroPy] Fwd: Help with finding absorption lines In-Reply-To: References: <0a1ff555-121e-ee1d-a9c0-49aca9d51e01@summaventures.com> Message-ID: Angela, I will think about this some more - and hopefully some more astropy users will join in. Going to your point about really small shifts: You don't specify what you mean by that, but what I did was to provide myself with a tool that enabled me to plot a small section of the data I had and then overplot with lines within that. But, again, data density is everything. To look for the lines you might find NIST the best source, in the end I used a combination of (fairly) standard data, together with transitions calculated from quantum mechanics, so that I had tables which included not only the main lines, but also forbidden and semi-forbidden transitions. At that point I wasn't interested in molecular orbitals and so on, but I guess that in prionciple you could extend it to that. I will, as I say continue to look at it, but I hope others will contribute. Peter On 28/05/2020 10:55, Angela Rodrigues wrote: > Hi Dr. Peter > > Thank you kindly for your reply. > > Here's a folder with the file (it's an hdr file): > https://drive.google.com/file/d/1Rb25_mzAKq7ZqFI9fPyOX8TnTtspYxpF/view?usp=sharing > > I am looking for really small shifts that reflect chemistry, and > therefore, I cannot just eyeball it, I need the actual values. > Indeed it is a complicated task to do without specialized software. > Regarding the threshold, I've changed it multiple times between 0 and > 20, and still no absorption values... > > Thank you so much for looking into it! :) > > > Peter Dzwig > > escreveu no dia quinta, 28/05/2020 ?(s) 19:15: > > Angela, > > first thing to be said is that I sympathize. :-)? I have had similar > issues although my datasets are very different (QSOs); the second is > that I can't open either of your files. Perhaps you tell us what format > they are in. > > I tried running similar code to yours (despite the different context). I > found that the answers, from both thresholding and derivative, I got > were quite sensitive to the data density per unit wavelength, the amount > of noise in the data and the threshold that you set. > > Unless the data is sufficiently dense both thresholding and derivative > will produce inaccurate or even false results. > > In the end I found the best solution was to make a table of all the > lines that I was interested in and simply overplot them on my spectrum. > I can then see what's where and (using a combination of astropy and > numpy) re-plot and re-examine pertinent parts of the spectrum, but as > ever the limiting factor is data density. > > I guess in your case the lines that you would plot would be Calcium, > Cerium, Lanthanum, Carbon, Flourine? - and Neodymium? and some of their > molecular forms. Tables for most are available from NIST: > https://www.nist.gov/pml/atomic-spectra-database > > There probably is a best approach - a tutorial would be a good idea - > and I will watch this space to see what solutions others offer. > > Regards, > > Peter Dzwig > > On 28/05/2020 08:43, Angela Rodrigues wrote: > > Hello, > > > > I have been trying to use astropy to extract lines of absorption > from a > > mineral spectrum. > > so I have the attached hdr file with the spectral analysis from a > mineral. > > The code to extract the data from the file is as follows: > > > > import spectral.io.envi as envi > > lib = envi.open('GFZ_HySpex_REMin.hdr') > > > > a=lib.metadata > > wvl = a.get('wavelength') > > wvl = [int(float(i)) for i in wvl] > > > > import matplotlib.pyplot as plt > > plt.plot(wvl,spectra[13]) > > > > #grab spectra for parisite > > names = lib.names > > > > spectra_parisite = spectra[8] > > plt.plot(wvl, spectra_parisite) > > > > > > I wanted to extract the absorption lines as in the documentation > example > > here . > > Here's what I've done: > > > > > > w = np.array(wvl) > > > > import astropy.units as u > > w = w*u.nm > > spectra_parisite = spectra_parisite*u.Jy > > from specutils import Spectrum1D, SpectralRegion > > spectrum = Spectrum1D(spectral_axis = w, flux = spectra_parisite) > > > > from matplotlib import pyplot as plt > > plt.plot(spectrum.spectral_axis, spectrum.flux) > > plt.xlabel('Spectral Axis ({})'.format(spectrum.spectral_axis.unit)) > > plt.ylabel('Flux Axis({})'.format(spectrum.flux.unit)) > > plt.grid(True) > > > > from specutils.manipulation import noise_region_uncertainty > > noise_region = SpectralRegion(450*u.nm, 2500*u.nm) > > spectrum2 = noise_region_uncertainty(spectrum, noise_region) > > > > from specutils.fitting import find_lines_threshold > > lines = find_lines_threshold(spectrum2, noise_factor=0) > > lines[lines['line_type'] == 'absorption'] > > lines[lines['line_type'] == 'emission'] > > > > # Derivative technique > > from specutils.fitting import find_lines_derivative > > lines = find_lines_derivative(spectrum2, flux_threshold=0) > > lines[lines['line_type'] == 'absorption']? > > > > > > However, I get no absorption feature lines. Am I doing something > wrong? > > The emission zones seem to be alright, but I really need the > absorption > > loci. > > Thank you so much for your help!! > > Warm regards, > > Angela Rodrigues > > > > _______________________________________________ > > AstroPy mailing list > > AstroPy at python.org > > https://mail.python.org/mailman/listinfo/astropy > > > > -- > > Dr. Peter Dzwig > -- Dr. Peter Dzwig From pdzwig at summaventures.com Thu May 28 10:01:33 2020 From: pdzwig at summaventures.com (Peter Dzwig) Date: Thu, 28 May 2020 15:01:33 +0100 Subject: [AstroPy] Fwd: Help with finding absorption lines In-Reply-To: References: <0a1ff555-121e-ee1d-a9c0-49aca9d51e01@summaventures.com> Message-ID: <4f75cd19-3388-b50e-8cae-10d1e35e6033@summaventures.com> Xavier, Angela, for absorption lines that looks like a good idea. I still don't understand why astropy has such difficulties. Anyone any comments on the code? Xavier, I will look at ALIS for emission lines. Peter On 28/05/2020 13:22, J. Xavier Prochaska wrote: > Consider > > linetools -- https://github.com/linetools/linetools > > and > > ALIS -- https://github.com/rcooke-ast/ALIS > > Built by scientists who study absorption lines for a living.. > > X > > > On Thu, May 28, 2020 at 2:55 AM Angela Rodrigues > > wrote: > > Hi Dr. Peter > > Thank you kindly for your reply. > > Here's a folder with the file (it's an hdr file): > https://drive.google.com/file/d/1Rb25_mzAKq7ZqFI9fPyOX8TnTtspYxpF/view?usp=sharing > > I am looking for really small shifts that reflect chemistry, and > therefore, I cannot just eyeball it, I need the actual values. > Indeed it is a complicated task to do without specialized software. > Regarding the threshold, I've changed it multiple times between 0 > and 20, and still no absorption values... > > Thank you so much for looking into it! :) > > > Peter Dzwig > escreveu no dia quinta, > 28/05/2020 ?(s) 19:15: > > Angela, > > first thing to be said is that I sympathize. :-)? I have had similar > issues although my datasets are very different (QSOs); the second is > that I can't open either of your files. Perhaps you tell us what > format > they are in. > > I tried running similar code to yours (despite the different > context). I > found that the answers, from both thresholding and derivative, I got > were quite sensitive to the data density per unit wavelength, > the amount > of noise in the data and the threshold that you set. > > Unless the data is sufficiently dense both thresholding and > derivative > will produce inaccurate or even false results. > > In the end I found the best solution was to make a table of all the > lines that I was interested in and simply overplot them on my > spectrum. > I can then see what's where and (using a combination of astropy and > numpy) re-plot and re-examine pertinent parts of the spectrum, > but as > ever the limiting factor is data density. > > I guess in your case the lines that you would plot would be Calcium, > Cerium, Lanthanum, Carbon, Flourine? - and Neodymium? and some > of their > molecular forms. Tables for most are available from NIST: > https://www.nist.gov/pml/atomic-spectra-database > > There probably is a best approach - a tutorial would be a good > idea - > and I will watch this space to see what solutions others offer. > > Regards, > > Peter Dzwig > > On 28/05/2020 08:43, Angela Rodrigues wrote: > > Hello, > > > > I have been trying to use astropy to extract lines of > absorption from a > > mineral spectrum. > > so I have the attached hdr file with the spectral analysis > from a mineral. > > The code to extract the data from the file is as follows: > > > > import spectral.io.envi as envi > > lib = envi.open('GFZ_HySpex_REMin.hdr') > > > > a=lib.metadata > > wvl = a.get('wavelength') > > wvl = [int(float(i)) for i in wvl] > > > > import matplotlib.pyplot as plt > > plt.plot(wvl,spectra[13]) > > > > #grab spectra for parisite > > names = lib.names > > > > spectra_parisite = spectra[8] > > plt.plot(wvl, spectra_parisite) > > > > > > I wanted to extract the absorption lines as in the > documentation example > > here . > > Here's what I've done: > > > > > > w = np.array(wvl) > > > > import astropy.units as u > > w = w*u.nm > > spectra_parisite = spectra_parisite*u.Jy > > from specutils import Spectrum1D, SpectralRegion > > spectrum = Spectrum1D(spectral_axis = w, flux = spectra_parisite) > > > > from matplotlib import pyplot as plt > > plt.plot(spectrum.spectral_axis, spectrum.flux) > > plt.xlabel('Spectral Axis > ({})'.format(spectrum.spectral_axis.unit)) > > plt.ylabel('Flux Axis({})'.format(spectrum.flux.unit)) > > plt.grid(True) > > > > from specutils.manipulation import noise_region_uncertainty > > noise_region = SpectralRegion(450*u.nm, 2500*u.nm) > > spectrum2 = noise_region_uncertainty(spectrum, noise_region) > > > > from specutils.fitting import find_lines_threshold > > lines = find_lines_threshold(spectrum2, noise_factor=0) > > lines[lines['line_type'] == 'absorption'] > > lines[lines['line_type'] == 'emission'] > > > > # Derivative technique > > from specutils.fitting import find_lines_derivative > > lines = find_lines_derivative(spectrum2, flux_threshold=0) > > lines[lines['line_type'] == 'absorption']? > > > > > > However, I get no absorption feature lines. Am I doing > something wrong? > > The emission zones seem to be alright, but I really need the > absorption > > loci. > > Thank you so much for your help!! > > Warm regards, > > Angela Rodrigues > > > > _______________________________________________ > > AstroPy mailing list > > AstroPy at python.org > > https://mail.python.org/mailman/listinfo/astropy > > > > -- > > Dr. Peter Dzwig > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > > > > -- > -- > ---------------------------------------------- > J. Xavier Prochaska > UCO/Lick Observatory > 1156 High St. > UC Santa Cruz > Santa Cruz, CA 95064 > > Affiliate of IPMU > Affiliate of LBNL > > http://www.ucolick.org/~xavier/ > https://aaii.ucsc.edu/ > http://www.ucolick.org/f-4 > > 831-459-2135 (Direct) > 831-459-2991 (UCO/Lick Main) > 831-459-5244 (Fax) > > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -- Dr. Peter Dzwig