Skip to content

Commit

Permalink
Cleaning up test
Browse files Browse the repository at this point in the history
  • Loading branch information
kartographer authored and steven-murray committed Jul 28, 2023
1 parent 2853791 commit b8e3774
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions pyuvdata/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4103,12 +4103,10 @@ def test_determine_rect_time_first():
assert not is_rect


@pytest.mark.parametrize("lat", [-1.0, -0.5, 0, 0.5, 1.0])
@pytest.mark.parametrize("time_past_zenith", [-1 * un.hour, 0 * un.hour, 1 * un.hour])
def test_calc_app_coords(lat, time_past_zenith):
def test_calc_app_coords_time_obj():
# Generate ra/dec of zenith at time in the phase_frame coordinate system
# to use for phasing
telescope_location = EarthLocation.from_geodetic(lon=0, lat=lat * un.rad)
telescope_location = EarthLocation.from_geodetic(lon=0, lat=1 * un.rad)

# JD is arbitrary
jd = 2454600
Expand All @@ -4122,18 +4120,17 @@ def test_calc_app_coords(lat, time_past_zenith):
)
zenith_coord = zenith_coord.transform_to("icrs")

obstime = zenith_coord.obstime + time_past_zenith
obstime = Time(jd + (np.array([-1, 0, 1]) / 24.0), format="jd")

ra = zenith_coord.ra.to_value("rad")
dec = zenith_coord.dec.to_value("rad")
app_ra, app_dec = uvutils.calc_app_coords(
app_ra_to, app_dec_to = uvutils.calc_app_coords(
ra, dec, time_array=obstime, telescope_loc=telescope_location
)
print(app_ra)
print(app_dec)
print(ra)
print(dec)
print(obstime)
print(telescope_location)
assert np.isclose(app_ra, ra, atol=0.02) # give it 1 degree wiggle room.
assert np.isclose(app_dec, dec, atol=0.02)

app_ra_nto, app_dec_nto = uvutils.calc_app_coords(
ra, dec, time_array=obstime.utc.jd, telescope_loc=telescope_location
)

assert np.allclose(app_ra_to, app_ra_nto)
assert np.allclose(app_dec_to, app_dec_nto)

0 comments on commit b8e3774

Please sign in to comment.