Skip to content

Commit

Permalink
Small correction to unit tests for getPSF()
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico Berlfein committed Jun 18, 2024
1 parent 58c9262 commit 4f45d4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions euclidlike/euclidlike_psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def getPSF(
ccd, bandpass,
ccd_pos=None, wcs=None,
wavelength=None, gsparams=None,
logger=None
logger=None, stepk = None, maxk = None
):
"""Get a single PSF for Euclid like simulation.
Expand Down Expand Up @@ -130,7 +130,7 @@ def getPSF(
)

# Now get psf model
psf = _get_single_psf_obj(ccd, bandpass, ccd_pos, wavelength, gsparams)
psf = _get_single_psf_obj(ccd, bandpass, ccd_pos, wavelength, gsparams, stepk, maxk)
# Apply WCS.
# The current version is in arcsec units, but oriented parallel to the
# image coordinates. So to apply the right WCS, project to pixels using the
Expand All @@ -143,7 +143,7 @@ def getPSF(
return psf


def _get_single_psf_obj(ccd, bandpass, ccd_pos, wavelength, gsparams):
def _get_single_psf_obj(ccd, bandpass, ccd_pos, wavelength, gsparams, stepk = None, maxk = None):
"""
Routine for making a single PSF. This gets called by `getPSF` after it
parses all the options that were passed in. Users will not directly
Expand All @@ -152,7 +152,7 @@ def _get_single_psf_obj(ccd, bandpass, ccd_pos, wavelength, gsparams):

wave_list, im_list = get_euclid_wavelength_psf()
# instantiate psf object from list of images and wavelengths
psf_obj = galsim.InterpolatedChromaticObject.from_images(im_list, wave_list)
psf_obj = galsim.InterpolatedChromaticObject.from_images(im_list, wave_list, _force_stepk = stepk, _force_maxk = maxk)
if wavelength is not None:
if isinstance(wavelength, galsim.Bandpass):
wave = wavelength.effective_wavelength
Expand Down
4 changes: 2 additions & 2 deletions tests/test_psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_get_psf_function():

# creating narrow SED at desired wavelength
x = np.linspace(euc_bp.blue_limit, euc_bp.red_limit, 500)
x[285] = wave #index 185 roughly corresponds to this wavelength, manually setting
x[285] = wave #index 285 roughly corresponds to this wavelength, manually setting
f = np.full(len(x), 1e-30)
f[285] = 100
lk_table = galsim.LookupTable(x = x, f = f)
Expand All @@ -75,7 +75,7 @@ def test_get_psf_function():
true_img = true_obj.drawImage(euc_bp, scale=scale)
# images identicial within 0.01% of total flux
np.testing.assert_allclose(
psf_img.array, true_img.array, atol=1e-5*np.sum(true_img.array),
psf_img.array, true_img.array, atol=1e-4*np.sum(true_img.array),
err_msg='getPSF() does replicate image with very narrow SED centered at desired wavelength')
return

Expand Down

0 comments on commit 4f45d4f

Please sign in to comment.