Skip to content

Commit

Permalink
Remove pixel units from (x/y)center columns in aperture_photometry
Browse files Browse the repository at this point in the history
  • Loading branch information
larrybradley committed Jan 6, 2025
1 parent ca540d6 commit 2beb1c8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ Bug Fixes
API Changes
^^^^^^^^^^^

- ``photutils.aperture``

- The ``xcenter`` and ``ycenter`` columns in the table returned by
``aperture_photometry`` no longer have (pixel) units for consistency
with other tools. [#1993]

- ``photutils.detection``

- When ``exclude_border`` is set to ``True`` in the ``DAOStarFinder``
Expand Down
8 changes: 0 additions & 8 deletions docs/user_guide/aperture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ here as an array of all ones::
>>> phot_table['aperture_sum'].info.format = '%.8g' # for consistent table output
>>> print(phot_table)
id xcenter ycenter aperture_sum
pix pix
--- ------- ------- ------------
1 30.0 30.0 28.274334
2 40.0 40.0 28.274334
Expand Down Expand Up @@ -194,7 +193,6 @@ by a factor of 5 (``subpixels=5``) in each dimension::
... subpixels=5)
>>> print(phot_table) # doctest: +SKIP
id xcenter ycenter aperture_sum
pix pix
--- ------- ------- ------------
1 30.0 30.0 27.96
2 40.0 40.0 27.96
Expand Down Expand Up @@ -233,7 +231,6 @@ Suppose that we wish to use three circular apertures, with radii of 3,
... phot_table[col].info.format = '%.8g' # for consistent table output
>>> print(phot_table)
id xcenter ycenter aperture_sum_0 aperture_sum_1 aperture_sum_2
pix pix
--- ------- ------- -------------- -------------- --------------
1 30 30 28.274334 50.265482 78.539816
2 40 40 28.274334 50.265482 78.539816
Expand All @@ -256,7 +253,6 @@ specify ``a``, ``b``, and ``theta``::
... phot_table[col].info.format = '%.8g' # for consistent table output
>>> print(phot_table)
id xcenter ycenter aperture_sum
pix pix
--- ------- ------- ------------
1 30 30 47.12389
2 40 40 47.12389
Expand All @@ -274,7 +270,6 @@ objects, each with identical positions::
... phot_table[col].info.format = '%.8g' # for consistent table output
>>> print(phot_table)
id xcenter ycenter aperture_sum_0 aperture_sum_1 aperture_sum_2
pix pix
--- ------- ------- -------------- -------------- --------------
1 30 30 47.12389 75.398224 109.95574
2 40 40 47.12389 75.398224 109.95574
Expand Down Expand Up @@ -488,7 +483,6 @@ the photometry in the circular aperture (in the next example, we'll use
... phot_table[col].info.format = '%.8g' # for consistent table output
>>> print(phot_table)
id xcenter ycenter aperture_sum
pix pix
--- ------- ------- ------------
1 145.1 168.3 1128.1245
2 84.5 224.1 735.739
Expand Down Expand Up @@ -534,7 +528,6 @@ Finally, let's add these as columns to the photometry table::
... phot_table[col].info.format = '%.8g' # for consistent table output
>>> print(phot_table)
id xcenter ycenter aperture_sum total_bkg aperture_sum_bkgsub
pix pix
--- ------- ------- ------------ --------- -------------------
1 145.1 168.3 1128.1245 392.23708 735.88739
2 84.5 224.1 735.739 403.2968 332.44219
Expand Down Expand Up @@ -611,7 +604,6 @@ pixel value and saved it in the array ``error``::
... phot_table[col].info.format = '%.8g' # for consistent table output
>>> print(phot_table)
id xcenter ycenter aperture_sum aperture_sum_err
pix pix
--- ------- ------- ------------ ----------------
1 30 30 28.274334 0.53173616
2 40 40 28.274334 0.53173616
Expand Down
4 changes: 4 additions & 0 deletions docs/whats_new/2.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ The ``aperture_photometry`` output table will now include a
``sky_center`` column if ``wcs`` is input, even if the input aperture is
not a sky aperture.

Also, the ``xcenter`` and ``ycenter`` columns in the table returned by
``aperture_photometry`` no longer have (pixel) units for consistency
with other tools in Photutils.


Deblended Labels Mapping in Segmentation Image
----------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion photutils/aperture/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def aperture_photometry(data, apertures, error=None, mask=None,
positions = np.atleast_2d(apertures[0].positions)
tbl['id'] = np.arange(positions.shape[0], dtype=int) + 1

xypos_pixel = np.transpose(positions) * u.pixel
xypos_pixel = np.transpose(positions)
tbl['xcenter'] = xypos_pixel[0]
tbl['ycenter'] = xypos_pixel[1]

Expand Down

0 comments on commit 2beb1c8

Please sign in to comment.