Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 13, 2024
1 parent 616b00d commit 6385e58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lenstronomy/Data/psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ def kernel_point_source_supersampled(self, supersampling_factor, updata_cache=Tr
):
kernel_point_source_supersampled = self._kernel_point_source_supersampled
return kernel_point_source_supersampled
if hasattr(self, "_kernel_point_source_init") and hasattr(self, "_point_source_supersampling_factor_init"):
if hasattr(self, "_kernel_point_source_init") and hasattr(
self, "_point_source_supersampling_factor_init"
):
if self._point_source_supersampling_factor_init == supersampling_factor:
kernel_point_source_supersampled = self._kernel_point_source_init
return kernel_point_source_supersampled
Expand Down
14 changes: 9 additions & 5 deletions test/test_Data/test_psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,17 @@ def test_supersampling_repeated(self):
"kernel_point_source": kernel_point_source_subsampled,
"point_source_supersampling_factor": subsampling_res,
"kernel_point_source_normalisation": False,

}
psf = PSF(**kwargs_pixel_subsampled)
kernel_supersampled_new = psf.kernel_point_source_supersampled(supersampling_factor=subsampling_res - 1,
updata_cache=True)
kernel_supersampled_origin = psf.kernel_point_source_supersampled(supersampling_factor=subsampling_res)
npt.assert_almost_equal(kernel_supersampled_origin, kernel_point_source_subsampled)
kernel_supersampled_new = psf.kernel_point_source_supersampled(
supersampling_factor=subsampling_res - 1, updata_cache=True
)
kernel_supersampled_origin = psf.kernel_point_source_supersampled(
supersampling_factor=subsampling_res
)
npt.assert_almost_equal(
kernel_supersampled_origin, kernel_point_source_subsampled
)

def test_fwhm(self):
deltaPix = 1.0
Expand Down

0 comments on commit 6385e58

Please sign in to comment.