From richard.moffat at gmail.com Fri Apr 21 21:19:28 2023 From: richard.moffat at gmail.com (Richard Moffat) Date: Sat, 22 Apr 2023 13:19:28 +1200 Subject: [AstroPy] RA/Dec to Alt/Az Message-ID: Hi I am trying to convert RA/Dec to Alt/Az. The results I'm getting are a few minutes out in both directions, but less than one degree. I've verified this with an online calculator ( https://astrogreg.com/convert_ra_dec_to_alt_az.html), and also with results from Stellarium - both those two match, unless they are both out and I'm actually correct! I've looked through the documentation and searched quite a bit online. I'm still missing something. Any help would be really appreciated. (First-time poster here - no flames please if I'm out of order somewhere :-) from astropy.coordinates import EarthLocation, SkyCoord from astropy.time import Time from astropy import units as u from astropy.coordinates import AltAz # lat, lon obviously changed to not give my home address; no, that's not the problem lat, lon = -43.5, 172.5 observing_location = EarthLocation(lat=lat, lon=lon, height=10 * u.m) # gmt_time_str below is actually calculated from real-time in the script; please assume it's correct # gmt_time_str = local_time - time_zone_diff gmt_time_str = '2023-04-22 00:57:00' observing_time = Time(gmt_time_str) aa = AltAz(location=observing_location, obstime=observing_time) # Alpha Centuri ra = '14h41m13.3s' # 14.68669 dec = '-60d55m52.3s' # -60.9311944 coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg)) azalt_coord = coord.transform_to(aa) az = azalt_coord.az.to_string(unit=u.deg, sep=':', precision=2, pad=True) alt = azalt_coord.alt.to_string(unit=u.deg, sep=':', precision=2, pad=True) print('az alt', az, alt) -------------- next part -------------- An HTML attachment was scrubbed... URL: From ejensen1 at swarthmore.edu Fri Apr 21 21:41:42 2023 From: ejensen1 at swarthmore.edu (Eric Jensen) Date: Fri, 21 Apr 2023 21:41:42 -0400 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: References: Message-ID: <0A4722D1-8457-4948-9E37-E278490D644A@swarthmore.edu> Hi Richard, Welcome! This will be easier to troubleshoot if you can give some specific input and output. Can you put in whatever latitude, longitude, and time you want, and then show the output from your script, and do the same for the other calculators you?re comparing to? That will help see where any problem might lie. Thanks, Eric > On Apr 21, 2023, at 9:19 PM, Richard Moffat wrote: > > Hi > > I am trying to convert RA/Dec to Alt/Az. The results I'm getting are a few minutes out in both directions, but less than one degree. > > I've verified this with an online calculator (https://astrogreg.com/convert_ra_dec_to_alt_az.html ), and also with results from Stellarium - both those two match, unless they are both out and I'm actually correct! > > I've looked through the documentation and searched quite a bit online. I'm still missing something. Any help would be really appreciated. > > (First-time poster here - no flames please if I'm out of order somewhere :-) > > from astropy.coordinates import EarthLocation, SkyCoord > from astropy.time import Time > from astropy import units as u > from astropy.coordinates import AltAz > > # lat, lon obviously changed to not give my home address; no, that's not the problem > lat, lon = -43.5, 172.5 > observing_location = EarthLocation(lat=lat, lon=lon, height=10 * u.m) > > # gmt_time_str below is actually calculated from real-time in the script; please assume it's correct > # gmt_time_str = local_time - time_zone_diff > gmt_time_str = '2023-04-22 00:57:00' > observing_time = Time(gmt_time_str) > > aa = AltAz(location=observing_location, obstime=observing_time) > > # Alpha Centuri > ra = '14h41m13.3s' > # 14.68669 > dec = '-60d55m52.3s' > # -60.9311944 > > coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg)) > azalt_coord = coord.transform_to(aa) > > az = azalt_coord.az.to_string(unit=u.deg, sep=':', precision=2, pad=True) > alt = azalt_coord.alt.to_string(unit=u.deg, sep=':', precision=2, pad=True) > > print('az alt', az, alt) > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard.moffat at gmail.com Fri Apr 21 23:37:45 2023 From: richard.moffat at gmail.com (Richard Moffat) Date: Sat, 22 Apr 2023 15:37:45 +1200 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: <0A4722D1-8457-4948-9E37-E278490D644A@swarthmore.edu> References: <0A4722D1-8457-4948-9E37-E278490D644A@swarthmore.edu> Message-ID: Hi Eric, Et .al, Thanks for your prompt reply. Here's the exact piece of code I'm running. (Note I've again fixed the time to a set time, not a Python-generated current time). Note that the Time for the value in the Python script is GMT, which I'm assuming is what it needs. (A local time, which is 12 hours added, gives a result that is miles out.) For context, I'm in New Zealand, which you may have guessed something like that by now :-0 The local sidereal time on the website calculator, mentioned below, gives 4:39:41 (for 15:10, 172 long) I've run out of ideas. Expected result: (verified from yet another calculator at http://www.stargazing.net/mas/al_az.htm ) Az 165d 26m 39s Alt 17d 10m 24s Calculated from the code below Az 165d 41m 45.97s Alt 17d 11m 02.40s Input for the website mentioned above, giving the expected results: Date: April 22 2023 User time: 15 10 00 Time Zone Offset: 12h east Daylight saving time 0 Lat -43 30 0 Long 172 30 0 Epoch year 2000 from astropy.coordinates import EarthLocation, SkyCoord from astropy.time import Time from astropy import units as u from astropy.coordinates import AltAz lat, lon = -43.5, 172.5 observing_location = EarthLocation(lat=lat, lon=lon, height=10 * u.m) gmt_time_str = '2023-04-22 03:10:00' observing_time = Time(gmt_time_str) aa = AltAz(location=observing_location, obstime=observing_time) ra = '14h41m13.3s' dec = '-60d55m52.3s' coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg)) azalt_coord = coord.transform_to(aa) az = azalt_coord.az.to_string(unit=u.deg, sep=':', precision=2, pad=True) alt = azalt_coord.alt.to_string(unit=u.deg, sep=':', precision=2, pad=True) print('az alt', az, alt) On Sat, 22 Apr 2023 at 13:41, Eric Jensen wrote: > Hi Richard, > > Welcome! This will be easier to troubleshoot if you can give some > specific input and output. Can you put in whatever latitude, longitude, > and time you want, and then show the output from your script, and do the > same for the other calculators you?re comparing to? That will help see > where any problem might lie. > > Thanks, > > Eric > > > On Apr 21, 2023, at 9:19 PM, Richard Moffat > wrote: > > Hi > > I am trying to convert RA/Dec to Alt/Az. The results I'm getting are a few > minutes out in both directions, but less than one degree. > > I've verified this with an online calculator ( > https://astrogreg.com/convert_ra_dec_to_alt_az.html), and also with > results from Stellarium - both those two match, unless they are both out > and I'm actually correct! > > I've looked through the documentation and searched quite a bit online. I'm > still missing something. Any help would be really appreciated. > > (First-time poster here - no flames please if I'm out of order somewhere > :-) > > from astropy.coordinates import EarthLocation, SkyCoord > from astropy.time import Time > from astropy import units as u > from astropy.coordinates import AltAz > > # lat, lon obviously changed to not give my home address; no, that's not the problem > lat, lon = -43.5, 172.5 > observing_location = EarthLocation(lat=lat, lon=lon, height=10 * u.m) > > # gmt_time_str below is actually calculated from real-time in the script; please assume it's correct > # gmt_time_str = local_time - time_zone_diff > > gmt_time_str = '2023-04-22 00:57:00' > observing_time = Time(gmt_time_str) > > aa = AltAz(location=observing_location, obstime=observing_time) > > # Alpha Centuri > ra = '14h41m13.3s' > # 14.68669 > dec = '-60d55m52.3s' > # -60.9311944 > > coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg)) > azalt_coord = coord.transform_to(aa) > > az = azalt_coord.az.to_string(unit=u.deg, sep=':', precision=2, pad=True) > alt = azalt_coord.alt.to_string(unit=u.deg, sep=':', precision=2, pad=True) > > print('az alt', az, alt) > > _______________________________________________ > 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 m.shemuni at gmail.com Sat Apr 22 04:19:47 2023 From: m.shemuni at gmail.com (Mohammad Shameoni Niaei) Date: Sat, 22 Apr 2023 11:19:47 +0300 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: References: <0A4722D1-8457-4948-9E37-E278490D644A@swarthmore.edu> Message-ID: Hello Richard The online calculator you used has no input for height from sea level. So it would assume the Earth is a perfect sphere? For the Stellarium, I don't know if you set the location correctly or not. But this kind of very small difference mostly occurs due to the different heights. You can change the height of EarthLocation and you will see how it changes. So please, 1. Check your Stellarium's location settings. See if it matches with astropy (10 m). 2. Set your EarthLocation's height to 0m and see if it matches. My best On Sat, Apr 22, 2023 at 6:38?AM Richard Moffat wrote: > Hi Eric, Et .al, > > Thanks for your prompt reply. Here's the exact piece of code I'm running. > (Note I've again fixed the time to a set time, not a Python-generated > current time). > > Note that the Time for the value in the Python script is GMT, which I'm > assuming is what it needs. (A local time, which is 12 hours added, gives a > result that is miles out.) For context, I'm in New Zealand, which you may > have guessed something like that by now :-0 > > The local sidereal time on the website calculator, mentioned below, gives > 4:39:41 (for 15:10, 172 long) > > I've run out of ideas. > > Expected result: (verified from yet another calculator at > http://www.stargazing.net/mas/al_az.htm ) > Az 165d 26m 39s > Alt 17d 10m 24s > > Calculated from the code below > Az 165d 41m 45.97s > Alt 17d 11m 02.40s > > > Input for the website mentioned above, giving the expected results: > Date: April 22 2023 > User time: 15 10 00 > Time Zone Offset: 12h east > Daylight saving time 0 > Lat -43 30 0 > Long 172 30 0 > Epoch year 2000 > > > from astropy.coordinates import EarthLocation, SkyCoord > from astropy.time import Time > from astropy import units as u > from astropy.coordinates import AltAz > > lat, lon = -43.5, 172.5 > > observing_location = EarthLocation(lat=lat, lon=lon, height=10 * u.m) > > gmt_time_str = '2023-04-22 03:10:00' > observing_time = Time(gmt_time_str) > > aa = AltAz(location=observing_location, obstime=observing_time) > > ra = '14h41m13.3s' > dec = '-60d55m52.3s' > > coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg)) > azalt_coord = coord.transform_to(aa) > > az = azalt_coord.az.to_string(unit=u.deg, sep=':', precision=2, pad=True) > alt = azalt_coord.alt.to_string(unit=u.deg, sep=':', precision=2, pad=True) > > print('az alt', az, alt) > > > > > > > On Sat, 22 Apr 2023 at 13:41, Eric Jensen wrote: > >> Hi Richard, >> >> Welcome! This will be easier to troubleshoot if you can give some >> specific input and output. Can you put in whatever latitude, longitude, >> and time you want, and then show the output from your script, and do the >> same for the other calculators you?re comparing to? That will help see >> where any problem might lie. >> >> Thanks, >> >> Eric >> >> >> On Apr 21, 2023, at 9:19 PM, Richard Moffat >> wrote: >> >> Hi >> >> I am trying to convert RA/Dec to Alt/Az. The results I'm getting are a >> few minutes out in both directions, but less than one degree. >> >> I've verified this with an online calculator ( >> https://astrogreg.com/convert_ra_dec_to_alt_az.html), and also with >> results from Stellarium - both those two match, unless they are both out >> and I'm actually correct! >> >> I've looked through the documentation and searched quite a bit online. >> I'm still missing something. Any help would be really appreciated. >> >> (First-time poster here - no flames please if I'm out of order somewhere >> :-) >> >> from astropy.coordinates import EarthLocation, SkyCoord >> from astropy.time import Time >> from astropy import units as u >> from astropy.coordinates import AltAz >> >> # lat, lon obviously changed to not give my home address; no, that's not the problem >> lat, lon = -43.5, 172.5 >> observing_location = EarthLocation(lat=lat, lon=lon, height=10 * u.m) >> >> # gmt_time_str below is actually calculated from real-time in the script; please assume it's correct >> # gmt_time_str = local_time - time_zone_diff >> >> gmt_time_str = '2023-04-22 00:57:00' >> observing_time = Time(gmt_time_str) >> >> aa = AltAz(location=observing_location, obstime=observing_time) >> >> # Alpha Centuri >> ra = '14h41m13.3s' >> # 14.68669 >> dec = '-60d55m52.3s' >> # -60.9311944 >> >> coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg)) >> azalt_coord = coord.transform_to(aa) >> >> az = azalt_coord.az.to_string(unit=u.deg, sep=':', precision=2, pad=True) >> alt = azalt_coord.alt.to_string(unit=u.deg, sep=':', precision=2, pad=True) >> >> print('az alt', az, alt) >> >> _______________________________________________ >> 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 > -- Mohammad Shameoni Niaei Astronomer Atat?rk University, Astrophysics Research and Application Center. ERZURUM-TURKEY -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard.moffat at gmail.com Sat Apr 22 05:42:48 2023 From: richard.moffat at gmail.com (Richard Moffat) Date: Sat, 22 Apr 2023 21:42:48 +1200 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: References: <0A4722D1-8457-4948-9E37-E278490D644A@swarthmore.edu> Message-ID: Hello Mohammad Thank you for your reply. The altitude above sea level where I live is only 10m, so that doesn't seem to be it. Interestingly, changing the value in EarthLocation does not seem to make any difference to the results. I possibly do not know how the function works. It's a bit tricky to give the exact coordinates from Stellarium, as although I can change the lat and long manually, az/alt changes pretty rapidly in real-time. Seeing that they were different from astropy was by a screenshot and observation! I am quite certain Stellarium matches online calculators, at least to a few seconds. Quickly plugging in a few different coordinates to astropy, the setting has to be around 30km from where I live to achieve results closer to what I expect. I could say it's literally miles out. lat, lon = -43.35, 173.05 <= changed from -43.5, 172.5az alt 165:26:56.53 17:08:17.72 <= not exact, but within a couple of minutes now. There's something fundamental I'm missing. I'll double-check everything tomorrow. Thank you once again for your help and suggestions. *Noho ora mai,* *All the best,* Richard Moffat. ============================================================== richard.moffat at gmail.com ============================================================== On Sat, 22 Apr 2023 at 20:20, Mohammad Shameoni Niaei wrote: > Hello Richard > > The online calculator you used has no input for height from sea level. So > it would assume the Earth is a perfect sphere? > > For the Stellarium, I don't know if you set the location correctly or not. > > But this kind of very small difference mostly occurs due to the different > heights. You can change the height of EarthLocation and you will see how it > changes. > So please, > > 1. Check your Stellarium's location settings. See if it matches with > astropy (10 m). > 2. Set your EarthLocation's height to 0m and see if it matches. > > > My best > > > On Sat, Apr 22, 2023 at 6:38?AM Richard Moffat > wrote: > >> Hi Eric, Et .al, >> >> Thanks for your prompt reply. Here's the exact piece of code I'm running. >> (Note I've again fixed the time to a set time, not a Python-generated >> current time). >> >> Note that the Time for the value in the Python script is GMT, which I'm >> assuming is what it needs. (A local time, which is 12 hours added, gives a >> result that is miles out.) For context, I'm in New Zealand, which you may >> have guessed something like that by now :-0 >> >> The local sidereal time on the website calculator, mentioned below, gives >> 4:39:41 (for 15:10, 172 long) >> >> I've run out of ideas. >> >> Expected result: (verified from yet another calculator at >> http://www.stargazing.net/mas/al_az.htm ) >> Az 165d 26m 39s >> Alt 17d 10m 24s >> >> Calculated from the code below >> Az 165d 41m 45.97s >> Alt 17d 11m 02.40s >> >> >> Input for the website mentioned above, giving the expected results: >> Date: April 22 2023 >> User time: 15 10 00 >> Time Zone Offset: 12h east >> Daylight saving time 0 >> Lat -43 30 0 >> Long 172 30 0 >> Epoch year 2000 >> >> >> from astropy.coordinates import EarthLocation, SkyCoord >> from astropy.time import Time >> from astropy import units as u >> from astropy.coordinates import AltAz >> >> lat, lon = -43.5, 172.5 >> >> observing_location = EarthLocation(lat=lat, lon=lon, height=10 * u.m) >> >> gmt_time_str = '2023-04-22 03:10:00' >> observing_time = Time(gmt_time_str) >> >> aa = AltAz(location=observing_location, obstime=observing_time) >> >> ra = '14h41m13.3s' >> dec = '-60d55m52.3s' >> >> coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg)) >> azalt_coord = coord.transform_to(aa) >> >> az = azalt_coord.az.to_string(unit=u.deg, sep=':', precision=2, pad=True) >> alt = azalt_coord.alt.to_string(unit=u.deg, sep=':', precision=2, pad=True) >> >> print('az alt', az, alt) >> >> >> >> >> >> >> On Sat, 22 Apr 2023 at 13:41, Eric Jensen >> wrote: >> >>> Hi Richard, >>> >>> Welcome! This will be easier to troubleshoot if you can give some >>> specific input and output. Can you put in whatever latitude, longitude, >>> and time you want, and then show the output from your script, and do the >>> same for the other calculators you?re comparing to? That will help see >>> where any problem might lie. >>> >>> Thanks, >>> >>> Eric >>> >>> >>> On Apr 21, 2023, at 9:19 PM, Richard Moffat >>> wrote: >>> >>> Hi >>> >>> I am trying to convert RA/Dec to Alt/Az. The results I'm getting are a >>> few minutes out in both directions, but less than one degree. >>> >>> I've verified this with an online calculator ( >>> https://astrogreg.com/convert_ra_dec_to_alt_az.html), and also with >>> results from Stellarium - both those two match, unless they are both out >>> and I'm actually correct! >>> >>> I've looked through the documentation and searched quite a bit online. >>> I'm still missing something. Any help would be really appreciated. >>> >>> (First-time poster here - no flames please if I'm out of order somewhere >>> :-) >>> >>> from astropy.coordinates import EarthLocation, SkyCoord >>> from astropy.time import Time >>> from astropy import units as u >>> from astropy.coordinates import AltAz >>> >>> # lat, lon obviously changed to not give my home address; no, that's not the problem >>> lat, lon = -43.5, 172.5 >>> observing_location = EarthLocation(lat=lat, lon=lon, height=10 * u.m) >>> >>> # gmt_time_str below is actually calculated from real-time in the script; please assume it's correct >>> # gmt_time_str = local_time - time_zone_diff >>> >>> gmt_time_str = '2023-04-22 00:57:00' >>> observing_time = Time(gmt_time_str) >>> >>> aa = AltAz(location=observing_location, obstime=observing_time) >>> >>> # Alpha Centuri >>> ra = '14h41m13.3s' >>> # 14.68669 >>> dec = '-60d55m52.3s' >>> # -60.9311944 >>> >>> coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg)) >>> azalt_coord = coord.transform_to(aa) >>> >>> az = azalt_coord.az.to_string(unit=u.deg, sep=':', precision=2, pad=True) >>> alt = azalt_coord.alt.to_string(unit=u.deg, sep=':', precision=2, pad=True) >>> >>> print('az alt', az, alt) >>> >>> _______________________________________________ >>> 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 >> > > > -- > Mohammad Shameoni Niaei > Astronomer > Atat?rk University, Astrophysics Research and Application Center. > ERZURUM-TURKEY > _______________________________________________ > AstroPy mailing list > AstroPy at python.org > https://mail.python.org/mailman/listinfo/astropy > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard.moffat at gmail.com Sat Apr 22 06:45:22 2023 From: richard.moffat at gmail.com (Richard Moffat) Date: Sat, 22 Apr 2023 22:45:22 +1200 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: References: <0A4722D1-8457-4948-9E37-E278490D644A@swarthmore.edu> Message-ID: Hmm... Replying to my own post :-) So, looking at the SkyCoord class, it looks like I need to specify a frame and possibly the equinox. I'm guessing this has something to do with the sidereal time calculation and Julien dates and things. coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg), frame=FK5, equinox=Time(gmt_time_str)) Now I'm only 2-5 seconds out. Time to read up more on the parameters. *Noho ora mai,* *All the best,* Richard Moffat. ============================================================== richard.moffat at gmail.com ============================================================== On Sat, 22 Apr 2023 at 21:42, Richard Moffat wrote: > Hello Mohammad > > Thank you for your reply. The altitude above sea level where I live is > only 10m, so that doesn't seem to be it. Interestingly, changing the value > in EarthLocation does not seem to make any difference to the results. I > possibly do not know how the function works. > > It's a bit tricky to give the exact coordinates from Stellarium, as > although I can change the lat and long manually, az/alt changes pretty > rapidly in real-time. Seeing that they were different from astropy was by a > screenshot and observation! I am quite certain Stellarium matches online > calculators, at least to a few seconds. > > Quickly plugging in a few different coordinates to astropy, the setting > has to be around 30km from where I live to achieve results closer to what I > expect. I could say it's literally miles out. > > lat, lon = -43.35, 173.05 <= changed from -43.5, 172.5az alt 165:26:56.53 17:08:17.72 <= not exact, but within a couple of minutes now. > > There's something fundamental I'm missing. I'll double-check everything > tomorrow. Thank you once again for your help and suggestions. > > *Noho ora mai,* > *All the best,* > Richard Moffat. > > ============================================================== > > richard.moffat at gmail.com > ============================================================== > > > > > > > On Sat, 22 Apr 2023 at 20:20, Mohammad Shameoni Niaei > wrote: > >> Hello Richard >> >> The online calculator you used has no input for height from sea level. So >> it would assume the Earth is a perfect sphere? >> >> For the Stellarium, I don't know if you set the location correctly or not. >> >> But this kind of very small difference mostly occurs due to the different >> heights. You can change the height of EarthLocation and you will see how it >> changes. >> So please, >> >> 1. Check your Stellarium's location settings. See if it matches with >> astropy (10 m). >> 2. Set your EarthLocation's height to 0m and see if it matches. >> >> >> My best >> >> >> On Sat, Apr 22, 2023 at 6:38?AM Richard Moffat >> wrote: >> >>> Hi Eric, Et .al, >>> >>> Thanks for your prompt reply. Here's the exact piece of code I'm >>> running. (Note I've again fixed the time to a set time, not a >>> Python-generated current time). >>> >>> Note that the Time for the value in the Python script is GMT, which I'm >>> assuming is what it needs. (A local time, which is 12 hours added, gives a >>> result that is miles out.) For context, I'm in New Zealand, which you may >>> have guessed something like that by now :-0 >>> >>> The local sidereal time on the website calculator, mentioned below, >>> gives 4:39:41 (for 15:10, 172 long) >>> >>> I've run out of ideas. >>> >>> Expected result: (verified from yet another calculator at >>> http://www.stargazing.net/mas/al_az.htm ) >>> Az 165d 26m 39s >>> Alt 17d 10m 24s >>> >>> Calculated from the code below >>> Az 165d 41m 45.97s >>> Alt 17d 11m 02.40s >>> >>> >>> Input for the website mentioned above, giving the expected results: >>> Date: April 22 2023 >>> User time: 15 10 00 >>> Time Zone Offset: 12h east >>> Daylight saving time 0 >>> Lat -43 30 0 >>> Long 172 30 0 >>> Epoch year 2000 >>> >>> >>> from astropy.coordinates import EarthLocation, SkyCoord >>> from astropy.time import Time >>> from astropy import units as u >>> from astropy.coordinates import AltAz >>> >>> lat, lon = -43.5, 172.5 >>> >>> observing_location = EarthLocation(lat=lat, lon=lon, height=10 * u.m) >>> >>> gmt_time_str = '2023-04-22 03:10:00' >>> observing_time = Time(gmt_time_str) >>> >>> aa = AltAz(location=observing_location, obstime=observing_time) >>> >>> ra = '14h41m13.3s' >>> dec = '-60d55m52.3s' >>> >>> coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg)) >>> azalt_coord = coord.transform_to(aa) >>> >>> az = azalt_coord.az.to_string(unit=u.deg, sep=':', precision=2, pad=True) >>> alt = azalt_coord.alt.to_string(unit=u.deg, sep=':', precision=2, pad=True) >>> >>> print('az alt', az, alt) >>> >>> >>> >>> >>> >>> >>> On Sat, 22 Apr 2023 at 13:41, Eric Jensen >>> wrote: >>> >>>> Hi Richard, >>>> >>>> Welcome! This will be easier to troubleshoot if you can give some >>>> specific input and output. Can you put in whatever latitude, longitude, >>>> and time you want, and then show the output from your script, and do the >>>> same for the other calculators you?re comparing to? That will help see >>>> where any problem might lie. >>>> >>>> Thanks, >>>> >>>> Eric >>>> >>>> >>>> On Apr 21, 2023, at 9:19 PM, Richard Moffat >>>> wrote: >>>> >>>> Hi >>>> >>>> I am trying to convert RA/Dec to Alt/Az. The results I'm getting are a >>>> few minutes out in both directions, but less than one degree. >>>> >>>> I've verified this with an online calculator ( >>>> https://astrogreg.com/convert_ra_dec_to_alt_az.html), and also with >>>> results from Stellarium - both those two match, unless they are both out >>>> and I'm actually correct! >>>> >>>> I've looked through the documentation and searched quite a bit online. >>>> I'm still missing something. Any help would be really appreciated. >>>> >>>> (First-time poster here - no flames please if I'm out of order >>>> somewhere :-) >>>> >>>> from astropy.coordinates import EarthLocation, SkyCoord >>>> from astropy.time import Time >>>> from astropy import units as u >>>> from astropy.coordinates import AltAz >>>> >>>> # lat, lon obviously changed to not give my home address; no, that's not the problem >>>> lat, lon = -43.5, 172.5 >>>> observing_location = EarthLocation(lat=lat, lon=lon, height=10 * u.m) >>>> >>>> # gmt_time_str below is actually calculated from real-time in the script; please assume it's correct >>>> # gmt_time_str = local_time - time_zone_diff >>>> >>>> gmt_time_str = '2023-04-22 00:57:00' >>>> observing_time = Time(gmt_time_str) >>>> >>>> aa = AltAz(location=observing_location, obstime=observing_time) >>>> >>>> # Alpha Centuri >>>> ra = '14h41m13.3s' >>>> # 14.68669 >>>> dec = '-60d55m52.3s' >>>> # -60.9311944 >>>> >>>> coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg)) >>>> azalt_coord = coord.transform_to(aa) >>>> >>>> az = azalt_coord.az.to_string(unit=u.deg, sep=':', precision=2, pad=True) >>>> alt = azalt_coord.alt.to_string(unit=u.deg, sep=':', precision=2, pad=True) >>>> >>>> print('az alt', az, alt) >>>> >>>> _______________________________________________ >>>> 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 >>> >> >> >> -- >> Mohammad Shameoni Niaei >> Astronomer >> Atat?rk University, Astrophysics Research and Application Center. >> ERZURUM-TURKEY >> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjw at as.arizona.edu Sat Apr 22 07:30:24 2023 From: bjw at as.arizona.edu (Benjamin Weiner) Date: Sat, 22 Apr 2023 13:30:24 +0200 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: References: Message-ID: Errors in RA/Dec calculations of order several arcminutes are frequently due to inconsistency in the equinox used. Epoch and equinox are not the same: epoch is time of observation (important for moving objects), while equinox is coordinate reference frame, ie where the Earth?s axis is pointing. The precession from 2000 to 2023 can cause an offset of several arcminutes. FK5 and ICRS are referred to 2000, but to point an earthbound telescope in 2023 one also needs equinox of the current time. Any reference on celestial coordinate systems will give more detail. Ben On Sat, Apr 22, 2023 at 12:46 PM wrote: > Send AstroPy mailing list submissions to > astropy at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/astropy > or, via email, send a message with subject or body 'help' to > astropy-request at python.org > > You can reach the person managing the list at > astropy-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of AstroPy digest..." > > > Today's Topics: > > 1. Re: RA/Dec to Alt/Az (Richard Moffat) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 22 Apr 2023 22:45:22 +1200 > From: Richard Moffat > To: Astronomical Python mailing list > Subject: Re: [AstroPy] RA/Dec to Alt/Az > Message-ID: > < > CA+1X2WFxX2RONmf_8-gaAqsNWKP5jcUT0RS2hTOyYDA-ub4RWw at mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Hmm... Replying to my own post :-) > > So, looking at the SkyCoord class, it looks like I need to specify a frame > and possibly the equinox. I'm guessing this has something to do with the > sidereal time calculation and Julien dates and things. > > coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg), frame=FK5, > equinox=Time(gmt_time_str)) > > Now I'm only 2-5 seconds out. > > Time to read up more on the parameters. > > *Noho ora mai,* > *All the best,* > Richard Moffat. > > ============================================================== > > richard.moffat at gmail.com > ==============================================================___ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard.moffat at gmail.com Sat Apr 22 16:53:42 2023 From: richard.moffat at gmail.com (Richard Moffat) Date: Sun, 23 Apr 2023 08:53:42 +1200 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: References: Message-ID: Thank you, Ben. This is most useful. I didn't do astronomy in my physics degree (quite some time ago). This has given me a great pointer to read up on. We can consider this question closed unless anyone else has anything else to add. *Noho ora mai,* *All the best,* Richard Moffat. ============================================================== richard.moffat at gmail.com ============================================================== On Sat, 22 Apr 2023 at 23:30, Benjamin Weiner wrote: > Errors in RA/Dec calculations of order several arcminutes are frequently > due to inconsistency in the equinox used. Epoch and equinox are not the > same: epoch is time of observation (important for moving objects), while > equinox is coordinate reference frame, ie where the Earth?s axis is > pointing. The precession from 2000 to 2023 can cause an offset of several > arcminutes. FK5 and ICRS are referred to 2000, but to point an earthbound > telescope in 2023 one also needs equinox of the current time. Any > reference on celestial coordinate systems will give more detail. > > Ben > > On Sat, Apr 22, 2023 at 12:46 PM wrote: > >> Send AstroPy mailing list submissions to >> astropy at python.org >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://mail.python.org/mailman/listinfo/astropy >> or, via email, send a message with subject or body 'help' to >> astropy-request at python.org >> >> You can reach the person managing the list at >> astropy-owner at python.org >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of AstroPy digest..." >> >> >> Today's Topics: >> >> 1. Re: RA/Dec to Alt/Az (Richard Moffat) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Sat, 22 Apr 2023 22:45:22 +1200 >> From: Richard Moffat >> To: Astronomical Python mailing list >> Subject: Re: [AstroPy] RA/Dec to Alt/Az >> Message-ID: >> < >> CA+1X2WFxX2RONmf_8-gaAqsNWKP5jcUT0RS2hTOyYDA-ub4RWw at mail.gmail.com> >> Content-Type: text/plain; charset="utf-8" >> >> Hmm... Replying to my own post :-) >> >> So, looking at the SkyCoord class, it looks like I need to specify a frame >> and possibly the equinox. I'm guessing this has something to do with the >> sidereal time calculation and Julien dates and things. >> >> coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg), frame=FK5, >> equinox=Time(gmt_time_str)) >> >> Now I'm only 2-5 seconds out. >> >> Time to read up more on the parameters. >> >> *Noho ora mai,* >> *All the best,* >> Richard Moffat. >> >> ============================================================== >> >> richard.moffat at gmail.com >> ==============================================================___ >> > _______________________________________________ > 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 Sat Apr 22 17:40:55 2023 From: brewer at astro.umass.edu (Michael Brewer) Date: Sat, 22 Apr 2023 17:40:55 -0400 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: References: Message-ID: You just need to use the equinox of these coordinates is all: # Alpha Centuri ra = '14h41m13.3s' dec = '-60d55m52.3s' Normally it's J2000. On Sat, Apr 22, 2023 at 4:54?PM Richard Moffat wrote: > Thank you, Ben. This is most useful. > > I didn't do astronomy in my physics degree (quite some time ago). This has > given me a great pointer to read up on. > > We can consider this question closed unless anyone else has anything else > to add. > > *Noho ora mai,* > *All the best,* > Richard Moffat. > > ============================================================== > > richard.moffat at gmail.com > ============================================================== > > > > > > > On Sat, 22 Apr 2023 at 23:30, Benjamin Weiner wrote: > >> Errors in RA/Dec calculations of order several arcminutes are frequently >> due to inconsistency in the equinox used. Epoch and equinox are not the >> same: epoch is time of observation (important for moving objects), while >> equinox is coordinate reference frame, ie where the Earth?s axis is >> pointing. The precession from 2000 to 2023 can cause an offset of several >> arcminutes. FK5 and ICRS are referred to 2000, but to point an earthbound >> telescope in 2023 one also needs equinox of the current time. Any >> reference on celestial coordinate systems will give more detail. >> >> Ben >> >> On Sat, Apr 22, 2023 at 12:46 PM wrote: >> >>> Send AstroPy mailing list submissions to >>> astropy at python.org >>> >>> To subscribe or unsubscribe via the World Wide Web, visit >>> https://mail.python.org/mailman/listinfo/astropy >>> >>> or, via email, send a message with subject or body 'help' to >>> astropy-request at python.org >>> >>> You can reach the person managing the list at >>> astropy-owner at python.org >>> >>> When replying, please edit your Subject line so it is more specific >>> than "Re: Contents of AstroPy digest..." >>> >>> >>> Today's Topics: >>> >>> 1. Re: RA/Dec to Alt/Az (Richard Moffat) >>> >>> >>> ---------------------------------------------------------------------- >>> >>> Message: 1 >>> Date: Sat, 22 Apr 2023 22:45:22 +1200 >>> From: Richard Moffat >>> To: Astronomical Python mailing list >>> Subject: Re: [AstroPy] RA/Dec to Alt/Az >>> Message-ID: >>> < >>> CA+1X2WFxX2RONmf_8-gaAqsNWKP5jcUT0RS2hTOyYDA-ub4RWw at mail.gmail.com> >>> Content-Type: text/plain; charset="utf-8" >>> >>> Hmm... Replying to my own post :-) >>> >>> So, looking at the SkyCoord class, it looks like I need to specify a >>> frame >>> and possibly the equinox. I'm guessing this has something to do with the >>> sidereal time calculation and Julien dates and things. >>> >>> coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg), frame=FK5, >>> equinox=Time(gmt_time_str)) >>> >>> Now I'm only 2-5 seconds out. >>> >>> Time to read up more on the parameters. >>> >>> *Noho ora mai,* >>> *All the best,* >>> Richard Moffat. >>> >>> ============================================================== >>> >>> richard.moffat at gmail.com >>> ==============================================================___ >>> >> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy >> >> > _______________________________________________ > 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%7C05201497a7e9443b1a8108db4373bb00%7C7bd08b0b33954dc194bbd0b2e56a497f%7C0%7C0%7C638177936562054812%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WhlzaOg5YlK%2BVAVfGMJ2S5Y747uZGInipl0%2F%2B6QFSz4%3D&reserved=0 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brewer at astro.umass.edu Sat Apr 22 17:57:47 2023 From: brewer at astro.umass.edu (Michael Brewer) Date: Sat, 22 Apr 2023 17:57:47 -0400 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: References: Message-ID: I guess I should explain that. The equinox of the coordinates determines the precession and nutation corrections that are applied to transform from the equinox of the coordinates to the time of the observation. AstroPy defaults to J2000, so the difference you see is either due to the other programs using a different equinox, or perhaps an outdated precession/nutation model. Your location on the surface of the Earth isn't going to matter since you didn't provide a distance and even if you did Alpha Centauri is far enough away that diurnal parallax is insignificant. On Sat, Apr 22, 2023 at 5:40?PM Michael Brewer wrote: > You just need to use the equinox of these coordinates is all: > > # Alpha Centuri > ra = '14h41m13.3s' > dec = '-60d55m52.3s' > > Normally it's J2000. > > > > > On Sat, Apr 22, 2023 at 4:54?PM Richard Moffat > wrote: > >> Thank you, Ben. This is most useful. >> >> I didn't do astronomy in my physics degree (quite some time ago). This >> has given me a great pointer to read up on. >> >> We can consider this question closed unless anyone else has anything else >> to add. >> >> *Noho ora mai,* >> *All the best,* >> Richard Moffat. >> >> ============================================================== >> >> richard.moffat at gmail.com >> ============================================================== >> >> >> >> >> >> >> On Sat, 22 Apr 2023 at 23:30, Benjamin Weiner wrote: >> >>> Errors in RA/Dec calculations of order several arcminutes are frequently >>> due to inconsistency in the equinox used. Epoch and equinox are not the >>> same: epoch is time of observation (important for moving objects), while >>> equinox is coordinate reference frame, ie where the Earth?s axis is >>> pointing. The precession from 2000 to 2023 can cause an offset of several >>> arcminutes. FK5 and ICRS are referred to 2000, but to point an earthbound >>> telescope in 2023 one also needs equinox of the current time. Any >>> reference on celestial coordinate systems will give more detail. >>> >>> Ben >>> >>> On Sat, Apr 22, 2023 at 12:46 PM wrote: >>> >>>> Send AstroPy mailing list submissions to >>>> astropy at python.org >>>> >>>> To subscribe or unsubscribe via the World Wide Web, visit >>>> https://mail.python.org/mailman/listinfo/astropy >>>> >>>> or, via email, send a message with subject or body 'help' to >>>> astropy-request at python.org >>>> >>>> You can reach the person managing the list at >>>> astropy-owner at python.org >>>> >>>> When replying, please edit your Subject line so it is more specific >>>> than "Re: Contents of AstroPy digest..." >>>> >>>> >>>> Today's Topics: >>>> >>>> 1. Re: RA/Dec to Alt/Az (Richard Moffat) >>>> >>>> >>>> ---------------------------------------------------------------------- >>>> >>>> Message: 1 >>>> Date: Sat, 22 Apr 2023 22:45:22 +1200 >>>> From: Richard Moffat >>>> To: Astronomical Python mailing list >>>> Subject: Re: [AstroPy] RA/Dec to Alt/Az >>>> Message-ID: >>>> < >>>> CA+1X2WFxX2RONmf_8-gaAqsNWKP5jcUT0RS2hTOyYDA-ub4RWw at mail.gmail.com> >>>> Content-Type: text/plain; charset="utf-8" >>>> >>>> Hmm... Replying to my own post :-) >>>> >>>> So, looking at the SkyCoord class, it looks like I need to specify a >>>> frame >>>> and possibly the equinox. I'm guessing this has something to do with the >>>> sidereal time calculation and Julien dates and things. >>>> >>>> coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg), frame=FK5, >>>> equinox=Time(gmt_time_str)) >>>> >>>> Now I'm only 2-5 seconds out. >>>> >>>> Time to read up more on the parameters. >>>> >>>> *Noho ora mai,* >>>> *All the best,* >>>> Richard Moffat. >>>> >>>> ============================================================== >>>> >>>> richard.moffat at gmail.com >>>> ==============================================================___ >>>> >>> _______________________________________________ >>> AstroPy mailing list >>> AstroPy at python.org >>> https://mail.python.org/mailman/listinfo/astropy >>> >>> >> _______________________________________________ >> 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%7C05201497a7e9443b1a8108db4373bb00%7C7bd08b0b33954dc194bbd0b2e56a497f%7C0%7C0%7C638177936562054812%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WhlzaOg5YlK%2BVAVfGMJ2S5Y747uZGInipl0%2F%2B6QFSz4%3D&reserved=0 >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From richard.moffat at gmail.com Sat Apr 22 18:08:26 2023 From: richard.moffat at gmail.com (Richard Moffat) Date: Sun, 23 Apr 2023 10:08:26 +1200 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: References: Message-ID: " AstroPy defaults to J2000" <== that. I think you hit the nail on the head there. I think my first attempts were assuming a local time (or GMT with offset) gets carried through the classes. Thank you. *Noho ora mai,* *All the best,* Richard Moffat. ============================================================== richard.moffat at gmail.com ============================================================== On Sun, 23 Apr 2023 at 09:58, Michael Brewer wrote: > I guess I should explain that. The equinox of the coordinates determines > the precession and nutation corrections that are applied to transform from > the equinox of the coordinates to the time of the observation. AstroPy > defaults to J2000, so the difference you see is either due to the other > programs using a different equinox, or perhaps an outdated > precession/nutation model. Your location on the surface of the Earth isn't > going to matter since you didn't provide a distance and even if you did > Alpha Centauri is far enough away that diurnal parallax is insignificant. > > On Sat, Apr 22, 2023 at 5:40?PM Michael Brewer > wrote: > >> You just need to use the equinox of these coordinates is all: >> >> # Alpha Centuri >> ra = '14h41m13.3s' >> dec = '-60d55m52.3s' >> >> Normally it's J2000. >> >> >> >> >> On Sat, Apr 22, 2023 at 4:54?PM Richard Moffat >> wrote: >> >>> Thank you, Ben. This is most useful. >>> >>> I didn't do astronomy in my physics degree (quite some time ago). This >>> has given me a great pointer to read up on. >>> >>> We can consider this question closed unless anyone else has anything >>> else to add. >>> >>> *Noho ora mai,* >>> *All the best,* >>> Richard Moffat. >>> >>> ============================================================== >>> >>> richard.moffat at gmail.com >>> ============================================================== >>> >>> >>> >>> >>> >>> >>> On Sat, 22 Apr 2023 at 23:30, Benjamin Weiner >>> wrote: >>> >>>> Errors in RA/Dec calculations of order several arcminutes are >>>> frequently due to inconsistency in the equinox used. Epoch and equinox are >>>> not the same: epoch is time of observation (important for moving objects), >>>> while equinox is coordinate reference frame, ie where the Earth?s axis is >>>> pointing. The precession from 2000 to 2023 can cause an offset of several >>>> arcminutes. FK5 and ICRS are referred to 2000, but to point an earthbound >>>> telescope in 2023 one also needs equinox of the current time. Any >>>> reference on celestial coordinate systems will give more detail. >>>> >>>> Ben >>>> >>>> On Sat, Apr 22, 2023 at 12:46 PM wrote: >>>> >>>>> Send AstroPy mailing list submissions to >>>>> astropy at python.org >>>>> >>>>> To subscribe or unsubscribe via the World Wide Web, visit >>>>> https://mail.python.org/mailman/listinfo/astropy >>>>> >>>>> or, via email, send a message with subject or body 'help' to >>>>> astropy-request at python.org >>>>> >>>>> You can reach the person managing the list at >>>>> astropy-owner at python.org >>>>> >>>>> When replying, please edit your Subject line so it is more specific >>>>> than "Re: Contents of AstroPy digest..." >>>>> >>>>> >>>>> Today's Topics: >>>>> >>>>> 1. Re: RA/Dec to Alt/Az (Richard Moffat) >>>>> >>>>> >>>>> ---------------------------------------------------------------------- >>>>> >>>>> Message: 1 >>>>> Date: Sat, 22 Apr 2023 22:45:22 +1200 >>>>> From: Richard Moffat >>>>> To: Astronomical Python mailing list >>>>> Subject: Re: [AstroPy] RA/Dec to Alt/Az >>>>> Message-ID: >>>>> < >>>>> CA+1X2WFxX2RONmf_8-gaAqsNWKP5jcUT0RS2hTOyYDA-ub4RWw at mail.gmail.com> >>>>> Content-Type: text/plain; charset="utf-8" >>>>> >>>>> Hmm... Replying to my own post :-) >>>>> >>>>> So, looking at the SkyCoord class, it looks like I need to specify a >>>>> frame >>>>> and possibly the equinox. I'm guessing this has something to do with >>>>> the >>>>> sidereal time calculation and Julien dates and things. >>>>> >>>>> coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg), frame=FK5, >>>>> equinox=Time(gmt_time_str)) >>>>> >>>>> Now I'm only 2-5 seconds out. >>>>> >>>>> Time to read up more on the parameters. >>>>> >>>>> *Noho ora mai,* >>>>> *All the best,* >>>>> Richard Moffat. >>>>> >>>>> ============================================================== >>>>> >>>>> richard.moffat at gmail.com >>>>> ==============================================================___ >>>>> >>>> _______________________________________________ >>>> AstroPy mailing list >>>> AstroPy at python.org >>>> https://mail.python.org/mailman/listinfo/astropy >>>> >>>> >>> _______________________________________________ >>> 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%7C05201497a7e9443b1a8108db4373bb00%7C7bd08b0b33954dc194bbd0b2e56a497f%7C0%7C0%7C638177936562054812%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WhlzaOg5YlK%2BVAVfGMJ2S5Y747uZGInipl0%2F%2B6QFSz4%3D&reserved=0 >>> >> _______________________________________________ > 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 Sat Apr 22 18:28:26 2023 From: brewer at astro.umass.edu (Michael Brewer) Date: Sat, 22 Apr 2023 18:28:26 -0400 Subject: [AstroPy] RA/Dec to Alt/Az In-Reply-To: References: Message-ID: No, the time that you set into obstime is the date of the observation (epoch), not the equinox that the RA/Dec coordinates are referred to. If you want to convert apparent rather than astrometrc RA/Dec coordinates to AltAz, then you should set up a True Equinox True Equator of date (TETE) frame for your RA/Dec coordinates. On Sat, Apr 22, 2023 at 6:08?PM Richard Moffat wrote: > " AstroPy defaults to J2000" <== that. I think you hit the nail on the > head there. I think my first attempts were assuming a local time (or GMT > with offset) gets carried through the classes. > > Thank you. > > *Noho ora mai,* > *All the best,* > Richard Moffat. > > ============================================================== > > richard.moffat at gmail.com > ============================================================== > > > > > > > On Sun, 23 Apr 2023 at 09:58, Michael Brewer > wrote: > >> I guess I should explain that. The equinox of the coordinates determines >> the precession and nutation corrections that are applied to transform from >> the equinox of the coordinates to the time of the observation. AstroPy >> defaults to J2000, so the difference you see is either due to the other >> programs using a different equinox, or perhaps an outdated >> precession/nutation model. Your location on the surface of the Earth isn't >> going to matter since you didn't provide a distance and even if you did >> Alpha Centauri is far enough away that diurnal parallax is insignificant. >> >> On Sat, Apr 22, 2023 at 5:40?PM Michael Brewer >> wrote: >> >>> You just need to use the equinox of these coordinates is all: >>> >>> # Alpha Centuri >>> ra = '14h41m13.3s' >>> dec = '-60d55m52.3s' >>> >>> Normally it's J2000. >>> >>> >>> >>> >>> On Sat, Apr 22, 2023 at 4:54?PM Richard Moffat >>> wrote: >>> >>>> Thank you, Ben. This is most useful. >>>> >>>> I didn't do astronomy in my physics degree (quite some time ago). This >>>> has given me a great pointer to read up on. >>>> >>>> We can consider this question closed unless anyone else has anything >>>> else to add. >>>> >>>> *Noho ora mai,* >>>> *All the best,* >>>> Richard Moffat. >>>> >>>> ============================================================== >>>> >>>> richard.moffat at gmail.com >>>> ============================================================== >>>> >>>> >>>> >>>> >>>> >>>> >>>> On Sat, 22 Apr 2023 at 23:30, Benjamin Weiner >>>> wrote: >>>> >>>>> Errors in RA/Dec calculations of order several arcminutes are >>>>> frequently due to inconsistency in the equinox used. Epoch and equinox are >>>>> not the same: epoch is time of observation (important for moving objects), >>>>> while equinox is coordinate reference frame, ie where the Earth?s axis is >>>>> pointing. The precession from 2000 to 2023 can cause an offset of several >>>>> arcminutes. FK5 and ICRS are referred to 2000, but to point an earthbound >>>>> telescope in 2023 one also needs equinox of the current time. Any >>>>> reference on celestial coordinate systems will give more detail. >>>>> >>>>> Ben >>>>> >>>>> On Sat, Apr 22, 2023 at 12:46 PM wrote: >>>>> >>>>>> Send AstroPy mailing list submissions to >>>>>> astropy at python.org >>>>>> >>>>>> To subscribe or unsubscribe via the World Wide Web, visit >>>>>> https://mail.python.org/mailman/listinfo/astropy >>>>>> >>>>>> or, via email, send a message with subject or body 'help' to >>>>>> astropy-request at python.org >>>>>> >>>>>> You can reach the person managing the list at >>>>>> astropy-owner at python.org >>>>>> >>>>>> When replying, please edit your Subject line so it is more specific >>>>>> than "Re: Contents of AstroPy digest..." >>>>>> >>>>>> >>>>>> Today's Topics: >>>>>> >>>>>> 1. Re: RA/Dec to Alt/Az (Richard Moffat) >>>>>> >>>>>> >>>>>> ---------------------------------------------------------------------- >>>>>> >>>>>> Message: 1 >>>>>> Date: Sat, 22 Apr 2023 22:45:22 +1200 >>>>>> From: Richard Moffat >>>>>> To: Astronomical Python mailing list >>>>>> Subject: Re: [AstroPy] RA/Dec to Alt/Az >>>>>> Message-ID: >>>>>> < >>>>>> CA+1X2WFxX2RONmf_8-gaAqsNWKP5jcUT0RS2hTOyYDA-ub4RWw at mail.gmail.com> >>>>>> Content-Type: text/plain; charset="utf-8" >>>>>> >>>>>> Hmm... Replying to my own post :-) >>>>>> >>>>>> So, looking at the SkyCoord class, it looks like I need to specify a >>>>>> frame >>>>>> and possibly the equinox. I'm guessing this has something to do with >>>>>> the >>>>>> sidereal time calculation and Julien dates and things. >>>>>> >>>>>> coord = SkyCoord(ra, dec, unit=(u.hourangle, u.deg), frame=FK5, >>>>>> equinox=Time(gmt_time_str)) >>>>>> >>>>>> Now I'm only 2-5 seconds out. >>>>>> >>>>>> Time to read up more on the parameters. >>>>>> >>>>>> *Noho ora mai,* >>>>>> *All the best,* >>>>>> Richard Moffat. >>>>>> >>>>>> ============================================================== >>>>>> >>>>>> richard.moffat at gmail.com >>>>>> ==============================================================___ >>>>>> >>>>> _______________________________________________ >>>>> AstroPy mailing list >>>>> AstroPy at python.org >>>>> https://mail.python.org/mailman/listinfo/astropy >>>>> >>>>> >>>> _______________________________________________ >>>> 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%7C05201497a7e9443b1a8108db4373bb00%7C7bd08b0b33954dc194bbd0b2e56a497f%7C0%7C0%7C638177936562054812%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WhlzaOg5YlK%2BVAVfGMJ2S5Y747uZGInipl0%2F%2B6QFSz4%3D&reserved=0 >>>> >>>> >>> _______________________________________________ >> AstroPy mailing list >> AstroPy at python.org >> https://mail.python.org/mailman/listinfo/astropy >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony.willis.research at gmail.com Sat Apr 22 20:28:16 2023 From: tony.willis.research at gmail.com (Tony Willis) Date: Sat, 22 Apr 2023 17:28:16 -0700 Subject: [AstroPy] RA/Dec to Alt/Az Message-ID: <2f2067a3-a83f-afbc-138d-e4f4b997c49d@gmail.com> Well, this is how I do this for Radio Source 3C147. I will leave this as an 'exercise for the student' to convert to other objects, times etc. The azimuth and elevation (altitude) should be accurate to about 0.5 arcsec or so. from astropy.coordinates import ICRS from astropy.coordinates import EarthLocation, AltAz from astropy import units as u from astropy.time import Time # 3C 147? position 05 42 36.265 +49 51 07.08? ...? J2000 position from Simbad - I could probably avoid the following two lines by specifying directly in SkyCoord source_ra_deg = 180.0 * (5.0 + 42.0/60 + 36.265 / 3600) / 12.0 source_dec_deg = (49.0 + 51.0/60 + 07.08/3600) print('3C147 J2000 ra and dec in deg ', source_ra_deg, source_dec_deg) start_mjd = 58230.0??? # Modified Julian Date # following location is for the DRAO DVA1 radio telescope drao = EarthLocation(lon=-119.630186*u.deg,lat=49.3184206*u.deg,height=536.164941*u.m) ThreeC147 = ICRS(ra=source_ra_deg*u.deg, dec= source_dec_deg*u.deg) t = Time(start_mjd, format='mjd', location=drao) t.ut1? # causes update of IERS (?) parameters # use ICRS coordinates to transform to Az / El ThreeC147_altaz = ThreeC147.transform_to(AltAz(obstime=t,location=drao)) print('astropy 3C147 az and elev deg', ThreeC147_altaz.az.deg, ThreeC147_altaz.alt.deg)