Skip to content

Fix aperture photometry bug for cubes in deconfigged#3897

Merged
kecnry merged 11 commits into
spacetelescope:mainfrom
MatthewPortman:fix-ap-phot-cube
Nov 24, 2025
Merged

Fix aperture photometry bug for cubes in deconfigged#3897
kecnry merged 11 commits into
spacetelescope:mainfrom
MatthewPortman:fix-ap-phot-cube

Conversation

@MatthewPortman

Copy link
Copy Markdown
Contributor

Description

This pull request is to address an error that occurs when aperture photometry is attempted on cubes in deconfigged. The issue was that several of the checks in the code were hardcoded to imviz and cubeviz but were not updated with the introduction of cube loaders. Those checks were updated throughout the code (mostly to dimensionality checks).

Change log entry

  • Is a change log needed? If yes, is it added to CHANGES.rst? If you want to avoid merge conflicts,
    list the proposed change log here for review and add to CHANGES.rst before merge. If no, maintainer
    should add a no-changelog-entry-needed label.

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • If new remote data is added that uses MAST, is the URI added to the cache-download.yml workflow?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone. Bugfix milestone also needs an accompanying backport label.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@MatthewPortman MatthewPortman added bug Something isn't working cubeviz labels Nov 14, 2025
@MatthewPortman MatthewPortman added this to the 4.4.3 milestone Nov 14, 2025
@github-actions github-actions Bot added imviz plugin Label for plugins common to multiple configurations labels Nov 14, 2025
@MatthewPortman MatthewPortman force-pushed the fix-ap-phot-cube branch 2 times, most recently from e554b9e to d1b25bf Compare November 14, 2025 16:54
@codecov

codecov Bot commented Nov 17, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.28571% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.28%. Comparing base (230c5b1) to head (2df976c).

Files with missing lines Patch % Lines
...imviz/plugins/aper_phot_simple/aper_phot_simple.py 89.28% 9 Missing ⚠️

❌ Your patch check has failed because the patch coverage (89.28%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3897      +/-   ##
==========================================
+ Coverage   88.20%   88.28%   +0.07%     
==========================================
  Files         198      198              
  Lines       26904    26914      +10     
==========================================
+ Hits        23732    23761      +29     
+ Misses       3172     3153      -19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# convert pixarea, which is in arcsec2/pix2 to the display solid angle unit / pix2

if self.config in ('imviz', 'deconfigged'):
if self.config == 'imviz':

@kecnry kecnry Nov 17, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should this also be for images (not cubes) in deconfigged or no (because deconfigged has unit-conversion and imviz does not)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oo yeah good catch, do you think a dim check is enough?

Comment thread jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py Outdated
Comment thread jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py Outdated
@MatthewPortman MatthewPortman force-pushed the fix-ap-phot-cube branch 2 times, most recently from a8b5e58 to 261082a Compare November 17, 2025 19:48
assert plg._obj.cube_slice == "4.894e+00 um"
plg = helper.plugins["Aperture Photometry"]
assert plg.dataset.labels == [flux_label, unc_label]
assert_quantity_allclose(plg._obj.cube_slice, 4.89 * u.um, atol=1e-2 * u.um)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this tolerance seems pretty low, did something change so doesn't match as well anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

At some point in my testing, deconfigged was returning a slightly different value than cubeviz (on the order of 1e-3 I think) so I added the allclose. But I just tested again with the old exact value and it works so I'll revert that!

Comment thread CHANGES.rst Outdated
@MatthewPortman MatthewPortman added the no-changelog-entry-needed changelog bot directive label Nov 21, 2025
@kecnry kecnry merged commit b193c61 into spacetelescope:main Nov 24, 2025
17 of 19 checks passed
@MatthewPortman MatthewPortman deleted the fix-ap-phot-cube branch November 24, 2025 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cubeviz imviz no-changelog-entry-needed changelog bot directive plugin Label for plugins common to multiple configurations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants