-
Notifications
You must be signed in to change notification settings - Fork 32
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
JP-3502: Extend snowball flags to next integration #238
JP-3502: Extend snowball flags to next integration #238
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #238 +/- ##
==========================================
- Coverage 85.98% 85.90% -0.08%
==========================================
Files 35 35
Lines 6542 6557 +15
==========================================
+ Hits 5625 5633 +8
- Misses 917 924 +7 ☔ View full report in Codecov by Sentry. |
@@ -54,6 +54,8 @@ def detect_jumps( | |||
minimum_groups=3, | |||
minimum_sigclip_groups=100, | |||
only_use_ints=True, | |||
mask_persist_grps_next_int=True, | |||
persist_grps_flagged=25, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function now has roughly 30 arguments. Would it be better served by using a class to contain the parameters, rather than continue to add parameters to this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it has a lot of parameters but users need to be able to tweak the parameters. Is there any cost to the large number of parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cost is readability and maintainability. Grouping various parameters into a class or classes makes the code easier to read, as well as easier to maintain, especially when adding a parameter that needs to be passed to subroutines. If you simply pass parameters, the function signature needs to be changed for all functions that need that parameter. If you use classes, those classes will be passed to the subroutines, so when you add a parameter to a class, no subroutine signature needs to be edited, since the parameter is contained in the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it is true that passing objects instead of primitives has advantages there are also disadvantages. APIs with only primitive parameters are easier to understand where the primitives are coming from. At the extreme, a function that has a single class as input in a black box. Someone browsing the code has more work to do than with primitive parameters.
Also, If we want to consolidate the parameters passed to detect_jump.py, I feel that the change should be in a separate PR. That would give us a working master to compare against.
What do you think?
-1, | ||
) | ||
persist_ellipse = persist_image[:, :, 2] | ||
persist_saty, persist_satx = np.where(persist_ellipse == 22) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is special about 22 here? A comment or declaring a descriptive variable with the value 22 would be good here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the comments in this section. Let me know, if you think it needs more details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't know why you use 22 instead of say 21 or 23.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No real reason that I can remember. There needs to be a number that I can use np.where to find the pixels that are affected. I'm sure there's a more elegant way to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be fine to make a comment saying this number could change and that this number was determined though trial and error and could be changed if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value of 22 is arbitrary. It just needs to be something that can be tested for to create the mask of pixels within the ellipse.
took suggestion Co-authored-by: Howard Bushouse <[email protected]>
fix spacing Co-authored-by: Howard Bushouse <[email protected]>
fuxed Co-authored-by: Howard Bushouse <[email protected]>
resolving comments
…gan2/stcal into extend_snowball_to_next_int
-1, | ||
) | ||
persist_ellipse = persist_image[:, :, 2] | ||
persist_saty, persist_satx = np.where(persist_ellipse == 22) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't know why you use 22 instead of say 21 or 23.
@@ -54,6 +54,8 @@ def detect_jumps( | |||
minimum_groups=3, | |||
minimum_sigclip_groups=100, | |||
only_use_ints=True, | |||
mask_persist_grps_next_int=True, | |||
persist_grps_flagged=25, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cost is readability and maintainability. Grouping various parameters into a class or classes makes the code easier to read, as well as easier to maintain, especially when adding a parameter that needs to be passed to subroutines. If you simply pass parameters, the function signature needs to be changed for all functions that need that parameter. If you use classes, those classes will be passed to the subroutines, so when you add a parameter to a class, no subroutine signature needs to be edited, since the parameter is contained in the class.
Lots of CI failures that appear to be due to API changes in function calls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that the only outstanding (unresolved) comments are related to stylistic issues, and not actual problems with the code, I'm going to approve in order to get this moving.
@mwregan2 Doesn't this need a corresponding change in the jump_step.py module in the jwst package, in order to add the 2 new step arguments that've been implemented here and pass them to the |
I’ve got the branch ready. I do the PR today
From: Howard Bushouse ***@***.***>
Reply-To: spacetelescope/stcal ***@***.***>
Date: Wednesday, February 14, 2024 at 8:16 PM
To: spacetelescope/stcal ***@***.***>
Cc: Michael Regan ***@***.***>, Mention ***@***.***>
Subject: Re: [spacetelescope/stcal] JP-3502: Extend snowball flags to next integration (PR #238)
@mwregan2<https://urldefense.com/v3/__https:/github.com/mwregan2__;!!CrWY41Z8OgsX0i-WU-0LuAcUu2o!1NXfDtfYo8HSoZ6v0E7RmpmHHIKvFdjtrsWx0pLRSHeSgrttPx_cnJlh4CvFGoGwNYB0Aav6ilvQIzGqcsMHQ_E$> Doesn't this need a corresponding change in the jump_step.py module in the jwst package, in order to add the 2 new step arguments that've been implemented here and pass them to the detect_jumps function? I don't see an existing PR against jwst that contains such changes.
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/spacetelescope/stcal/pull/238*issuecomment-1945210344__;Iw!!CrWY41Z8OgsX0i-WU-0LuAcUu2o!1NXfDtfYo8HSoZ6v0E7RmpmHHIKvFdjtrsWx0pLRSHeSgrttPx_cnJlh4CvFGoGwNYB0Aav6ilvQIzGq1z4B65k$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AF6KJLQFEY6PRSEKWXYFFKDYTVOXZAVCNFSM6AAAAABBO36D5CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBVGIYTAMZUGQ__;!!CrWY41Z8OgsX0i-WU-0LuAcUu2o!1NXfDtfYo8HSoZ6v0E7RmpmHHIKvFdjtrsWx0pLRSHeSgrttPx_cnJlh4CvFGoGwNYB0Aav6ilvQIzGq_y9CDjw$>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Resolves JP-3502
Closes spacetelescope/jwst#8174
This PR addresses the problem that the saturated core of snowballs shows up in the next integration with an excess count rate that takes a long time to decay. The solution is to mark as jump a number of groups passed in from JWST Jump.
Checklist
CHANGES.rst
(either inBug Fixes
orChanges to API
)