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-33446: Use TraceRadius in GAaP plugin #23

Merged
merged 2 commits into from Feb 8, 2022
Merged

Conversation

arunkannawadi
Copy link
Member

Replace getDeterminantRadius calls with getTraceRadius

@arunkannawadi arunkannawadi changed the title DM-33446 DM-33446: Use TraceRadius in GAaP plugin Jan 31, 2022
Comment on lines 555 to 556
if not (psfShape.getDeterminantRadius() > 0):
self.log.debug("PSF shape has non-positive determinant radius at (%f, %f)", center.x, center.y)

Choose a reason for hiding this comment

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

This ticket changes psfShape to use getTraceRadius always. If so, why is this debug log message relating to getDeterminantRadius required? Is the determinant radius used elsewhere, where this logger might be useful, or could it safely be removed?

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 can be safely removed. I had put that to indicate that the PSF at that location was bad, but I don't think gaap plugin is the place to put that.

self.log.debug("PSF shape has non-positive determinant radius at (%f, %f)", center.x, center.y)

psfSigma = psfShape.getTraceRadius()
if not (psfSigma > 0): # This captures nan

Choose a reason for hiding this comment

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

If all you want to do here is capture NaNs, wouldn't np.isnan be better? Or do you expect some negative values of getTraceRadius to creep through for other reasons? If so, the in-line comment should reflect that possibility.

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 don't think either of getTraceRadius or getDeterminantRadius will ever return negative numbers, but in the off-chance they returned -1 or something, this will capture that. If I remember right, when I wrote this line, I didn't want to have to import numpy just for this condition. The way I read it, if the PSF size is not a positive-valued number, then don't proceed. Do you think np.isnan makes the intention much clearer?

Choose a reason for hiding this comment

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

If there is a chance that a negative number may be returned, then yes, it makes sense to leave it as-is. I would however recommend changing the in-line comment to something like This captures NaN or negative values.

for scalingFactor in self.config.scalingFactor}
raise GaapConvolutionError(errorCollection)
else:
errorCollection = {}

Choose a reason for hiding this comment

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

This may be personal preference, but I think the syntax you used before (dict()) reads better than the suggested change ({}). Completely up to you however!

@arunkannawadi arunkannawadi merged commit 4777abc into main Feb 8, 2022
@arunkannawadi arunkannawadi deleted the tickets/DM-33446 branch August 16, 2022 19:56
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