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

Force gwcs to always return a F ordered bounding box #522

Merged
merged 6 commits into from
Nov 8, 2024

Conversation

WilliamJamieson
Copy link
Collaborator

This PR forces GWCS to always return an F ordered bounding box. It raises a warning when it discovers a non-F ordered bounding box that it needs to convert.

@WilliamJamieson WilliamJamieson requested a review from a team as a code owner October 30, 2024 19:10
Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.42%. Comparing base (eb9d316) to head (55223f9).
Report is 23 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #522      +/-   ##
==========================================
+ Coverage   87.28%   87.42%   +0.14%     
==========================================
  Files          22       22              
  Lines        3821     3874      +53     
==========================================
+ Hits         3335     3387      +52     
- Misses        486      487       +1     

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

@nden
Copy link
Collaborator

nden commented Nov 8, 2024

@nden nden merged commit 7f92615 into spacetelescope:master Nov 8, 2024
20 of 22 checks passed
@WilliamJamieson WilliamJamieson deleted the feature/force_F branch November 8, 2024 19:20
@pllim
Copy link
Contributor

pllim commented Nov 12, 2024

This warning is very disruptive. It is getting emitted in Jdaviz for just existing. For example:

jdaviz/configs/imviz/plugins/parsers.py:238: in _parse_image
    if isinstance(data.coords, GWCS) and (data.coords.bounding_box is not None):

Here, we merely read in the GWCS from an existing JWST ASDF-in-FITS image and checking whether it is set. Not even doing anything with it. Bam, warning. What are we supposed to do here? We cannot really go change the file in MAST. Hope you can advise.


* GWCS uses the ``"F"`` ordering convention, where the tuples are ordered
``((x0min, x0max), (x1min, x1max), ..., (xnmin, xnmax))`` (x,y,z ordering).
* While astropy uses the ``"C"`` ordering convention, where tuples are ordered
Copy link
Contributor

Choose a reason for hiding this comment

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

You mean specifically astropy.modeling, right? Things might be different in astropy.wcs. Should clarify.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

astropy.wcs has no notion of a bounding box.

@pllim
Copy link
Contributor

pllim commented Nov 12, 2024

I am still confused. If downstream, we use it like this, are we already using it correctly? https://github.com/spacetelescope/jdaviz/blob/5130cafd8f8790a3e09b2d82c5ee721a1b909d9f/jdaviz/configs/imviz/wcs_utils.py#L282-L292

        ints = data.coords._orig_bounding_box.intervals
        if isinstance(ints[0].lower, u.Quantity):
            bb_xmin = ints[0].lower.value
            bb_xmax = ints[0].upper.value
            bb_ymin = ints[1].lower.value
            bb_ymax = ints[1].upper.value
        else:  # pragma: no cover
            bb_xmin = ints[0].lower
            bb_xmax = ints[0].upper
            bb_ymin = ints[1].lower
            bb_ymax = ints[1].upper

pllim added a commit to pllim/jdaviz that referenced this pull request Nov 12, 2024
@pllim
Copy link
Contributor

pllim commented Nov 13, 2024

If I have to extrapolate from the warnings I already see over at specutils and jdaviz , the way the warning is emitting now, you might get a lot of questions from users just trying to read existing JWST files out there when this patch is released. FYI.

pllim added a commit to pllim/specutils that referenced this pull request Nov 13, 2024
because there is nothing we can do about it here
rosteen pushed a commit to astropy/specutils that referenced this pull request Nov 13, 2024
because there is nothing we can do about it here
pllim added a commit to pllim/specutils that referenced this pull request Nov 14, 2024
@pllim
Copy link
Contributor

pllim commented Nov 14, 2024

Just so I can find the trail in the future:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants