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-34340: Adapt to daf_butler API changes. #284

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions python/lsst/ip/isr/isrTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
from .deferredCharge import DeferredChargeTask
from .isrStatistics import IsrStatisticsTask
from .ptcDataset import PhotonTransferCurveDataset
from lsst.daf.butler import DimensionGraph


def crosstalkSourceLookup(datasetType, registry, quantumDataId, collections):
Expand All @@ -72,8 +71,8 @@ def crosstalkSourceLookup(datasetType, registry, quantumDataId, collections):
Dataset to lookup.
registry : `lsst.daf.butler.Registry`
Butler registry to query.
quantumDataId : `lsst.daf.butler.ExpandedDataCoordinate`
Data id to transform to identify crosstalkSources. The
quantumDataId : `lsst.daf.butler.DataCoordinate`
Expanded data id to transform to identify crosstalkSources. The
``detector`` entry will be stripped.
collections : `lsst.daf.butler.CollectionSearch`
Collections to search through.
Expand All @@ -84,15 +83,16 @@ def crosstalkSourceLookup(datasetType, registry, quantumDataId, collections):
List of datasets that match the query that will be used as
crosstalkSources.
"""
newDataId = quantumDataId.subset(DimensionGraph(registry.dimensions, names=["instrument", "exposure"]))
newDataId = quantumDataId.subset(registry.dimensions.conform(["instrument", "exposure"]))
TallJimbo marked this conversation as resolved.
Show resolved Hide resolved
results = set(registry.queryDatasets(datasetType, collections=collections, dataId=newDataId,
findFirst=True))
# In some contexts, calling `.expanded()` to expand all data IDs in the
# query results can be a lot faster because it vectorizes lookups. But in
# this case, expandDataId shouldn't need to hit the database at all in the
# steady state, because only the detector record is unknown and those are
# cached in the registry.
return [ref.expanded(registry.expandDataId(ref.dataId, records=newDataId.records)) for ref in results]
records = {k: newDataId.records[k] for k in newDataId.dimensions.elements}
return [ref.expanded(registry.expandDataId(ref.dataId, records=records)) for ref in results]


class IsrTaskConnections(pipeBase.PipelineTaskConnections,
Expand Down