<jupyter_start><jupyter_text>examples of converting between az/el to sky position https://docs.astropy.org/en/stable/coordinates/index.html 1/10/22 jpw<jupyter_code>from astropy import units as u
from astropy.time import Time
from datetime import datetime
from astropy.coordinates import SkyCoord, EarthLocation, AltAz, get_sun
# enter your observing location and time here
here = EarthLocation(lat=21.3036944*u.deg, lon=-157.8116667*u.deg, height=372*u.m)
now = '2022-01-07 21:00'
now = Time(datetime.now(), scale='utc') + 10*u.hour<jupyter_output><empty_output><jupyter_text>convert from telescope azimuth and elevation (altitude) to sky position in galactic coordinates<jupyter_code>`alt = 45
az = 45
c = SkyCoord(alt=alt, az=az, frame='altaz', unit='deg', obstime=Time(now, scale='utc'), location=here)
gal = c.galactic
print('l = {0:5.1f}, b = {1:4.1f}'.format(gal.l, gal.b))<jupyter_output>l = 120.0 deg, b = -16.6 deg<jupyter_text>tells you where to point the telescope to observe a given galactic sky position<jupyter_code>l = 30.0
b = 0.0
c = SkyCoord(l, b, frame='galactic', unit='deg')
altaz = c.transform_to(AltAz(obstime=Time(now, scale='utc'), location=here))
print('Azimuth = {0:4.1f}, Elevation = {1:5.1f}'.format(altaz.az, altaz.alt))
# good position for cold calibration (weak HI)
l_cold = 150.0
b_cold = 55.0
c = SkyCoord(l, b, frame='galactic', unit='deg')
altaz = c.transform_to(AltAz(obstime=Time(now, scale='utc'), location=here))
print('Azimuth = {0:4.1f}, Elevation = {1:5.1f}'.format(altaz.az, altaz.alt))<jupyter_output>Azimuth = 244.3 deg, Elevation =  43.3 deg<jupyter_text>tells you where to point the telescope to observe a given equatorial sky position<jupyter_code>c = SkyCoord.from_name('Orion', frame='icrs')
altaz = c.transform_to(AltAz(obstime=Time(now, scale='utc'), location=here))
print('Azimuth = {0:4.1f}, Elevation = {1:5.1f}'.format(altaz.az, altaz.alt))
# in this example, Orion is below the horizon and can't be observed at this time!<jupyter_output>Azimuth = 83.3 deg, Elevation = -31.1 deg
{'fraction_non_alphanumeric': 0.15169366715758467, 'fraction_numerical': 0.04958271968581247, 'mean_word_length': 6.150877192982456, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '306215', 'license': 'MIT', 'n_tokens_mistral': 838, 'n_tokens_neox': 765, 'n_words': 188, 'path': 'notebooks/coordinate_conversion.ipynb', 'repo_name': 'interstellarmedium/HI_telescope', 'size': '2037'}