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

Add protections against duplicate frames #545

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

Conversation

WilliamJamieson
Copy link
Collaborator

This PR refactors GWCS with the goal of fixing issue #178; namely, that adding two frames with the same name causes the gwcs to behave weirdly.

This is accomplished by pulling the "pipeline" management code into a separate object and then adding protections in that object to prevent two frames of the same name to be added. Moreover, it also makes sure the last transform in the pipeline is None as there is nothing for it to transform to.

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 87.47664% with 67 lines in your changes missing coverage. Please review.

Project coverage is 85.74%. Comparing base (877716d) to head (3d52018).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
gwcs/wcs/_utils.py 85.24% 27 Missing ⚠️
gwcs/coordinate_frames.py 68.75% 15 Missing ⚠️
gwcs/wcs/_step.py 76.00% 12 Missing ⚠️
gwcs/wcs/_pipeline.py 95.05% 9 Missing ⚠️
gwcs/wcs/_wcs.py 91.48% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #545      +/-   ##
==========================================
+ Coverage   85.41%   85.74%   +0.32%     
==========================================
  Files          22       27       +5     
  Lines        3957     3991      +34     
==========================================
+ Hits         3380     3422      +42     
+ Misses        577      569       -8     

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

@WilliamJamieson WilliamJamieson marked this pull request as ready for review January 8, 2025 16:51
@WilliamJamieson WilliamJamieson requested a review from a team as a code owner January 8, 2025 16:51
@WilliamJamieson
Copy link
Collaborator Author

@WilliamJamieson WilliamJamieson requested a review from nden January 8, 2025 16:53
# Add the frame as an attribute of the pipeline
super().__setattr__(value.frame.name, value.frame)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried to use a __getattr__ method instead of this but it broke deep copies in some cases for JWST and Romancal regression tests.

Cadair added a commit to Cadair/ndcube that referenced this pull request Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants