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

DM-48282: Refactor obscore to allow subclasses #1142

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

Conversation

timj
Copy link
Member

@timj timj commented Jan 15, 2025

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes
  • (if changing dimensions.yaml) make a copy of dimensions.yaml in configs/old_dimensions

@timj timj requested a review from andy-slac January 15, 2025 18:39
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 68.57143% with 33 lines in your changes missing coverage. Please review.

Project coverage is 89.47%. Comparing base (c03a7ff) to head (0010367).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ython/lsst/daf/butler/registry/obscore/_records.py 67.32% 23 Missing and 10 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1142      +/-   ##
==========================================
- Coverage   89.50%   89.47%   -0.04%     
==========================================
  Files         366      366              
  Lines       49015    49065      +50     
  Branches     5941     5950       +9     
==========================================
+ Hits        43872    43899      +27     
- Misses       3728     3748      +20     
- Partials     1415     1418       +3     

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

Copy link
Contributor

@andy-slac andy-slac left a comment

Choose a reason for hiding this comment

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

Looks good. One thing that I'm not sure about is whether it's easier to specify record factory type in obscore config vs. entry point.

@@ -96,7 +99,7 @@ class RecordFactory:
Registry dimensions universe.
spatial_plugins : `~collections.abc.Collection` of `SpatialObsCorePlugin`
Spatial plugins.
exposure_region_factory : `ExposureRegionFactory`, optional
derived_region_factory : `DerivedRegionFactory`, optional
Manager for Registry dimensions.
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like I copy-pasted this line long time ago and did not update, can you add a better description?

@@ -120,15 +123,122 @@ def __init__(
self.visit = universe["visit"]
self.physical_filter = cast(Dimension, universe["physical_filter"])

@abstractmethod
def region_dimension(self, dimensions: DimensionGroup) -> tuple[str | None, str | None]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Could just one of them be None? If not then tuple[str, str] | tuple[None, None] could be better?

Comment on lines +328 to +329
@classmethod
def get_record_type_from_universe(cls, universe: DimensionUniverse) -> type[RecordFactory]:
Copy link
Contributor

Choose a reason for hiding this comment

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

We could potentially specify the type in the obscore config itself?

spatial_plugins : `~collections.abc.Collection` of `SpatialObsCorePlugin`
Spatial plugins.
derived_region_factory : `DerivedRegionFactory`, optional
Manager for Registry dimensions.
Copy link
Contributor

Choose a reason for hiding this comment

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

This too wants an update.

# should be used for the RecordFactory for this universe.
record_factory_type = func()
if not issubclass(record_factory_type, RecordFactory):
raise ValueError(
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe TypeError?

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