Skip to content

Commit

Permalink
update test_field_dependent_psfs()
Browse files Browse the repository at this point in the history
  • Loading branch information
JarronL committed Feb 7, 2024
1 parent 15bf2ed commit 944c75b
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions webbpsf_ext/tests/test_webbpsf_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,35 +46,25 @@ def test_load_psf_coeffs(filter, nrc_f335m_wext):
assert nrc._psf_coeff_mod['wfe_drift'] is not None

@pytest.mark.parametrize("xsci, ysci", [(1771,278), (1474,573), (1174,870), (264,1768)])
def test_field_dependent_psfs(xsci, ysci, nrc_f335m_coeffs_cached, nrc_f335m_webbpsf):
def test_field_dependent_psfs(xsci, ysci, nrc_f335m_coeffs_cached):

# WebbPSF PSF at 'sci' coordinates
nrc0 = nrc_f335m_webbpsf
nrc1 = nrc_f335m_coeffs_cached

nrc0.detector_position = (xsci, ysci)
fov_pix = nrc1.fov_pix
osamp = nrc1.oversample
psf0 = nrc0.calc_psf(source=sp_vega, fov_pixels=fov_pix, oversample=osamp)

# WebbPSF Extended PSF at 'sci' coordinates, native and using coefficients
psf1 = nrc1.calc_psf(sp=sp_vega, return_oversample=False,
coord_vals=(xsci, ysci), coord_frame='sci')
psf2 = nrc1.calc_psf_from_coeff(sp=sp_vega, return_oversample=False,
coord_vals=(xsci, ysci), coord_frame='sci')

# Compare PSFs
arr0 = normalize_psf(psf0[3].data)
arr1 = normalize_psf(psf1[3].data)
arr2 = normalize_psf(psf2[0].data)

diff1 = arr0-arr1
diff2 = arr1-arr2

print("Min/Max:", np.min(diff1), np.max(diff1))
print("Min/Max:", np.min(diff2), np.max(diff2))

assert np.allclose(arr0, arr1, atol=0.001)
assert np.allclose(arr1, arr2, atol=0.001)


Expand Down

0 comments on commit 944c75b

Please sign in to comment.