Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-36768: Add psf image to alert cutouts #221

Merged
merged 3 commits into from
Jun 18, 2024
Merged

DM-36768: Add psf image to alert cutouts #221

merged 3 commits into from
Jun 18, 2024

Conversation

ebellm
Copy link
Contributor

@ebellm ebellm commented Jun 13, 2024

No description provided.

@@ -389,11 +389,12 @@ def createCcdDataCutout(self, image, skyCenter, extent, photoCalib, srcId):
CCDData object storing the calibrate information from the input
difference or template image.
"""
point = image.getWcs().skyToPixel(skyCenter)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to pass in the pixel centroid to this method from the diaSource record? No need to do WCS math at all, since we know where the source centroid is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we trust that the (x,y) of the DIASource are the same on the calexp and matched template?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, those are made to be 1-1 pixel aligned (with the template having a buffer, but the xy0 set such that they are aligned).

@@ -265,6 +265,9 @@ def testCreateCcdDataCutout(self):
self.cutoutWcs.wcs.cd)
self.assertFloatsAlmostEqual(ccdData.data,
calibExposure.getImage().array)
self.assertFloatsAlmostEqual(ccdData.psf,
self.exposure.psf.computeKernelImage(self.center).array)
self.assertFloatsAlmostEqual(np.sum(ccdData.psf), 1.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this last one is necessary: you don't need to check that computeKernelImage is normalized here, since it's already well tested within afw.

@@ -410,6 +411,8 @@ def createCcdDataCutout(self, image, skyCenter, extent, photoCalib, srcId):
% srcId)
return None

cutoutPsf = image.psf.computeKernelImage(point).array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment here as to why this is computeKernelImage instead of computeImage? I'm still not convinced as to which is correct for this use case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm convinced by previous discussion that we want the PSF centered in the array.

Copy link
Contributor

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As to the question about the wcs calls further down in createCcdDataCutout, please file a ticket and we can look at it: it may or may not be necessary there.

@ebellm ebellm requested a review from parejkoj June 18, 2024 19:02
@ebellm ebellm merged commit 4ec8bf2 into main Jun 18, 2024
2 checks passed
@ebellm ebellm deleted the tickets/DM-36768 branch June 18, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants