Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions python/lsst/cell_coadds/_coadd_ap_corr_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ def _setup_ap_corr_names(self, ap_corr_map: ApCorrMap) -> None:

self._ap_corr_names = tuple(sorted(ap_corr_name_set))

def reset(self) -> None:
"""Reset to the post-initialization state."""
self._total_weight = 0.0
self._intermediate_ap_corr_map = {}
self._ap_corr_names = ()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good for now, but in the future, we should remove these lines from __init__ and just call reset there.

@property
def evaluation_point(self) -> Point2D:
"""The point at which the aperture correction is evaluated."""
Expand Down
10 changes: 9 additions & 1 deletion python/lsst/cell_coadds/_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
from ._uniform_grid import UniformGrid
from .typing_helpers import SingleCellCoaddApCorrMap

FILE_FORMAT_VERSION = "0.8"
FILE_FORMAT_VERSION = "0.9"
"""Version number for the file format as persisted, presented as a string of
the form M.m, where M is the major version, m is the minor version.
"""
Expand Down Expand Up @@ -301,6 +301,7 @@ def readAsMultipleCellCoadd(self) -> MultipleCellCoadd:
coadd_input = CoaddInputs( # default version for written_version <= 0.5.
overlaps_center=True,
overlap_fraction=1.0,
unmasked_overlap_fraction=1.0,
weight=0.0,
psf_shape=afwGeom.Quadrupole(),
psf_shape_flag=True,
Expand Down Expand Up @@ -373,6 +374,11 @@ def readAsMultipleCellCoadd(self) -> MultipleCellCoadd:
coadd_input = CoaddInputs(
overlaps_center=link_row["overlaps_center"],
overlap_fraction=link_row["overlap_fraction"],
unmasked_overlap_fraction=(
link_row["unmasked_overlap_fraction"]
if written_version >= version.parse("0.9")
else link_row["overlap_fraction"]
),
weight=link_row["weight"],
psf_shape=afwGeom.Quadrupole(
ixx=link_row["psf_shape_ixx"],
Expand Down Expand Up @@ -674,6 +680,7 @@ def writeMultipleCellCoaddAsFits(
observation_id.detector,
coadd_input.overlaps_center,
coadd_input.overlap_fraction,
coadd_input.unmasked_overlap_fraction,
coadd_input.weight,
coadd_input.psf_shape.getIxx(),
coadd_input.psf_shape.getIyy(),
Expand Down Expand Up @@ -769,6 +776,7 @@ def writeMultipleCellCoaddAsFits(
"detector",
"overlaps_center",
"overlap_fraction",
"unmasked_overlap_fraction",
"weight",
"psf_shape_ixx",
"psf_shape_iyy",
Expand Down
18 changes: 15 additions & 3 deletions python/lsst/cell_coadds/_single_cell_coadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ class CoaddInputs:
"""Container for inputs to the coaddition process."""

overlaps_center: bool
"""Whether a single (detector, visit) observation overlaps the center """
"""of the cell."""
"""Whether a single (detector, visit) observation overlaps the center
of the cell."""

overlap_fraction: float
"""Fraction of the cell that is covered by the overlap region."""

unmasked_overlap_fraction: float
"""Fraction of the cell covered by this detector, excluding
rejected pixels."""

weight: float
"""Weight to be used for this input."""

Expand Down Expand Up @@ -119,7 +123,15 @@ def __init__(
self._inputs: Mapping[ObservationIdentifiers, CoaddInputs]
if inputs:
self._inputs = dict.fromkeys(
sorted(set(inputs)), CoaddInputs(False, 0.0, 0.0, Quadrupole(), True)
sorted(set(inputs)),
CoaddInputs(
overlaps_center=False,
overlap_fraction=0.0,
unmasked_overlap_fraction=0.0,
weight=0.0,
psf_shape=Quadrupole(),
psf_shape_flag=True,
),
)
self._inputs.update(inputs)
else:
Expand Down
11 changes: 6 additions & 5 deletions tests/test_coadds.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,15 @@ def setUpClass(cls) -> None:
detector=67,
day_obs=20000101,
): CoaddInputs(
True,
1.0,
1.0,
Quadrupole(
overlaps_center=True,
overlap_fraction=1.0,
unmasked_overlap_fraction=1.0,
weight=1.0,
psf_shape=Quadrupole(
cls.psf_sigmas[Index2D(x=x, y=y)] ** 2,
cls.psf_sigmas[Index2D(x=x, y=y)] ** 2,
),
False,
psf_shape_flag=False,
)
},
common=common,
Expand Down
Loading