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

RCAL-919: Formalize the patches (sky cells) file (e.g., add a data model to support it as a reference fiel) #441

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

perrygreenfield
Copy link
Collaborator

Resolves RCAL-919

This PR addresses the addition of a data model to support the skycells definition file as a reference file.

This file does not meet all the expectations of previous reference files, e.g., omitting optical_element as that is not currently relevant, so it was necessary to put conditional checks in the testing modules to deal with this.

A utility to create this reference file from an ASDF file containing the two expected tables is also included in this PR. I'm not sure it belongs, but it may be of use. (maker_utils/mk_skycell_ref.py)

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 18.18182% with 9 lines in your changes missing coverage. Please review.

Project coverage is 22.92%. Comparing base (087a60d) to head (3ffd496).
Report is 86 commits behind head on main.

Files with missing lines Patch % Lines
tests/test_models.py 0.00% 6 Missing ⚠️
tests/test_maker_utils.py 0.00% 2 Missing ⚠️
tests/test_open.py 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (087a60d) and HEAD (3ffd496). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (087a60d) HEAD (3ffd496)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #441       +/-   ##
===========================================
- Coverage   97.56%   22.92%   -74.65%     
===========================================
  Files          30       19       -11     
  Lines        2788     1863      -925     
===========================================
- Hits         2720      427     -2293     
- Misses         68     1436     +1368     

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

Copy link
Collaborator

@braingram braingram left a comment

Choose a reason for hiding this comment

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

A few comments about the naming and the maker utils functions.

@@ -302,6 +302,10 @@ class ReadnoiseRefModel(_DataModel):
_node_type = stnode.ReadnoiseRef


class RomanSkycellsRefModel(_DataModel):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
class RomanSkycellsRefModel(_DataModel):
class SkycellsRefModel(_DataModel):

Do we need the Roman prefix?

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 mulled over that, more for the filename than for the class (which is clearly associated with Roman in its context). I worry that the reference file by itself may need a clear association with Roman in the event skycells end up being used for other telescopes (like JWST). It is a good question.

Comment on lines +768 to +769
meta["nxy_skycell"] = 5000
meta["skycell_border_pixels"] = 100
meta["plate_scale"] = 0.055
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
meta["nxy_skycell"] = 5000
meta["skycell_border_pixels"] = 100
meta["plate_scale"] = 0.055
meta["nxy_skycell"] = kwargs.get("nxy_skycell", 5000)
meta["skycell_border_pixels"] = kwargs.get("skycell_border_pixels", 100)
meta["plate_scale"] = kwargs.get("plate_scale", 0.055)

Any reason to not use kwargs here like in the other mk_* functions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Probably not, but I'm loathe to make changes until the naming stuff and file structure is settled.

("dec_corn4", "<f8"),
]
)
proj_tab = np.array(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to fill these with empty arrays with the structured dtype rather than hard-coding data here?

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 think so, though there is a minor benefit for showing realistic values. I'm happy to change it though (after this whole name business is settled.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like every other file in this submodule is prefixed with _ and the only "public" API is 2 functions in __init__.py.

If I remove this file I can still make a RomanSkycellsRefModel with:

mk.mk_datamodel(rdm.RomanSkycellsRefModel)

I think mk_roman_skycells in _ref_files.py can be updated (to match the other maker utils) to accept kwargs for projection_regions, skycells etc to provide a way to make skycell reference files. That would allow removal of this file and make the creation of the skycell reference file consistent with the other reference files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK/

@schlafly
Copy link
Collaborator

When ready, we should ask Dario to try to install & use this branch to make sure he thinks everything fits. Should that happen now, or should we wait until tests pass?

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.

3 participants