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-34770: Use PSF average position explicitly in PSF methods #51

Closed
wants to merge 1 commit into from

Conversation

arunkannawadi
Copy link
Member

No description provided.

@@ -123,7 +123,7 @@ def _computePsfImage(self, position=None):
for bidx, single in enumerate(self.singles):
try:
if position is None:
psf = single.getPsf().computeImage()
psf = single.getPsf().computeImage(single.getPsf().getAveragePosition())
Copy link
Member Author

Choose a reason for hiding this comment

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

I am a bit confused as to why computeImage is called when no position was specified and computeKernelImage is called when it is specified. This might have different behavior depending on whether or not the average position is passed in explicitly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Paging @fred3m

Copy link
Contributor

@fred3m fred3m May 12, 2022

Choose a reason for hiding this comment

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

Honestly, it should probably throw an exception, since using the average position can cause unexpected problems.

Copy link
Contributor

@fred3m fred3m May 12, 2022

Choose a reason for hiding this comment

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

Thinking back on this as to why that behavior is coded in the first place, computeKernelImage definitely didn't work properly if no position was given. At the time, computeKernel didn't have the same bug, so that's why we still allowed it. But I do think that raising an Exception if no position is specified is the correct behavior now.

Copy link
Member Author

Choose a reason for hiding this comment

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

In that case, I can close this PR without merging and perhaps @fred3m can create another ticket to raise an exception?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this branch is actually unused, which is good. So I think that DM-34777 is trivial.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry @arunkannawadi , it looks like our comments crossed and I didn't see yours before I submitted. So looking at that ticket I understand why this is being updated now. However, I stand by my original assertion that this function should never take position=None as an argument. Currently if one tries to use position=None in the stack this will display a future warning (I just tried with the latest weekly). I would prefer that to not notifying the user that their use of position=None is a bad idea. So if you don't want to raise an exception in this ticket please revert this change, as I prefer the current behavior that will at least notify people that they are doing something bad (or wait for DM-37777).

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I think the thing to do is not make this change, and add a TODO DM-37777 which hopefully is done soon.

Copy link
Member

Choose a reason for hiding this comment

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

I thought the point of this ticket was to make it so that the future warning was handled? If position=None is not allowed then raise, don't wait for the warning.

Copy link
Contributor

Choose a reason for hiding this comment

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

I did just finish DM-34777 and if Arun prefers, he can just merge it into this ticket branch instead of main. As @erykoff said, the change was trivial.

@@ -91,7 +91,7 @@ def _checkBlendConvergence(blend, f_rel):
def _getPsfFwhm(psf):
"""Calculate the FWHM of the `psf`
"""
return psf.computeShape().getDeterminantRadius() * 2.35
return psf.computeShape(psf.getAveragePosition()).getDeterminantRadius() * 2.35
Copy link
Member Author

Choose a reason for hiding this comment

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

This method doesn't seem to be used anywhere. If it's just not showing up in my Github search, then this should take position as an argument and compute the PSF shape at that position.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that whatever called it was removed some time ago, so you should be able to just remove _getPsfFwhm.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah great, note that the use here (and above!) were found by searching through the code, and did not show up in the logs in RC2 processing. So I think this really is unused.

Copy link
Contributor

Choose a reason for hiding this comment

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

Upon further review/consideration, I think this should be removed on DM-34777, and this PR should be closed as a noop.

Copy link
Contributor

@erykoff erykoff left a comment

Choose a reason for hiding this comment

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

I think this PR should probably be closed, and if unused _getPsfFwhm is on the DM-34777 PR then this one has nothing to do.

@@ -91,7 +91,7 @@ def _checkBlendConvergence(blend, f_rel):
def _getPsfFwhm(psf):
"""Calculate the FWHM of the `psf`
"""
return psf.computeShape().getDeterminantRadius() * 2.35
return psf.computeShape(psf.getAveragePosition()).getDeterminantRadius() * 2.35
Copy link
Contributor

Choose a reason for hiding this comment

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

Upon further review/consideration, I think this should be removed on DM-34777, and this PR should be closed as a noop.

@arunkannawadi
Copy link
Member Author

Agreed on closing this without merging. Since the spirit of DM-34770 is to provide the appropriate position argument to PSF methods, removal of _getPsfFwhm should be done in #52 .

@fred3m
Copy link
Contributor

fred3m commented May 12, 2022

I did include the change in DM-34777 so it is OK to close this PR. FTR it took less time to implement this PR (~30 seconds to code and 1 minute to test) than we spent arguing about where/when the change should be made. In the future, trivial changes like that shouldn't require a new ticket, especially when they are within the scope of the original ticket.

@fred3m fred3m closed this May 12, 2022
@arunkannawadi
Copy link
Member Author

Agreed, and apologies. I didn't want to remove or incorrectly suppress warnings without knowing the intentions of the original author.

@arunkannawadi arunkannawadi deleted the tickets/DM-34770 branch May 12, 2022 20:20
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

4 participants