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

Allow for custom centroiding in find_peaks #656

Merged
merged 13 commits into from
Mar 22, 2018

Conversation

larrybradley
Copy link
Member

This PR allows for custom centroiding in the find_peaks function. Currently, the function will centroid sources with the subpixel keyword (now deprecated) by fitting a 2D Gaussian + constant. As noted in #655, this compound-model fitting method can be slow.

This PR makes centroiding in find_peaks more flexible by allowing the user to pass any callable (e.g. function/class instance) to compute the local centroid (within the cutout/footprint). This PR also adds a new general function called centroid_sources that performs this functionality given initial (x, y) positions.

One small change of behavior is that with subpixel=True the fitted peak value was also returned. To keeps things general, that is no longer the case because the passed centroid function need not perform any fit (e.g. a moment-based centroid).

To get the same centroid values as subpixel=True, one can use the centroid_func keyword with the photutils.centroids.centroid_2dg function.

@larrybradley larrybradley merged commit 030f56d into astropy:master Mar 22, 2018
@larrybradley larrybradley deleted the find-peaks-centroid branch March 22, 2018 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant