Skip to content
Open
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
77 changes: 77 additions & 0 deletions astra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2407,3 +2407,80 @@ analyses:
quote:
exact: 's + 2σs > 0.0003'
location: { page: 5 }

# ═════════════════════════════════════════════════════════════════════════
survey_publication:
description: >-
The survey products: per-tile catalogues and per-exposure stars and maps
partitioned into fixed order-5 HEALPix pixels and published as HATS
(catalogues) and HEALSparse (maps), built on Nibi and Fir from one
rule-defined tile list.
inputs:
- id: tile_final_cat_published
type: data
source: catalogue_assembly tile_final_cat, exposure star catalogues and map fragments
outputs:
- id: survey_hats
type: data
format: parquet
description: >-
The v2.0 galaxy and PSF-validation star HATS catalogues and the
npoint, ntaken, nexp and nflagged HEALSparse maps, one file per
order-5 pixel.
inputs: [tile_final_cat_published]
decisions: [tile_universe, seam_realization, pixel_completeness]
decisions:
tile_universe:
label: Dateline-redundant and polar-cap tiles are not in the catalogue
rationale: >-
The run-2 tile list excludes two sets by rule, applied where tiles
are planned rather than in any per-cluster skip file. For tile x.y,
dec = y/2 - 90; excluded when y >= 345 (Dec >= 82.5 deg, the image
does not cover the tile) or x >= 720 cos(dec) (nominal centre at or
past RA 360 deg, sky held by the RA~0 tiles). On the 23,114-tile DR6
list this removes the 181 cap and 32 dateline tiles of #969 plus 16
dateline tiles that straddle 360 deg (576k duplicate rows in run 1),
leaving 22,885.
Values: CAP_Y_MIN = 345.
default: excluded_by_rule
options:
excluded_by_rule:
label: Both sets removed from the tile list by a rule on the tile ID
cut_to_own_ra:
label: Keep dateline tiles, rows cut to their own RA range
excluded: true
excluded_reason: Needs code and recovers no sky the RA~0 tiles lack.
seam_realization:
label: Closure; a pixel's rows come from its owner's own runs
rationale: >-
Each cluster processes every tile and exposure whose footprint
touches one of its pixels and publishes only rows in its pixels.
A seam tile is computed on two clusters; each published row comes
from the run of its pixel's owner. Run 1 already mixes cluster
realizations between neighbouring tiles. The catalogue is built on
Nibi and Fir, which share one seam.
default: closure
options:
closure:
label: Owner recomputes every source touching its pixels
fragment_exchange:
label: One run per tile; seam rows exchanged between clusters
description: Not implemented.
pixel_completeness:
label: A pixel publishes once every source in its list has finished
rationale: >-
A pixel's tile list is every tile whose 0.4 deg enclosing cap
intersects it (exposures: those used by the listed tiles), fixed before
processing. The pixel is built when every listed source has a
terminal state in the run index. A source that failed after its
retries contributes no rows, as per_unit_completeness already
keeps a failed unit out. The file is written once.
Values: TILE_CAP_DEG = 0.4.
default: wait_for_all
options:
wait_for_all:
label: Build when every listed source has finished
publish_partial:
label: Publish early, replace as sources finish
excluded: true
excluded_reason: Readers would get a pixel whose rows change under them.
17 changes: 16 additions & 1 deletion src/shapepipe/modules/merge_starcat_package/merge_starcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

"""

import os
import re

import numpy as np
Expand Down Expand Up @@ -655,6 +656,9 @@ def process(self):
# is the widest CCD number in the campaign, which pass 1 already knows.
width = max((len(self._ccd_nb(n)) for n in names), default=1)
data["CCD_NB"] = np.empty(n_total, dtype=f"U{width}")
data["EXP_ID"] = np.empty(n_total, dtype="U64")
data["SOURCE_ORDINAL"] = np.empty(n_total, dtype=np.int64)
seen_keys = set()

# --- pass 2: fill ---------------------------------------------------
at = 0
Expand All @@ -675,7 +679,18 @@ def process(self):
# Use this file's schema: zero-fill only the files
# that actually lack the column.
data[out][sl] = data_j[col] if col in have else 0
data["CCD_NB"][sl] = self._ccd_nb(name[0])
ccd = self._ccd_nb(name[0])
basename = os.path.basename(name[0])
exp = basename.removesuffix(".fits").removeprefix("validation_psf-").rsplit("-", 1)[0]
if not exp or len(exp) > 64 or not exp.isascii():
raise ValueError(f"invalid exposure ID in {basename!r}")
key = (exp, int(ccd))
if key in seen_keys:
raise ValueError(f"duplicate exposure/CCD member: {key}")
seen_keys.add(key)
data["CCD_NB"][sl] = ccd
data["EXP_ID"][sl] = exp
data["SOURCE_ORDINAL"][sl] = np.arange(n_rows, dtype=np.int64)

at += n_rows
starcat_j.close()
Expand Down
16 changes: 16 additions & 0 deletions src/shapepipe/modules/psfex_interp_package/psfex_interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,13 @@ def _write_output_validation(self, star_dict, psfex_cat_dict):

Save computed PSFs and stars to fits file.

@sc [label:schema] star-key-unique
Each row carries the exposure ID, CCD and zero-based ordinal within
that CCD, so their tuple is unique. Exposure IDs remain strings to
preserve leading zeros. Both merges reconstruct these fields for older
files; test_star_key_unique checks the merged rows and
test_validation_writer_emits_star_keys checks the emitter.

@sc [label:schema] psfex-validation-hsm-columns
Writes ``_hsm_columns`` for both ``PSF`` and ``STAR`` — the exact
``HSM_*`` set ``MergeStarCatPSFEX.process`` reads without fallback;
Expand All @@ -788,6 +795,15 @@ def _write_output_validation(self, star_dict, psfex_cat_dict):
}
data = {**data, **star_dict}

# The runner's file number is -<exposure>-<CCD>.
exp, ccd = self._img_number.lstrip("-").rsplit("-", 1)
if not exp or not ccd.isdigit():
raise ValueError(f"invalid exposure/CCD identifier: {self._img_number!r}")
n_rows = len(data["NUMBER"])
data["EXP_ID"] = np.full(n_rows, exp)
data["CCD_NB"] = np.full(n_rows, int(ccd), dtype=np.int32)
data["SOURCE_ORDINAL"] = np.arange(n_rows, dtype=np.int64)

data["ACCEPTED"] = np.ones_like(data["NUMBER"], dtype="int16")
star_used = psfex_cat_dict.pop("SOURCE_NUMBER")

Expand Down
216 changes: 216 additions & 0 deletions tests/fixtures/run2/excluded_reference.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
# MegaPipe 2026-04 r tiles removed from tiles_r.txt: they never enter the shape catalogue (CosmoStat/shapepipe#900).
# Dateline duplicates (32): an off-by-one at the RA = 360 deg wrap; each lies at RA 360-361.3 deg and covers sky that tiles near RA 0 already hold.
572.255
576.254
580.253
583.252
584.252
587.251
591.250
594.249
598.248
601.247
608.245
615.243
618.242
621.241
622.241
625.240
628.239
631.238
634.237
637.236
640.235
643.234
645.233
646.233
648.232
649.232
651.231
654.230
656.229
657.229
659.228
661.227
# Dec >= 82.5 deg (181; tile index y >= 345): the default MegaPipe tile image does not cover the full tile.
024.348
024.350
025.348
025.349
025.350
026.347
026.348
026.349
026.350
027.346
027.347
027.348
027.349
027.350
027.351
028.346
028.347
028.348
028.349
028.350
028.351
029.345
029.346
029.347
029.348
029.349
029.350
029.351
030.345
030.346
030.347
030.348
030.349
030.350
030.351
031.345
031.346
031.347
031.348
031.349
031.350
031.351
032.345
032.346
032.347
032.348
032.349
032.350
032.351
033.345
033.346
033.347
033.348
033.349
033.350
033.351
034.345
034.346
034.347
034.348
034.349
034.350
034.351
035.345
035.346
035.347
035.348
035.349
035.350
036.345
036.346
036.347
036.348
036.349
036.350
037.345
037.346
037.347
037.348
037.349
037.350
038.345
038.346
038.347
038.348
038.349
038.350
039.345
039.346
039.347
039.348
039.349
039.350
040.345
040.346
040.347
040.348
040.349
040.350
041.345
041.346
041.347
041.348
041.349
041.350
042.345
042.346
042.347
042.348
042.349
043.345
043.346
043.347
043.348
043.349
044.345
044.346
044.347
044.348
044.349
045.345
045.346
045.347
045.348
045.349
046.345
046.346
046.347
046.348
047.345
047.346
047.347
047.348
048.345
048.346
048.347
048.348
049.345
049.346
049.347
049.348
050.345
050.346
050.347
050.348
051.345
051.346
051.347
051.348
052.345
052.346
052.347
052.348
053.345
053.346
053.347
053.348
054.345
054.346
054.347
055.345
055.346
055.347
056.345
056.346
056.347
057.345
057.346
057.347
058.345
058.346
059.345
059.346
060.345
060.346
061.345
061.346
062.345
063.345
064.345
065.345
Loading
Loading