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-29794: Do not try to persist PSFs that are not persistable #375

Merged
merged 1 commit into from
Apr 21, 2021
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
14 changes: 14 additions & 0 deletions python/lsst/obs/base/exposureAssembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@

"""Support for assembling and disassembling afw Exposures."""

import logging

# Need to enable PSFs to be instantiated
import lsst.afw.detection # noqa: F401
from lsst.afw.image import makeExposure, makeMaskedImage

from lsst.daf.butler import StorageClassDelegate

log = logging.getLogger(__name__)


class ExposureAssembler(StorageClassDelegate):

Expand Down Expand Up @@ -150,6 +154,11 @@ def disassemble(self, composite):
lookups.
TypeError
The parent object does not match the supplied `self.storageClass`.

Notes
-----
If a PSF is present but is not persistable, the PSF will not be
included in the returned components.
"""
if not self.storageClass.validateInstance(composite):
raise TypeError("Unexpected type mismatch between parent and StorageClass"
Expand All @@ -166,6 +175,11 @@ def disassemble(self, composite):
subset=expInfoItems, override=composite.getInfo())
components.update(fromExposureInfo)

if "psf" in components and not components["psf"].component.isPersistable():
log.warning("PSF of type %s is not persistable and has been ignored.",
type(components["psf"].component).__name__)
del components["psf"]

return components

def assemble(self, components):
Expand Down