Skip to content

Commit

Permalink
Add a test for small image convolution
Browse files Browse the repository at this point in the history
  • Loading branch information
fred3m committed Nov 29, 2023
1 parent c5098c1 commit a021849
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,27 @@ def test_convolve(self):
with self.assertRaises(ValueError):
observation.convolve(deconvolved, mode="fake")

# Test convolving a small image
x = np.linspace(-3, 3, 7)
small_array = integrated_circular_gaussian(x=x, y=x, sigma=0.8)
small_psf = Image(np.array([small_array, small_array, small_array]), bands=observation.bands)
truth = Image(
np.array(
[
scipy_convolve(
small_psf[band].data,
observation.diff_kernel.image[observation.bands.index(band)],
method="direct",
mode="same",
)
for band in observation.bands
]
),
bands=observation.bands,
)
convolved = observation.convolve(small_psf)
self.assertImageAlmostEqual(convolved, truth)

def test_index_extraction(self):
alpha_bands = ("g", "i", "r", "y", "z")
images = np.arange(60).reshape(5, 3, 4)
Expand Down

0 comments on commit a021849

Please sign in to comment.