Skip to content

Commit

Permalink
Add comcam to vignetting test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeyers314 committed Feb 28, 2024
1 parent 5338acc commit 8a94631
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_vignetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,33 @@ def test_vignetting():
test_values = sky_value, image_vignetting[corner[1], corner[0]]
np.testing.assert_almost_equal(*test_values)

# Repeat for ComCam
camera = imsim.get_camera("LsstComCamSim")
vignetting = imsim.Vignetting('LSSTComCamSim_vignetting_data.json')
det_names = ["R22_S00", "R22_S01", "R22_S11"]

for det_name in det_names:
det = camera[det_name]
pix_to_fp = det.getTransform(cameraGeom.PIXELS, cameraGeom.FOCAL_PLANE)
wcs = wcs_factory.getWCS(det)

# Vignetting function evaluated over the entire CCD:
radii = imsim.Vignetting.get_pixel_radii(det)
image_vignetting = vignetting.apply_to_radii(radii)

# Compare with the values at the detector corners, using the
# corresponding sky coordinates obtained from the WCS for this
# detector to cross-check the .at_sky_coord(...) function.
corners = [(int(_.x), int(_.y)) for _ in
det.getCorners(cameraGeom.PIXELS)]
for corner in corners:
image_pos = galsim.PositionD(*corner)
sky_coord = wcs.toWorld(image_pos)
sky_value = vignetting.at_sky_coord(sky_coord, wcs, pix_to_fp)
test_values = sky_value, image_vignetting[corner[1], corner[0]]
print(test_values)
np.testing.assert_almost_equal(*test_values)


if __name__ == '__main__':
test_vignetting()

0 comments on commit 8a94631

Please sign in to comment.