Skip to content

Commit

Permalink
Merge pull request #76 from lsst/tickets/DM-24355
Browse files Browse the repository at this point in the history
DM-24355: Make Instrument registration idempotent.
  • Loading branch information
TallJimbo committed Oct 16, 2020
2 parents a651515 + 5ac7580 commit cea5c83
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions python/lsst/obs/cfht/_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,29 @@ def _getCameraFromPath(path):
def register(self, registry):
camera = self.getCamera()
obsMax = 2**31
registry.insertDimensionData(
"instrument",
{"name": self.getName(), "detector_max": 36, "visit_max": obsMax, "exposure_max": obsMax,
"class_name": getFullTypeName(self),
}
)

for detector in camera:
registry.insertDimensionData(
"detector",
with registry.transaction():
registry.syncDimensionData(
"instrument",
{
"instrument": self.getName(),
"id": detector.getId(),
"full_name": detector.getName(),
"name_in_raft": detector.getName(),
"raft": None, # MegaPrime does not have rafts
"purpose": str(detector.getType()).split(".")[-1],
"name": self.getName(), "detector_max": 36, "visit_max": obsMax, "exposure_max": obsMax,
"class_name": getFullTypeName(self),
}
)

self._registerFilters(registry)
for detector in camera:
registry.syncDimensionData(
"detector",
{
"instrument": self.getName(),
"id": detector.getId(),
"full_name": detector.getName(),
"name_in_raft": detector.getName(),
"raft": None, # MegaPrime does not have rafts
"purpose": str(detector.getType()).split(".")[-1],
}
)

self._registerFilters(registry)

def getRawFormatter(self, dataId):
# local import to prevent circular dependency
Expand Down

0 comments on commit cea5c83

Please sign in to comment.