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

Fix compute_scale when fiducial coordinates are outside bounding box #2887

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

astrofrog
Copy link
Collaborator

Description

This fixes a corner case in compute_scale when the fiducial coordinates provided are outside of the bounding box.

This is needed if the bounding box on data is not reset, and in order to be compatible with spacetelescope/gwcs#498

cc @bmorris3

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?
  • 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)?

@github-actions github-actions bot added imviz plugin Label for plugins common to multiple configurations labels May 22, 2024
@astrofrog astrofrog force-pushed the fix-compute-scale-outside-bbox branch from 9edc67e to cd9715e Compare May 22, 2024 10:09
@astrofrog astrofrog force-pushed the fix-compute-scale-outside-bbox branch from cd9715e to ce15aeb Compare May 22, 2024 10:09
@astrofrog
Copy link
Collaborator Author

I don't think this needs a changelog entry as as far as users are concerned it won't have an impact yet, since jdaviz disables the bounding box by default. It's more to future-proof if we do want to retain the bounding boxes.

Copy link

codecov bot commented May 22, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 88.71%. Comparing base (b89784c) to head (ce15aeb).
Report is 2 commits behind head on main.

Files Patch % Lines
jdaviz/configs/imviz/wcs_utils.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2887      +/-   ##
==========================================
- Coverage   88.72%   88.71%   -0.01%     
==========================================
  Files         111      111              
  Lines       17102    17106       +4     
==========================================
+ Hits        15174    15176       +2     
- Misses       1928     1930       +2     

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

@@ -575,7 +576,13 @@ def compute_scale(wcs, fiducial, disp_axis, pscale_ratio=1):
if spectral and disp_axis is None: # pragma: no cover
raise ValueError('If input WCS is spectral, a disp_axis must be given')

crpix = np.array(wcs.invert(*fiducial))
if wcs.in_image(*fiducial):
Copy link
Contributor

Choose a reason for hiding this comment

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

@bmorris3 should review this one. And also since he mentioned that he lifted this code from jwst, I wonder if a similar patch has to go to jwst also.

@pllim pllim added this to the 3.10.2 milestone May 22, 2024
@pllim pllim added bug Something isn't working no-changelog-entry-needed changelog bot directive 💤backport-v3.10.x on-merge: backport to v3.10.x labels May 22, 2024
@bmorris3 bmorris3 modified the milestones: 3.10.2, 4.0 Jun 6, 2024
@bmorris3
Copy link
Contributor

bmorris3 commented Jun 6, 2024

I'm re-milestoning this one to 4.0, since the related upstream GWCS changes (spacetelescope/gwcs#498) are in draft pending strategizing and discussion from @nden and @mcara.

@bmorris3 bmorris3 removed the 💤backport-v3.10.x on-merge: backport to v3.10.x label Jul 22, 2024
@rosteen rosteen modified the milestones: 4.0, 4.1 Oct 17, 2024
Copy link
Contributor

@bmorris3 bmorris3 left a comment

Choose a reason for hiding this comment

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

With the latest changes to spacetelescope/gwcs#498, this will work for us with one further change, in astrofrog#5.

@bmorris3 bmorris3 modified the milestones: 4.1, 4.0.1 Dec 11, 2024
Stop GWCS bounding box override in imviz parser
Comment on lines 216 to 218
# NOTE: if extending this beyond GWCS, the mouseover logic
# for outside_*_bounding_box should also be updated.
data.coords._orig_bounding_box = data.coords.bounding_box
Copy link
Member

Choose a reason for hiding this comment

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

@bmorris3 - is this still needed/used anywhere? Can we remove the entire if-statement?

@pllim pllim modified the milestones: 4.0.1, 4.0.2, 4.1 Dec 17, 2024
@rosteen rosteen modified the milestones: 4.1, 4.1.1 Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 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.

5 participants