-
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
Pull common parts of skymatch from romancal and jwst into stcal #310
base: main
Are you sure you want to change the base?
Pull common parts of skymatch from romancal and jwst into stcal #310
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #310 +/- ##
===========================================
+ Coverage 29.57% 85.05% +55.47%
===========================================
Files 36 53 +17
Lines 7949 10028 +2079
===========================================
+ Hits 2351 8529 +6178
+ Misses 5598 1499 -4099 ☔ View full report in Codecov by Sentry. |
c7e296c
to
9ab3734
Compare
9ed58df
to
cfaf7eb
Compare
ba12908
to
2aee80f
Compare
2aee80f
to
6202d38
Compare
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 looks great, thanks William! I just had a few questions about whether some of the ruff and mypy problems could be fixed instead of ignored.
I also had a few questions about the code itself, but those also exist on jwst main, so they're technically beyond the scope of this PR. But I'm still curious to know the answers to those and I figure now is as good a time as any to ensure the code is written as cleanly as possible
pix_area=1.0, | ||
convf=1.0, | ||
mask=None, | ||
id=None, # noqa: A002 |
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.
instead of hiding the style complaint could this be renamed?
The functionality to support this conversion is not yet | ||
implemented and at this moment `convf` is ignored. |
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.
Are there plans to implement this? If not, perhaps now is a good time to remove the option
@property | ||
def id(self): # noqa: A003 |
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 know you most likely just copied all of this from JWST, so not strictly in the scope of this PR, but is there a reason that getter-setter methods are being used here for id
, pix_area
, sky
, is_sky_valid
, radec
, polygon
, and skystat
? These don't seem to add any functionality.
These do make it so that this class has the same underscore-protected variable names as SkyGroup
, but is there any reason that has to be the case?
|
||
""" | ||
|
||
def __init__(self, images, id=None, sky=0.0): # noqa: A002 |
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.
again here can id
be renamed instead?
for im in self._images: | ||
im.sky += sky | ||
|
||
@property |
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.
same question here RE why id
, polygon
, and radec
go through the trouble to use @property
log.setLevel(logging.DEBUG) | ||
|
||
|
||
def match(images, skymethod="global+match", match_down=True, subtract=False): |
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 name also violates https://docs.astral.sh/ruff/rules/builtin-variable-shadowing/ and will likely be changed in JWST by spacetelescope/jwst#9053 to be skymatch()
from copy import deepcopy | ||
|
||
# THIRD PARTY | ||
from stsci.imagestats import ImageStats # type: ignore[import-untyped] |
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.
might be worth considering making the relevant third-party type ignores global by putting them here
Line 212 in d6a87c3
[[tool.mypy.overrides]] |
This is a superclass build on top of | ||
:py:class:`stsci.imagestats.ImageStats`. Compared to |
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 comment is confusing because the class doesn't actually inherit from ImageStats
I agree they should be fixed. However, as you said they are beyond the scope of this PR. I think for making it possible to trace the history of changes it makes sense to move the code in as close a state as possible from JWST to stcal and then do a follow on PR making cleanups and addressing the issues uncovered here. |
This PR pulls the common parts of skymatch from romancal and jwst into stcal to be shared.
Note, no tests are included because it is well tested by the step tests in both romancal and jwst.
Tasks
docs/
pageno-changelog-entry-needed
)changes/
:echo "changed something" > changes/<PR#>.<changetype>.rst
(see below for change types)"git+https://github.com/<fork>/stcal@<branch>"
)jwst
regression testromancal
regression testnews fragment change types...
changes/<PR#>.apichange.rst
: change to public APIchanges/<PR#>.bugfix.rst
: fixes an issuechanges/<PR#>.general.rst
: infrastructure or miscellaneous change