Skip to content

Commit

Permalink
Initialize ._detectors upon creation
Browse files Browse the repository at this point in the history
Had to catch the case where detector_list isn't passed, which happens in testing. Figured a warning wouldn't hurt, as this case shouldn't occur in regular operation.
  • Loading branch information
teutoburg committed Jun 28, 2024
1 parent 207be57 commit b519aed
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scopesim/detector/detector_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ def __init__(self, detector_list=None, cmds=None, **kwargs):
self._array_effects: list[Effect] = []
self._dtcr_effects: list[Effect] = []
self._detectors: list[Detector] = []
if self._detector_list is not None:
self._detectors = [
Detector(hdr, cmds=self.cmds, **self.meta)
for hdr in self._detector_list.detector_headers()]
else:
logger.warning("No detector effect was passed, cannot fully "
"initialize detector manager.")

self._latest_exposure: HDUList | None = None

Expand Down Expand Up @@ -83,11 +90,7 @@ def readout(self, image_planes, array_effects=None, dtcr_effects=None,
for effect in self._array_effects:
image_plane = effect.apply_to(image_plane, **self.meta)

# 3. make a series of Detectors for each row in a DetectorList object
self._detectors = [Detector(hdr, cmds=self.cmds, **self.meta)
for hdr in self._detector_list.detector_headers()]

# 4. iterate through all Detectors, extract image from image_plane
# 3. iterate through all Detectors, extract image from image_plane
logger.info("Extracting from %d detectors...", len(self))
for detector in self:
detector.extract_from(image_plane)
Expand Down

0 comments on commit b519aed

Please sign in to comment.