Skip to content

Commit

Permalink
Add a unit test for asMaskedImage
Browse files Browse the repository at this point in the history
  • Loading branch information
arunkannawadi committed Mar 20, 2024
1 parent db11f54 commit 943a8f3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_coadds.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import unittest
from collections.abc import Iterable, Mapping
from itertools import product

import lsst.cell_coadds.test_utils as test_utils
import lsst.geom as geom
Expand Down Expand Up @@ -326,6 +327,19 @@ def test_exploded_psf_image(self):
geom.Extent2I(self.nx * self.outer_size_x, self.ny * self.outer_size_y),
)

def test_asMaskedImage(self):
"""Test the asMaskedImage method for an ExplodedCoadd object."""
masked_image = self.exploded_coadd.asMaskedImage()
masked_image.setXY0(self.multiple_cell_coadd.outer_bbox.getMin())
base_bbox = self.multiple_cell_coadd.grid.bbox_of(Index2D(0, 0)).dilatedBy(self.border_size)
for (cell_x, cell_y) in product(range(self.nx), range(self.ny)):
bbox = base_bbox.shiftedBy(geom.Extent2I(cell_x * self.outer_size_x, cell_y * self.outer_size_y))
with self.subTest(cell_x=cell_x, cell_y=cell_y):
self.assertMaskedImagesEqual(
masked_image[bbox],
self.multiple_cell_coadd.cells[Index2D(cell_x, cell_y)].outer.asMaskedImage(),
)


class StitchedCoaddTestCase(BaseMultipleCellCoaddTestCase):
"""Test the construction and methods of a StitchedCoadd instance."""
Expand Down

0 comments on commit 943a8f3

Please sign in to comment.