diff --git a/tests/modules/telescope/test_basetelescope.py b/tests/modules/telescope/test_basetelescope.py index 1638f416..0748d640 100644 --- a/tests/modules/telescope/test_basetelescope.py +++ b/tests/modules/telescope/test_basetelescope.py @@ -1,18 +1,18 @@ import numpy as np +from astroplan import Observer +import astropy.units as u + from pyobs.modules.telescope import DummyTelescope from pyobs.utils.time import Time -def test_get_derotator_offset_from_header(): +def test_calculate_derotator_position(): telescope = DummyTelescope() + telescope.observer = Observer(latitude=-32.375823 * u.deg, longitude=20.8108079 * u.deg, elevation=1798.0 * u.m) obstime = Time("2024-03-21T20:11:52.281735") - hdr = { - "LATITUDE": (-32.375823, None), - "LONGITUD": (20.810807999999998, None), - "HEIGHT": (1798.0000000004793, None), - "TEL-RA": (138.01290730636728, None), - "TEL-DEC": (-64.86351112618202, None), - "TEL-ROT": (-138.68173828124998, None), - "TEL-ALT": (57.24036032917521, None), - } - np.testing.assert_almost_equal(telescope._get_derotator_offset_from_header(hdr, obstime), 90.22, decimal=2) + ra = 138.01290730636728 + dec = -64.86351112618202 + tel_rot = -138.68173828124998 + alt = 57.24036032917521 + derot = telescope._calculate_derotator_position(ra, dec, alt, obstime) + np.testing.assert_almost_equal(derot - tel_rot, 90.22, decimal=2)