Skip to content

Commit

Permalink
Updates for astropy 6.
Browse files Browse the repository at this point in the history
  • Loading branch information
schlafly committed Apr 18, 2024
1 parent fa29a9b commit 3463e31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions py/desisurvey/test/test_utils.py
Expand Up @@ -35,12 +35,12 @@ def test_get_observer_to_sky(self):
alt, az = self.table['alt'], self.table['az']
when = astropy.time.Time(self.table['jd'], format='jd')
obs = utils.get_observer(when, alt * u.deg, az * u.deg)
obs_sky = obs.transform_to(astropy.coordinates.ICRS)
obs_sky = obs.transform_to(astropy.coordinates.ICRS())
true_sky = astropy.coordinates.ICRS(ra=ra * u.deg, dec=dec * u.deg)
sep = true_sky.separation(obs_sky).to(u.arcsec).value
# Opening angle between true and observed (ra,dec) unit vectors
# must be within 30 arcsec.
self.assertTrue(np.max(np.fabs(sep)) < 30)
# must be within 40 arcsec.
self.assertTrue(np.max(np.fabs(sep)) < 40)

def test_get_observer_from_sky(self):
"""Check (alt,az) -> (ra,dec) against JPL Horizons"""
Expand All @@ -52,8 +52,8 @@ def test_get_observer_from_sky(self):
obs_altaz = sky.transform_to(utils.get_observer(when))
sep = true_altaz.separation(obs_altaz).to(u.arcsec).value
# Opening angle between true and observed (alt,az) unit vectors
# must be within 30 arcsec.
self.assertTrue(np.max(np.fabs(sep)) < 30)
# must be within 40 arcsec.
self.assertTrue(np.max(np.fabs(sep)) < 40)

def test_get_observer_args(self):
"""Must provide both alt and az to get_observer()"""
Expand Down
2 changes: 1 addition & 1 deletion py/desisurvey/utils.py
Expand Up @@ -131,7 +131,7 @@ def get_airmass(when, ra, dec):
"""
target = astropy.coordinates.ICRS(ra=ra, dec=dec)
zenith = get_observer(when, alt=90 * u.deg, az=0 * u.deg
).transform_to(astropy.coordinates.ICRS)
).transform_to(astropy.coordinates.ICRS())
# Calculate zenith angle in degrees.
zenith_angle = target.separation(zenith)
# Convert to airmass.
Expand Down

0 comments on commit 3463e31

Please sign in to comment.