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 a check for separation and tolerance in tweakreg #8476

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

Conversation

mcara
Copy link
Member

@mcara mcara commented May 9, 2024

This PR adds a check that (abs_)separation > sqrt(2) * (abs_)tolerance input parameters to the tweakreg step. It also adds a comment in the docstring about these parameters.

Checklist for PR authors (skip items if you don't have permissions or they are not applicable)

  • added entry in CHANGES.rst within the relevant release section
  • updated or added relevant tests
  • updated relevant documentation
  • added relevant milestone
  • added relevant label(s)
  • ran regression tests, post a link to the Jenkins job below.
    How to run regression tests on a PR
  • All comments are resolved
  • Make sure the JIRA ticket is resolved properly

@mcara mcara requested a review from a team as a code owner May 9, 2024 12:19
@mcara mcara self-assigned this May 9, 2024
@mcara mcara requested review from nden and hbushouse May 9, 2024 12:20
@mcara mcara added this to the Build 10.0.1 milestone May 9, 2024
@hbushouse hbushouse modified the milestones: Build 10.0.1, Build 11.0 May 9, 2024
CHANGES.rst Outdated Show resolved Hide resolved
jwst/tweakreg/tweakreg_step.py Outdated Show resolved Hide resolved
jwst/tweakreg/tweakreg_step.py Outdated Show resolved Hide resolved
@nden
Copy link
Collaborator

nden commented May 15, 2024

Agreed with Howard's comments. These need to be warnings.

@mcara
Copy link
Member Author

mcara commented May 16, 2024

I took into account Howard suggestion as well as (in part) @mairanteodoro suggestion in a different PR about putting common logging and step-skipping code into a single function.

@mcara
Copy link
Member Author

mcara commented May 16, 2024

Copy link

codecov bot commented May 16, 2024

Codecov Report

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

Project coverage is 57.96%. Comparing base (781e0e0) to head (0516436).
Report is 12 commits behind head on master.

Files Patch % Lines
jwst/tweakreg/tweakreg_step.py 28.57% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8476      +/-   ##
==========================================
+ Coverage   57.93%   57.96%   +0.03%     
==========================================
  Files         387      387              
  Lines       38839    38844       +5     
==========================================
+ Hits        22502    22517      +15     
+ Misses      16337    16327      -10     

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

@mcara
Copy link
Member Author

mcara commented May 16, 2024

Another regression test here: https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1447/

Previous test was failing because input models' meta could not be updated with info about step being skipped (models were not yet open)

and https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1448/

@nden
Copy link
Collaborator

nden commented May 16, 2024

@mcara About the common function for logging - #8424 refactors tweakreg to reduce memory. If this function prevents or complicate the refactoring, give preference to #8424 and remove it.

@mcara
Copy link
Member Author

mcara commented May 16, 2024

@mcara About the common function for logging - #8424 refactors tweakreg to reduce memory. If this function prevents or complicate the refactoring, give preference to #8424 and remove it.

@braingram what is your opinion on this change: 56a1108 ?

@braingram
Copy link
Collaborator

@braingram what is your opinion on this change: 56a1108 ?

Thanks for the ping. I will look at this later today. One general question, are these changes required for the check in the title of this PR?

@mcara
Copy link
Member Author

mcara commented May 16, 2024

One general question, are these changes required for the check in the title of this PR?

No. But... @mairanteodoro is right about similar code being used in too many places.

@braingram
Copy link
Collaborator

No. But... @mairanteodoro is right about similar code being used in too many places.

Perhaps a follow-up PR cleaning up the error handling and logging is called for? It could include an update to the tweakwcs pin once a version is released that contains spacetelescope/tweakwcs#203 (and possibly spacetelescope/tweakwcs#204)?

I rebased and reopened #8424 when this PR was only the parameter checks thinking it would have no conflicts. I don't think that's the case if the additional cleanup in 56a1108 is included. Since they're not required for the parameter changes I think they make sense to put in a different cleanup PR.

@mcara
Copy link
Member Author

mcara commented May 16, 2024

OK. I'll remove logging function and simplify this PR.

@mcara
Copy link
Member Author

mcara commented May 16, 2024

@braingram
Copy link
Collaborator

Thanks for updating the PR. I added a few comments.

@mcara
Copy link
Member Author

mcara commented May 16, 2024

@hbushouse @nden regression tests fail with this error:

        # Check the status of the step is set correctly in the files.
        result = TweakRegStep.call(rtdata.input)
    
>       for fi in result._models:
E       AttributeError: 'builtin_function_or_method' object has no attribute '_models'

/data1/jenkins/workspace/RT/JWST-Developers-Pull-Requests/clone/jwst/regtest/test_niriss_image.py:65: AttributeError

Am I returning something incorrect or is this a recently added test that is setup in a different way that we had before. I need help with this. Thanks!

@mcara
Copy link
Member Author

mcara commented May 16, 2024

@mcara
Copy link
Member Author

mcara commented May 16, 2024

I think, @nden, these lines are causing an issue:

# Check the status of the step is set correctly in the files.
result = TweakRegStep.call(rtdata.input)

And since you already run the step above this call, I do not think this is necessary as the step should set skipped flag as @braingram mentioned above. You can just check it (lines below).

@mcara
Copy link
Member Author

mcara commented May 16, 2024

I made a PR that I hope will fix this test: #8489

CHANGES.rst Outdated Show resolved Hide resolved
jwst/tweakreg/tweakreg_step.py Outdated Show resolved Hide resolved
CHANGES.rst Outdated Show resolved Hide resolved
jwst/tweakreg/tweakreg_step.py Outdated Show resolved Hide resolved
jwst/tweakreg/tweakreg_step.py Outdated Show resolved Hide resolved
@hbushouse
Copy link
Collaborator

@mcara Still need to address most recent comments and fix conflict that now exists in tweakreg_step.py

@mcara
Copy link
Member Author

mcara commented May 23, 2024

@hbushouse

@mcara Still need to address most recent comments and fix conflict that now exists in tweakreg_step.py

My apologies: somehow I thought I pushed latest changes last Friday.

@braingram
Copy link
Collaborator

Would you add a unit test (or 2) to verify the check. It would be helpful to avoid losing this in a refactor.

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.

None yet

4 participants