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

BUGFIX fix issue with with_units causing a loss of array entries #563

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

WilliamJamieson
Copy link
Collaborator

This fixes #559

The issue is that with_units was accidentally loosing elements of an array for "vector" values. That is if your in the 1D case and your shape is (n,) instead of (1, n) the only the first entry of the vector was returned in the "high-level" object.

The issue was due to a zip(arrays, units, strict=False) loosing things because there were more arrays entries than units entries. The issue is that for the "vector" the zip will iterate over each of the entries in the vector, where as a 1D array would just iterate once yielding the entire "vector" entry.

The solution is twofold:

  1. Force strictness so that we catch future bugs in gwcs.
  2. Add check for naxes==1 before the zip and wrapping the "vector" into a tuple.

@WilliamJamieson WilliamJamieson requested a review from a team as a code owner February 13, 2025 18:30
Copy link

codecov bot commented Feb 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.02%. Comparing base (c6ee47f) to head (fce7ed1).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #563      +/-   ##
==========================================
- Coverage   86.04%   86.02%   -0.02%     
==========================================
  Files          27       27              
  Lines        4048     4050       +2     
==========================================
+ Hits         3483     3484       +1     
- Misses        565      566       +1     

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

@mcara
Copy link
Member

mcara commented Feb 13, 2025

Would it be possible to fix WEBBPSF_PATH issues in a separate PR and then rebase this after the first is merged?

LGTM

Copy link
Member

@mcara mcara left a comment

Choose a reason for hiding this comment

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

LGTM

@mcara mcara requested a review from nden February 13, 2025 19:13
Copy link
Collaborator

@nden nden left a comment

Choose a reason for hiding this comment

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

JWST unit tests are failing with this PR.

@WilliamJamieson WilliamJamieson requested a review from nden February 14, 2025 14:53
@WilliamJamieson
Copy link
Collaborator Author

JWST unit tests are failing with this PR.

Just fixed this.

This was largely an issue of the zip(strict=False) causing missed entries. I made this strict=True
@WilliamJamieson WilliamJamieson force-pushed the bugfix/lost_array_values branch from 13cc195 to fce7ed1 Compare February 26, 2025 14:47
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.

with_units wrongly returning a single SpectralCoord instead of an array in v0.24
3 participants