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-32269 : Implement getAveragePosition() #5

Merged
merged 2 commits into from Oct 20, 2021
Merged

Conversation

jmeyers314
Copy link
Collaborator

This was previously missing, which meant that the default implementation in afw/detection/psf was erroneously used (which just returns Point2D(0, 0)).

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.

This is just fine, but please see small comment below.

@@ -81,6 +81,13 @@ def _doComputeKernelImage(self, position, color):
def _doComputeBBox(self, position, color):
return self._doBBox(Point2I(0, 0), center=True)

def getAveragePosition(self):
if not hasattr(self, '_averagePosition'):
Copy link
Contributor

Choose a reason for hiding this comment

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

In these cases I usually set self._averagePosition = None in __init__, and then check if it is None. This is ever so marginally faster.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice tip, I hadn't seen that before. Will do.

@jmeyers314 jmeyers314 merged commit eb91c39 into master Oct 20, 2021
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