diff --git a/python/lsst/obs/base/_instrument.py b/python/lsst/obs/base/_instrument.py index 9f4f4f7d..782d4ee3 100644 --- a/python/lsst/obs/base/_instrument.py +++ b/python/lsst/obs/base/_instrument.py @@ -493,7 +493,7 @@ class attribute for curated calibrations corresponding to the # by putting them in the ``runs`` set that was passed in. camera = self.getCamera() filters = set(self.filterDefinitions.physical_to_band.keys()) - calib_dimensions: list[Any] + calib_dimensions: list[str] if datasetType.name in StandardCuratedCalibrationDatasetTypes: calib_dimensions = list(StandardCuratedCalibrationDatasetTypes[datasetType.name]["dimensions"]) else: @@ -503,7 +503,7 @@ class attribute for curated calibrations corresponding to the "Unknown curated calibration type %s. Attempting to use supplied definition.", datasetType.name, ) - calib_dimensions = list(datasetType.dimensions) + calib_dimensions = list(datasetType.dimensions.names) calibsDict, calib_type = read_all(calibPath, camera, calib_class, calib_dimensions, filters) @@ -667,7 +667,7 @@ def loadCamera(butler: Butler, dataId: DataId, *, collections: Any = None) -> tu # to ensure it only happens once. # This will also catch problems with the data ID not having keys we need. try: - dataId = butler.registry.expandDataId(dataId, graph=butler.dimensions["exposure"].graph) + dataId = butler.registry.expandDataId(dataId, dimensions=butler.dimensions["exposure"].minimal_group) except DataIdError as exc: raise LookupError(str(exc)) from exc try: diff --git a/python/lsst/obs/base/defineVisits.py b/python/lsst/obs/base/defineVisits.py index e98b495b..17bc75e2 100644 --- a/python/lsst/obs/base/defineVisits.py +++ b/python/lsst/obs/base/defineVisits.py @@ -42,15 +42,7 @@ import lsst.geom from lsst.afw.cameraGeom import FOCAL_PLANE, PIXELS -from lsst.daf.butler import ( - Butler, - DataCoordinate, - DataId, - DimensionGraph, - DimensionRecord, - Progress, - Timespan, -) +from lsst.daf.butler import Butler, DataCoordinate, DataId, DimensionRecord, Progress, Timespan from lsst.geom import Box2D from lsst.pex.config import Config, Field, makeRegistry, registerConfigurable from lsst.pipe.base import Instrument, Task @@ -664,9 +656,9 @@ def run( """ # Normalize, expand, and deduplicate data IDs. self.log.info("Preprocessing data IDs.") - dimensions = DimensionGraph(self.universe, names=["exposure"]) + dimensions = self.universe.conform(["exposure"]) data_id_set: set[DataCoordinate] = { - self.butler.registry.expandDataId(d, graph=dimensions) for d in dataIds + self.butler.registry.expandDataId(d, dimensions=dimensions) for d in dataIds } if not data_id_set: raise RuntimeError("No exposures given.") diff --git a/python/lsst/obs/base/formatters/fitsExposure.py b/python/lsst/obs/base/formatters/fitsExposure.py index 58ada4f9..6e91e176 100644 --- a/python/lsst/obs/base/formatters/fitsExposure.py +++ b/python/lsst/obs/base/formatters/fitsExposure.py @@ -300,7 +300,7 @@ def getImageCompressionSettings(self, recipeName): recipe = self.writeRecipes[recipeName] # Set the seed based on dataId - seed = hash(tuple(self.dataId.items())) % 2**31 + seed = hash(tuple(self.dataId.required.items())) % 2**31 for plane in ("image", "mask", "variance"): if plane in recipe and "scaling" in recipe[plane]: scaling = recipe[plane]["scaling"] @@ -599,20 +599,20 @@ def _fixFilterLabels(self, file_filter_label, should_be_standardized=None): missing = [] band = None physical_filter = None - if "band" in self.dataId.graph.dimensions.names: + if "band" in self.dataId.dimensions.names: band = self.dataId.get("band") # band isn't in the data ID; is that just because this data ID # hasn't been filled in with everything the Registry knows, or # because this dataset is never associated with a band? - if band is None and not self.dataId.hasFull() and "band" in self.dataId.graph.implied.names: + if band is None and not self.dataId.hasFull() and "band" in self.dataId.dimensions.implied: missing.append("band") - if "physical_filter" in self.dataId.graph.dimensions.names: + if "physical_filter" in self.dataId.dimensions.names: physical_filter = self.dataId.get("physical_filter") # Same check as above for band, but for physical_filter. if ( physical_filter is None and not self.dataId.hasFull() - and "physical_filter" in self.dataId.graph.implied.names + and "physical_filter" in self.dataId.dimensions.implied ): missing.append("physical_filter") if should_be_standardized is None: diff --git a/python/lsst/obs/base/ingest.py b/python/lsst/obs/base/ingest.py index 17ee3fc2..f93cc561 100644 --- a/python/lsst/obs/base/ingest.py +++ b/python/lsst/obs/base/ingest.py @@ -887,7 +887,8 @@ def expandDataIds(self, data: RawExposureData) -> RawExposureData: for file in data.files: for dataset in file.datasets: dataset.dataId = self.butler.registry.expandDataId( - dataset.dataId, records=data.dataId.records + dataset.dataId, + records={k: data.dataId.records[k] for k in data.dataId.dimensions.elements}, ) return data