def test_returns_almost_zero_for_zenith_atmospheric_dispersion(self): ad_zenith = eo._atmospheric_dispersion(airmass=1.) shifts = fm_utils.get_3d_shifts([ad_zenith], pixel_scale=0.004, sub_pixel_fraction=1) assert np.all(shifts["x_shifts"] == 0) assert np.all(shifts["y_shifts"] == 0)
def test_combined_shifts_reduced_to_usable_number(self, sub_pix_frac): ad_am_1_05 = eo._atmospheric_dispersion(airmass=1.05) ad_am_neg_1_04 = eo._atmospheric_dispersion(airmass=-1.04) shifts = fm_utils.get_3d_shifts([ad_am_1_05, ad_am_neg_1_04], pixel_scale=0.004, sub_pixel_fraction=sub_pix_frac) assert len(shifts["y_shifts"]) == approx(10 / sub_pix_frac, rel=0.2)
def test_shift_transferred_to_x_axis_for_90_deg_pupil_angle(self): ad_am_1_05 = eo._atmospheric_dispersion(airmass=1.05, pupil_angle=90) shifts = fm_utils.get_3d_shifts([ad_am_1_05], pixel_scale=0.004, sub_pixel_fraction=1) assert np.interp(0, shifts["x_shifts"][::-1], shifts["wavelengths"][::-1]) == pytest.approx(1.5) assert np.all(shifts["y_shifts"] == 0)
def test_returns_non_zero_entries_for_off_zenith(self): ad_am_1_14 = eo._atmospheric_dispersion() shifts = fm_utils.get_3d_shifts([ad_am_1_14], pixel_scale=0.004, sub_pixel_fraction=1) assert np.all(shifts["x_shifts"] == 0) assert np.interp(0, shifts["y_shifts"][::-1], shifts["wavelengths"][::-1]) == pytest.approx(1.5)
def test_returns_zeros_when_no_shift3d_effects_passed(self): shifts = fm_utils.get_3d_shifts([], wave_min=0.7, wave_max=3, pixel_scale=0.004, sub_pixel_fraction=1) assert np.all(shifts["x_shifts"] == 0) assert np.all(shifts["y_shifts"] == 0)
def test_shifts_cancel_out_when_equal_and_opposite(self): ad_am_1_05 = eo._atmospheric_dispersion(airmass=1.05) ad_am_neg_1_05 = eo._atmospheric_dispersion(airmass=-1.05) shifts = fm_utils.get_3d_shifts([ad_am_1_05, ad_am_neg_1_05], pixel_scale=0.004, sub_pixel_fraction=1) assert len(shifts["y_shifts"]) == 2 assert np.min(shifts["wavelengths"]) == ad_am_1_05.meta["wave_min"] assert np.max(shifts["wavelengths"]) == ad_am_1_05.meta["wave_max"]