From j.koot at airbusDS.nl Mon Sep 18 03:05:28 2023 From: j.koot at airbusDS.nl (Koot, Sjaak) Date: Mon, 18 Sep 2023 07:05:28 +0000 Subject: [AstroPy] sun angles from astropy deviate from US Navy algorithm Message-ID: <29e5dfec09064cfea7c76f47b81eb96d@airbusDS.nl> Airbus Amber Hi, I am comparing the sun angles computed with astropy V5.3.3 with the algorithm as described here https://aa.usno.navy.mil/faq/sun_approx. According to that website: Given below is a simple algorithm for computing the Sun's angular coordinates to an accuracy of about 1 arcminute within two centuries of 2000. So my understanding is that the algorithm should not deviate (much) more than 0.0166666667 degrees for dates from 2000 - 2023. However when I plot the delta's for the Ra and dec from 2000 - 2023 I get the following results: [cid:image001.png at 01D9EA0F.442D2A80] [cid:image002.png at 01D9EA0F.442D2A80] I have no astronomical background whatsoever so from the plots I do not understand what is happening. I have attached the python3 code (as .txt files) generating the data. Do you have any idea what is happening? Best regards, Sjaak M +31 (0)6 53 79 80 30 E j.koot at airbusDS.nl -- ----------------------------------------------------------------------- Airbus Netherlands B.V. te Leiden. KvK nummer: 28086907. Airbus Netherlands B.V., Leiden, The Netherlands. Chamber of Commerce number 28086907. -- ----------------------------------------------------------------------- This communication is intended for use by the addressee and may contain confidential or privileged information. If you receive this communication unintentionally, please notify us immediately and delete the message from your computer without making any copies. -- ----------------------------------------------------------------------- Please consider the environment before printing this email -- ----------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 36416 bytes Desc: image001.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.png Type: image/png Size: 54722 bytes Desc: image002.png URL: -------------- next part -------------- #!/usr/bin/env python3 # https://aa.usno.navy.mil/faq/sun_approx from math import sin, cos, asin, atan2, degrees, radians, fmod print("{:11s},{:7s},{:7s}".format('Time', 'Ra', 'dec')) JD = 2451544.50 #JD = 2459945.50 JD_0 = JD JDD = JD - JD_0 while JDD < 20*365: D = JD - 2451545.0 g = 357.529 + 0.98560028 * D q = 280.459 + 0.98564736 * D L = q + 1.915 * sin(radians(g)) + 0.020 * sin(radians(2*g)) R = 1.00014 - 0.01671 * cos(radians(g)) - 0.00014 * cos(radians(2*g)) e = 23.439 - 0.00000036 * D #tan RA = cos e sin L / cos L RA = degrees(atan2(cos(radians(e))*sin(radians(L)), cos(radians(L)))) #sin d = sin e sin L d = degrees(asin(sin(radians(e))*sin(radians(L)))) #qm = fmod(q, 360) #EqT = (qm - RA) #if EqT > 180.0 : EqT -= 360.0 ## From degrees to minutes #EqT = 60*EqT/15 if RA < 0 : RA += 360 #print(f"JD = {JD:6.2f} D = {D:6.2f} qm = {qm:6.2f} EqT = {EqT:5.2f} RA = {RA:6.2f} d = {d:6.2f}") print(f"{JD:.2f},{RA:6.2f},{d:6.2f}") JD += 1 JDD = JD - JD_0 -------------- next part -------------- #!/usr/bin/env python3 from astropy.coordinates import get_sun import astropy.coordinates as coord from astropy.time import Time import astropy.units as u import time my_time = Time('2000-01-01T00:00:00', format='isot', scale='utc') #my_time = Time('2459945.5', format='jd') my_time.format='jd' dt = 0 print("{:11s},{:7s},{:7s}".format('Time', 'Ra', 'dec')) while dt < 20*365: radec = coord.GCRS() sun_rade = get_sun(my_time).transform_to(radec) print("{:.2f},{:6.2f},{:6.2f}".format(my_time.jd, sun_rade.ra.degree, sun_rade.dec.degree)) my_time = my_time + 1 * u.day dt = dt + 1 From brewer at astro.umass.edu Sun Sep 24 07:07:19 2023 From: brewer at astro.umass.edu (Michael Brewer) Date: Sun, 24 Sep 2023 07:07:19 -0400 Subject: [AstroPy] sun angles from astropy deviate from US Navy algorithm In-Reply-To: <29e5dfec09064cfea7c76f47b81eb96d@airbusDS.nl> References: <29e5dfec09064cfea7c76f47b81eb96d@airbusDS.nl> Message-ID: The problem here is that the naval observatory algorithm computes the apparent position of the Sun. Please substitute TETE for GCRS in your Astropy script. On Wed, Sep 20, 2023 at 11:52?AM Koot, Sjaak via AstroPy wrote: > > > > > Airbus Amber > > Hi, > > > > I am comparing the sun angles computed with astropy V5.3.3 with the > algorithm as described > > here https://aa.usno.navy.mil/faq/sun_approx > > . > > > > According to that website: > > > > Given below is a simple algorithm for computing the Sun's angular > coordinates to an accuracy of about 1 arcminute within two centuries of > 2000. > > > > So my understanding is that the algorithm should not deviate (much) more > than 0.0166666667 degrees for dates from 2000 ? 2023. > > > > However when I plot the delta?s for the Ra and dec from 2000 ? 2023 I get > the following results: > > > > > > > > > > > > I have no astronomical background whatsoever so from the plots I do not > understand what is happening. > > > > I have attached the python3 code (as .txt files) generating the data. > > > > Do you have any idea what is happening? > > > > Best regards, > > Sjaak > > > > > > *M +31 (0)6 53 79 80 30* > > *E j.koot at airbusDS.nl* > > > > > -- ----------------------------------------------------------------------- > Airbus Netherlands B.V. te Leiden. KvK nummer: 28086907. > Airbus Netherlands B.V., Leiden, The Netherlands. > Chamber of Commerce number 28086907. > -- ----------------------------------------------------------------------- > This communication is intended for use by the addressee and may > contain confidential or privileged information. If you receive this > communication unintentionally, please notify us immediately and > delete the message from your computer without making any copies. > -- ----------------------------------------------------------------------- > Please consider the environment before printing this email > -- ----------------------------------------------------------------------- > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > > https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fastropy&data=05%7C01%7Cbrewer%40astro.umass.edu%7C79353c88ed6b4ae54f7508dbb9f1a1c1%7C7bd08b0b33954dc194bbd0b2e56a497f%7C0%7C0%7C638308219698364856%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=747g59aamNANzwr2AJN1kn1W1u1fgQwFeql%2FVBod8RM%3D&reserved=0 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.koot at airbusDS.nl Tue Sep 26 05:49:28 2023 From: j.koot at airbusDS.nl (Koot, Sjaak) Date: Tue, 26 Sep 2023 09:49:28 +0000 Subject: [AstroPy] sun angles from astropy deviate from US Navy algorithm In-Reply-To: References: <29e5dfec09064cfea7c76f47b81eb96d@airbusDS.nl> Message-ID: Thanks! Yes indeed, using TETE corrected the difference. Best regards, Sjaak From: AstroPy On Behalf Of Michael Brewer Sent: zondag, 24 september, 2023 13:07 To: Astronomical Python mailing list Subject: Re: [AstroPy] sun angles from astropy deviate from US Navy algorithm The problem here is that the naval observatory algorithm computes the apparent position of the Sun. Please substitute TETE for GCRS in your Astropy script. On Wed, Sep 20, 2023 at 11:52?AM Koot, Sjaak via AstroPy > wrote: Airbus Amber Hi, I am comparing the sun angles computed with astropy V5.3.3 with the algorithm as described here https://aa.usno.navy.mil/faq/sun_approx. According to that website: Given below is a simple algorithm for computing the Sun's angular coordinates to an accuracy of about 1 arcminute within two centuries of 2000. So my understanding is that the algorithm should not deviate (much) more than 0.0166666667 degrees for dates from 2000 ? 2023. However when I plot the delta?s for the Ra and dec from 2000 ? 2023 I get the following results: I have no astronomical background whatsoever so from the plots I do not understand what is happening. I have attached the python3 code (as .txt files) generating the data. Do you have any idea what is happening? Best regards, Sjaak M +31 (0)6 53 79 80 30 E j.koot at airbusDS.nl -- ----------------------------------------------------------------------- Airbus Netherlands B.V. te Leiden. KvK nummer: 28086907. Airbus Netherlands B.V., Leiden, The Netherlands. Chamber of Commerce number 28086907. -- ----------------------------------------------------------------------- This communication is intended for use by the addressee and may contain confidential or privileged information. If you receive this communication unintentionally, please notify us immediately and delete the message from your computer without making any copies. -- ----------------------------------------------------------------------- Please consider the environment before printing this email -- ----------------------------------------------------------------------- _______________________________________________ AstroPy mailing list AstroPy at python.org https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fastropy&data=05%7C01%7Cbrewer%40astro.umass.edu%7C79353c88ed6b4ae54f7508dbb9f1a1c1%7C7bd08b0b33954dc194bbd0b2e56a497f%7C0%7C0%7C638308219698364856%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=747g59aamNANzwr2AJN1kn1W1u1fgQwFeql%2FVBod8RM%3D&reserved=0 -- ----------------------------------------------------------------------- Airbus Netherlands B.V. te Leiden. KvK nummer: 28086907. Airbus Netherlands B.V., Leiden, The Netherlands. Chamber of Commerce number 28086907. -- ----------------------------------------------------------------------- This communication is intended for use by the addressee and may contain confidential or privileged information. If you receive this communication unintentionally, please notify us immediately and delete the message from your computer without making any copies. -- ----------------------------------------------------------------------- Please consider the environment before printing this email -- ----------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From jj94759 at arizona.edu Tue Sep 26 15:54:36 2023 From: jj94759 at arizona.edu (Jaclyn Amber John) Date: Tue, 26 Sep 2023 12:54:36 -0700 Subject: [AstroPy] Question regarding implementation of Lomb Scargle Periodogram Message-ID: Hi everyone, I am working on implementing the Astropy Lomb Scargle Periodogram to estimate the coefficients on a spectrally-dependent modulation function, which is the sum of a sin and cos wave. For now I am working with simulated data. The modulation function is unevenly sampled in wavenumber, which is why the LSP was selected for data reduction. The frequency of the modulation function is also dependent on wavenumber. I have a working example of the LSP for a constant frequency, but I need the algorithm to work for an array of frequencies, since the frequency changes with wavenumber. Please see my example on my lab's github: https://github.com/Polarization-Lab/IRCSP/blob/master/demonstrations/LSP%20Example%20for%20Astropy%20community%20.ipynb . If anyone can help me with this, I would really appreciate it. Thank you! -- *Jaclyn John * PhD Student *|* Polarization Lab Wyant College of Optical Sciences University of Arizona *|* 480-335-1476 -------------- next part -------------- An HTML attachment was scrubbed... URL: