[AstroPy] Telescope pointing with astropy, atmospheric refraction and precession

Russell Valentine russell.valentine at gmail.com
Mon Nov 30 12:49:16 EST 2020


https://gist.github.com/bluthen/8a07259413647b69e045733e97ae9949

I also added a function for hadec_to_icrs. Not sure if these conversions 
are valid for all cases but seems to give good results in my limited tests.

I'm excited, thanks again!


Russell Valentine

On 11/29/20 3:37 PM, Russell Valentine wrote:
> My attempt at a simple HaDec frame and converting ICRS to HA-DEC based 
> on icrs_observed.py:
>
> https://gist.github.com/bluthen/8a07259413647b69e045733e97ae9949
>
> It looks like it gives pretty good results. Thank you for the help!
>
>
> Russell Valentine
>
>
> On 11/28/20 12:29 PM, Russell Valentine wrote:
>> Yes, correct I do want HA-Dec frame.
>>
>> I had been trying to do that on my own, but it was pretty convoluted. 
>> My current procedure was (psudocode):
>>
>> side_real_time = AltAz(90,0, location, time).to(ICRS).ra
>> altaz = my_orig_coord.to(AltAz(location, pressure, time))
>> # Make new altaz without pressure and go back to icrs for
>> # refraction adjusted ra/dec
>> adjusted_icrs = AltAz(altaz.alot, altaz.az, location, time).to(ICRS)
>> adjusted_icrs = ICRS(side_real_time - adjusted_icrs.ra, 
>> adjusted_icrs.dec)
>>
>> And then use adjusted_icrs.ra and adjusted_icrs.dec as telescope HA-DEC.
>>
>> It was not clear to me if the altaz frame took into account 
>> precession. Maybe that happens when converting to topocentric CIRS.
>>
>> Thank you for the reply and suggestion to look at icrs_observed.py I 
>> will do that, and try to learn more about these different coordinate 
>> systems.
>>
>>
>> Russell Valentine
>>
>> On 11/28/20 2:53 AM, Stuart P Littlefair wrote:
>>> Hi Russel
>>>
>>> You are correct that TETE does not include atmospheric refraction. 
>>> What you want is an HA-Dec frame.
>>>
>>> It does not exist within astropy yet, but is on the roadmap for the 
>>> near future.
>>>
>>> If you want something to work in the meantime, you could look at the 
>>> code in coordinates/builtin_frames/icrs_observed.py in the current 
>>> master branch on GitHub.
>>>
>>> This file contains the transforms from ICRS to AltAz and you will 
>>> see that it actually calculates the HA as part of the function!
>>>
>>> You could simply copy this function and return HA and Dec instead of 
>>> Alt and Az.
>>>
>>> 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 28 Nov 2020, at 06:46, Russell Valentine 
>>>> <russell.valentine at gmail.com> wrote:
>>>>
>>>> Thank you for your reply Eric. I do not think TETE can take a 
>>>> equinox parameter. I know FK5 has one. I do see what I think is 
>>>> precession corrections when I go from ICRS to TETE, however I do 
>>>> not think TETE does atmospheric refraction as well.
>>>>
>>>> https://docs.astropy.org/en/stable/api/astropy.coordinates.builtin_frames.TETE.html#astropy.coordinates.builtin_frames.TETE 
>>>>
>>>>
>>>>
>>>>>>> tete = icrs.transform_to(TETE(obstime=t, 
>>>>>>> location=earth_location, equinox=t))
>>>> Traceback (most recent call last):
>>>>   File "<stdin>", line 1, in <module>
>>>>   File 
>>>> "/home/russ/.local/share/virtualenvs/server-zkliv1pZ/lib/python3.7/site-packages/astropy/coordinates/baseframe.py", 
>>>> line 609, in __init__
>>>>     list(kwargs)))
>>>> TypeError: Coordinate frame got unexpected keywords: ['equinox']
>>>>
>>>>
>>>>> On 11/27/20 8:24 PM, Eric Jensen wrote:
>>>>> Hi Russell,
>>>>> I think the thing you’re missing may be the ‘equinox’ argument to 
>>>>> the ’transform_to’ call.  I believe that ‘obstime’ sets the time 
>>>>> of your observation for calculating alt/az (and may also be used 
>>>>> as the reference date for applying proper motion corrections if 
>>>>> you do that), but I don’t think it sets the date for the equinox 
>>>>> used for your coordinate system.  Try adding ‘equinox=t’ to your 
>>>>> transformations between ICRS and TETE and see if that helps.    (I 
>>>>> can’t test here because conda channels haven’t caught up with the 
>>>>> 4.2 release yet, so I don’t have TETE in my installation.)
>>>>> Best,
>>>>> Eric
>>>>>>> On Nov 27, 2020, at 4:20 PM, Russell Valentine 
>>>>>>> <russell.valentine at gmail.com> wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I've been trying to figure out the best way to get correct 
>>>>>> coordinates for telescope pointing of a equatorial mount in 
>>>>>> astropy. How to, given a set of coordinates in ICRS, convert it 
>>>>>> to account for precession and atmosphereic refraction to 
>>>>>> correctly move the telescope. It is my understand that you can 
>>>>>> transform from ICRS to TETE to compensate for precession, but 
>>>>>> then how to also account for atmospheric refraction? I believe 
>>>>>> the AltAz coordinate is needed for that.
>>>>>>
>>>>>> Things I was thinking and tried:
>>>>>>
>>>>>> 1) ICRS->AltAz (w/pressure)->TETE
>>>>>> I do not know if this is correct because you get just very close 
>>>>>> to just ICRS. I thought maybe it is right and the refraction just 
>>>>>> happens to be the counter the precession, but I tried it on both 
>>>>>> east and west horizons with the same result.
>>>>>>
>>>>>> 2) ICRS->TETE->AltAz(w/pressure)
>>>>>>
>>>>>> But as expected AltAz is the same as ICRS->AltAz
>>>>>>
>>>>>> I feel like I am missing some key piece. Has anyone done this 
>>>>>> with astropy?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> from astropy.coordinates import EarthLocation, TETE, ICRS, AltAz, 
>>>>>> SkyCoord
>>>>>> import astropy.units as u
>>>>>> from astropy.time import Time as AstroTime
>>>>>> from astropy.units import si as usi
>>>>>> t = AstroTime('2020-11-27 19:12:16.894431')
>>>>>> earth_location = EarthLocation(lat=38.9369*u.deg, lon= 
>>>>>> -95.242*u.deg, height=266.0*u.m)
>>>>>> # East horizon object
>>>>>> icrs = ICRS(ra=346.23611667*u.deg, dec=12.32287778*u.deg)
>>>>>> pressure = 98170.13549857 * u.Pa
>>>>>> altaz = icrs.transform_to(AltAz(obstime=t, 
>>>>>> location=earth_location, pressure=pressure))
>>>>>> tete = icrs.transform_to(TETE(obstime=t, location=earth_location))
>>>>>> tete_from_altaz = altaz.transform_to(TETE())
>>>>>>
>>>>>> # West horizon object
>>>>>> icrs2 = ICRS(ra=172.53106667*u.deg, dec=9.27663056*u.deg)
>>>>>> altaz2 = icrs2.transform_to(AltAz(obstime=t, 
>>>>>> location=earth_location, pressure=pressure))
>>>>>> tete2 = icrs2.transform_to(TETE(obstime=t, location=earth_location))
>>>>>> tete2_from_altaz2 = altaz2.transform_to(TETE())
>>>>>>
>>>>>>
>>>>>> altaz_from_tete = tete_from_altaz.transform_to(AltAz(obstime=t, 
>>>>>> location=earth_location, pressure=pressure))
>>>>>> _______________________________________________
>>>>>> 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
>>> _______________________________________________
>>> AstroPy mailing list
>>> AstroPy at python.org
>>> https://mail.python.org/mailman/listinfo/astropy
>>>


More information about the AstroPy mailing list