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 a list of apertures to be input to aperture_photometry #454

Merged
merged 3 commits into from
Nov 5, 2016

Conversation

larrybradley
Copy link
Member

This PR allows a list of aperture objects to be input to aperture_photometry. All of the aperture inputs must have identical positions. For multiple apertures, the output table column names are appended with the position index.

This also works for sky apertures, provided they have the same positions.

Examples:

from photutils import CircularAperture, aperture_photometry

pos = [(40, 40), (50, 50), (60, 60)]
radii = [3, 5, 7]
apers = [CircularAperture(pos, r=r) for r in radii]

data = np.ones((100, 100))
tbl = aperture_photometry(data, apers)
print(tbl)
id xcenter ycenter aperture_sum_0 aperture_sum_1 aperture_sum_2
      pix     pix                                               
--- ------- ------- -------------- -------------- --------------
  1    40.0    40.0  28.2743338823  78.5398163397  153.938040026
  2    50.0    50.0  28.2743338823  78.5398163397  153.938040026
  3    60.0    60.0  28.2743338823  78.5398163397  153.938040026

For a single aperture, the index is not appended to the column name(s):

tbl = aperture_photometry(data, apers[0])
print(tbl)
 id xcenter ycenter  aperture_sum
      pix     pix                
--- ------- ------- -------------
  1    40.0    40.0 28.2743338823
  2    50.0    50.0 28.2743338823
  3    60.0    60.0 28.2743338823

@larrybradley larrybradley added this to the 0.3 milestone Nov 5, 2016
@larrybradley larrybradley self-assigned this Nov 5, 2016
@larrybradley larrybradley merged commit 2dbea62 into astropy:master Nov 5, 2016
@larrybradley larrybradley deleted the multi-aper branch November 5, 2016 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant