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

avoid an extra validation on __init__ #356

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

braingram
Copy link
Collaborator

@braingram braingram commented Nov 4, 2024

When a SlitModel is created from a MultiSlitModel.slits[i].instance as is done in pixel_replace:
https://github.com/spacetelescope/jwst/blob/a32f8b01e8000603d6cc916511a87c0e0b77e47e/jwst/pixel_replace/pixel_replace.py#L187

The instance may contain the int_times FITS_rec and can lead to an AsdfConversionWarning (that will soon be an error asdf-format/asdf#1858):
https://github.com/spacetelescope/RegressionTests/actions/runs/11632063641/job/32394552214#step:28:266

This PR changes Model.__init__ to avoid the validation on __init__ (which is also deprecated and soon be removed: asdf-format/asdf#1852). This avoids the AsdfConversionWarning (due to an attempt to serialize a FITS_rec ) and has the added benefit of avoiding an unnecessary validation (the data will be validated on write where the FITS_rec will be safely converted).

Regression tests: https://github.com/spacetelescope/RegressionTests/actions/runs/11666451738
all pass and most relevant to this PR show no AsdfConversionWarning.

This change is similar to #230 in that it uses assignment to the private _tree attribute to avoid validation.

Tasks

  • update or add relevant tests
  • update relevant docstrings and / or docs/ page
  • Does this PR change any API used downstream? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see below for change types)
    • run jwst regression tests with this branch installed ("git+https://github.com/<fork>/stdatamodels@<branch>")
news fragment change types...
  • changes/<PR#>.feature.rst: new feature
  • changes/<PR#>.bugfix.rst: fixes an issue
  • changes/<PR#>.doc.rst: documentation change
  • changes/<PR#>.removal.rst: deprecation or removal of public API
  • changes/<PR#>.misc.rst: infrastructure or miscellaneous change

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.52%. Comparing base (a6994fa) to head (66d8d0a).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #356      +/-   ##
==========================================
+ Coverage   67.51%   67.52%   +0.01%     
==========================================
  Files         114      114              
  Lines        5913     5916       +3     
==========================================
+ Hits         3992     3995       +3     
  Misses       1921     1921              

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


🚨 Try these New Features:

@braingram braingram marked this pull request as ready for review November 4, 2024 19:02
@braingram braingram requested a review from a team as a code owner November 4, 2024 19:02
@braingram braingram requested a review from tapastro November 4, 2024 19:03
Copy link
Collaborator

@tapastro tapastro left a comment

Choose a reason for hiding this comment

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

LGTM

@tapastro tapastro merged commit cbe5d1f into spacetelescope:main Nov 18, 2024
22 checks passed
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.

2 participants