From 9736efd28f13ad7eceb31fd4fab142c63a573e98 Mon Sep 17 00:00:00 2001 From: Arun Kannawadi Date: Thu, 20 Nov 2025 15:41:35 -0500 Subject: [PATCH 1/5] Bump pyver to 3.13 in GHA --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ba9264cd..561c4ee5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - pyver: ["3.12"] + pyver: ["3.13"] runs-on: "ubuntu-latest" From a9e971de3548fddac60d8ae9716ac173247cc17f Mon Sep 17 00:00:00 2001 From: Arun Kannawadi Date: Thu, 20 Nov 2025 15:02:49 -0500 Subject: [PATCH 2/5] Define num_vertices correctly Without the parenthesis, num_vertices was taking boolean-like values coming from > rather than len(poly.getVertices()). --- python/lsst/cell_coadds/_fits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/lsst/cell_coadds/_fits.py b/python/lsst/cell_coadds/_fits.py index eaedddab..057f1278 100644 --- a/python/lsst/cell_coadds/_fits.py +++ b/python/lsst/cell_coadds/_fits.py @@ -681,7 +681,7 @@ def writeMultipleCellCoaddAsFits( number_of_vertices = [] polygon_vertices_array = [] for obs_id, poly in multiple_cell_coadd.common.visit_polygons.items(): - if num_vertices := len(poly.getVertices()) > MAX_POLYGON_VERTICES: + if (num_vertices := len(poly.getVertices())) > MAX_POLYGON_VERTICES: logger.warning( "Visit %d, detector %d has a polygon with %d vertices. " "This geometry should be impossible for two intersecting " From a1c3f8b0d61a9d6566d485dec5c042ad51d7a69a Mon Sep 17 00:00:00 2001 From: Arun Kannawadi Date: Thu, 20 Nov 2025 15:06:31 -0500 Subject: [PATCH 3/5] Default to zero weight For edgeless cell-coadds, the visit polygons would include partially overlapping (detector, visit) combinations, while inputs refer to those that went into the coadd. The latter is a subset of the former. --- python/lsst/cell_coadds/_stitched_coadd.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/lsst/cell_coadds/_stitched_coadd.py b/python/lsst/cell_coadds/_stitched_coadd.py index 901b4ab6..09dd12a4 100644 --- a/python/lsst/cell_coadds/_stitched_coadd.py +++ b/python/lsst/cell_coadds/_stitched_coadd.py @@ -203,7 +203,12 @@ def _make_coadd_inputs(self) -> CoaddInputs: ccd_record = coadd_inputs.ccds.addNew() ccd_record["visit"] = obs_id.visit ccd_record["ccd"] = obs_id.detector - ccd_record["weight"] = weights[obs_id] + # ObservationIdentifiers in the inputs is a proper subset of those + # denoting the visit polygons. For edgeless coadds, some + # identifiers may not be present in weights and we take that to + # mean that they were excluded from the coadds (and hence have + # zero weight). + ccd_record["weight"] = weights.get(obs_id, 0.0) ccd_record.setBBox(Box2I()) # Dummy bbox; not used. ccd_record.validPolygon = polygon From 434fcf350c546ce5f755fc92ec7efb4fe0ecec18 Mon Sep 17 00:00:00 2001 From: Arun Kannawadi Date: Thu, 20 Nov 2025 23:37:39 -0500 Subject: [PATCH 4/5] Construct internal visit_dict from VISIT_SUMMARY if available. --- python/lsst/cell_coadds/_fits.py | 34 ++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/python/lsst/cell_coadds/_fits.py b/python/lsst/cell_coadds/_fits.py index 057f1278..95432aff 100644 --- a/python/lsst/cell_coadds/_fits.py +++ b/python/lsst/cell_coadds/_fits.py @@ -298,13 +298,22 @@ def readAsMultipleCellCoadd(self) -> MultipleCellCoadd: ) visit_polygons = {} if written_version >= version.parse("0.3"): + if written_version >= version.parse("0.6"): + visit_hdu = hdu_list[hdu_list.index_of("VISIT_SUMMARY")].data + else: + visit_hdu = hdu_list[hdu_list.index_of("VISIT")].data + visit_dict = { row["visit"]: VisitRecord( visit=row["visit"], - physical_filter=row["physical_filter"], - day_obs=row["day_obs"], + physical_filter=( + row["physical_filter"] + if written_version >= version.parse("0.8") + else header["FILTER"] + ), + day_obs=row["day_obs"] if written_version >= version.parse("0.8") else 00000000, ) - for row in hdu_list[hdu_list.index_of("VISIT")].data + for row in visit_hdu } link_table = hdu_list[hdu_list.index_of("CELL")].data @@ -678,6 +687,16 @@ def writeMultipleCellCoaddAsFits( format="I", array=[obs_id.detector for obs_id in multiple_cell_coadd.common.visit_polygons], ) + physical_filter_column = fits.Column( + name="physical_filter", + format="32A", + array=[obs_id.physical_filter for obs_id in multiple_cell_coadd.common.visit_polygons], + ) + day_obs_column = fits.Column( + name="day_obs", + format="K", + array=[obs_id.day_obs for obs_id in multiple_cell_coadd.common.visit_polygons], + ) number_of_vertices = [] polygon_vertices_array = [] for obs_id, poly in multiple_cell_coadd.common.visit_polygons.items(): @@ -708,7 +727,14 @@ def writeMultipleCellCoaddAsFits( array=number_of_vertices, ) visit_summary_hdu = fits.BinTableHDU.from_columns( - [visit_column, detector_column, number_of_vertices_column, polygon_column], + [ + visit_column, + detector_column, + physical_filter_column, + day_obs_column, + number_of_vertices_column, + polygon_column, + ], name="VISIT_SUMMARY", ) visit_summary_hdu.header["POLYVERT"] = MAX_POLYGON_VERTICES From 5212ed19d67f8c82448331c14701ca5966a993d1 Mon Sep 17 00:00:00 2001 From: Arun Kannawadi Date: Fri, 21 Nov 2025 00:02:03 -0500 Subject: [PATCH 5/5] Bump FILE_FORMAT_VERSION to 0.8 --- python/lsst/cell_coadds/_fits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/lsst/cell_coadds/_fits.py b/python/lsst/cell_coadds/_fits.py index 95432aff..569b7c3d 100644 --- a/python/lsst/cell_coadds/_fits.py +++ b/python/lsst/cell_coadds/_fits.py @@ -114,7 +114,7 @@ from ._uniform_grid import UniformGrid from .typing_helpers import SingleCellCoaddApCorrMap -FILE_FORMAT_VERSION = "0.7" +FILE_FORMAT_VERSION = "0.8" """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. """