From 2beb1c84c7839c2c00e8ef6003c0de44b24335df Mon Sep 17 00:00:00 2001 From: Larry Bradley Date: Mon, 6 Jan 2025 13:00:26 -0500 Subject: [PATCH] Remove pixel units from (x/y)center columns in aperture_photometry --- CHANGES.rst | 6 ++++++ docs/user_guide/aperture.rst | 8 -------- docs/whats_new/2.1.rst | 4 ++++ photutils/aperture/photometry.py | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index e6c13d748..52a2619a9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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`` diff --git a/docs/user_guide/aperture.rst b/docs/user_guide/aperture.rst index 18014c4d9..19c253ecf 100644 --- a/docs/user_guide/aperture.rst +++ b/docs/user_guide/aperture.rst @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/docs/whats_new/2.1.rst b/docs/whats_new/2.1.rst index c60a19b14..a084f410e 100644 --- a/docs/whats_new/2.1.rst +++ b/docs/whats_new/2.1.rst @@ -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 ---------------------------------------------- diff --git a/photutils/aperture/photometry.py b/photutils/aperture/photometry.py index 84eca6196..6f4c9bcea 100644 --- a/photutils/aperture/photometry.py +++ b/photutils/aperture/photometry.py @@ -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]