Skip to content

Commit

Permalink
Rename ExposureImageFactory to indicate that it can be more than expo…
Browse files Browse the repository at this point in the history
…sure
  • Loading branch information
timj committed Jan 17, 2025
1 parent 0e16041 commit bd4b5b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions python/lsst/daf/butler/registry/obscore/_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from ..interfaces import ObsCoreTableManager, VersionTuple
from ..queries import SqlQueryContext
from ._config import ConfigCollectionType, ObsCoreManagerConfig
from ._records import ExposureRegionFactory, Record, RecordFactory
from ._records import DerivedRegionFactory, Record, RecordFactory
from ._schema import ObsCoreSchema
from ._spatial import RegionTypeError, RegionTypeWarning, SpatialObsCorePlugin

Expand All @@ -63,7 +63,7 @@
_VERSION = VersionTuple(0, 0, 1)


class _ExposureRegionFactory(ExposureRegionFactory):
class _ExposureRegionFactory(DerivedRegionFactory):
"""Find exposure region from a matching visit dimensions records.
Parameters
Expand All @@ -79,7 +79,7 @@ def __init__(self, dimensions: DimensionRecordStorageManager, context: SqlQueryC
self.exposure_detector_dimensions = self.universe.conform(["exposure", "detector"])
self._context = context

def exposure_region(self, dataId: DataCoordinate) -> Region | None:
def derived_region(self, dataId: DataCoordinate) -> Region | None:
# Docstring is inherited from a base class.
context = self._context
# Make a relation that starts with visit_definition (mapping between
Expand Down
28 changes: 14 additions & 14 deletions python/lsst/daf/butler/registry/obscore/_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from __future__ import annotations

__all__ = ["ExposureRegionFactory", "Record", "RecordFactory"]
__all__ = ["DerivedRegionFactory", "Record", "RecordFactory"]

import logging
import warnings
Expand Down Expand Up @@ -63,17 +63,17 @@
}


class ExposureRegionFactory:
"""Abstract interface for a class that returns a Region for an exposure."""
class DerivedRegionFactory:
"""Abstract interface for a class that returns a Region for a data ID."""

@abstractmethod
def exposure_region(self, dataId: DataCoordinate) -> Region | None:
"""Return a region for a given DataId that corresponds to an exposure.
def derived_region(self, dataId: DataCoordinate) -> Region | None:
"""Return a region for a given DataId that may have been derived.
Parameters
----------
dataId : `DataCoordinate`
Data ID for an exposure dataset.
Data ID for the relevant dataset.
Returns
-------
Expand All @@ -99,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.
"""

Expand All @@ -109,12 +109,12 @@ def __init__(
schema: ObsCoreSchema,
universe: DimensionUniverse,
spatial_plugins: Collection[SpatialObsCorePlugin],
exposure_region_factory: ExposureRegionFactory | None = None,
derived_region_factory: DerivedRegionFactory | None = None,
):
self.config = config
self.schema = schema
self.universe = universe
self.exposure_region_factory = exposure_region_factory
self.derived_region_factory = derived_region_factory
self.spatial_plugins = spatial_plugins

# All dimension elements used below.
Expand Down Expand Up @@ -360,7 +360,7 @@ class DafButlerRecordFactory(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.
"""

Expand All @@ -370,14 +370,14 @@ def __init__(
schema: ObsCoreSchema,
universe: DimensionUniverse,
spatial_plugins: Collection[SpatialObsCorePlugin],
exposure_region_factory: ExposureRegionFactory | None = None,
derived_region_factory: DerivedRegionFactory | None = None,
):
super().__init__(
config=config,
schema=schema,
universe=universe,
spatial_plugins=spatial_plugins,
exposure_region_factory=exposure_region_factory,
derived_region_factory=derived_region_factory,
)

# All dimension elements used below.
Expand Down Expand Up @@ -411,8 +411,8 @@ def make_universe_records(self, ref: DatasetRef) -> Record:
if self.exposure.name in dataId:
if (dimension_record := dataId.records[self.exposure.name]) is not None:
self._exposure_records(dimension_record, record)
if self.exposure_region_factory is not None:
region = self.exposure_region_factory.exposure_region(dataId)
if self.derived_region_factory is not None:
region = self.derived_region_factory.derived_region(dataId)
elif self.visit.name in dataId and (dimension_record := dataId.records[self.visit.name]) is not None:
self._visit_records(dimension_record, record)

Expand Down

0 comments on commit bd4b5b1

Please sign in to comment.