Skip to content

Photoz catalogue handling - #409

Open
martinkilbinger wants to merge 32 commits into
developfrom
photoz
Open

martinkilbinger wants to merge 32 commits into
developfrom
photoz

Conversation

@martinkilbinger

@martinkilbinger martinkilbinger commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

This PR handles the reading of GaaP photometry and photo-z catalogues, and their merging with ShapePipe catalogues. The code corresponds to v1.X formats, not yet v2.0 compatible. It is used to create the joint ShapePipe+ PhotoPipe v1.6.y catalogues for current tomographic studies.

It includes the special handling of the two z-band masks.

martinkilbinger and others added 19 commits February 25, 2026 16:23
Merge 6ec03ae committed scripts/fill_photoz_bands.py and
scripts/check_filled_fields.py with their conflict markers still in place,
so neither file could be imported or run.

Both were added independently on the two sides, which is why git conflicted
the whole file. Upstream's version is a superset: it adds the per-tile
row-order check (check_tile_row_order, n_check_rows, check_tol_arcsec,
FITS_RADEC_CANDIDATES) and the Z_ML key, and differs otherwise only in
formatting. Taken as-is, with the one local change upstream lacks
re-applied: reading TILE_ID with dset.fields() so the scan chunk holds one
column instead of all of them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013NzWDtdQbsK1VhvYbDnmTo
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ ruff is clean — nothing to fix here.

@martinkilbinger martinkilbinger self-assigned this Oct 8, 2026

@cailmdaley cailmdaley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice progress, Martin. The two-band z coverage logic (measured_z & covered_z) | (measured_z2 & covered_z2) looks right. A few integration snags turned up while tracing the v1.X path, flagged inline; none of them are a verdict on the approach:

  • the PSF-size export column (one-word fix)
  • binned_mask needs output_path for the calibration script
  • footprint_only mode in masking.py can't evaluate the new composite cut yet, and that needs a decision about what "footprint" means there

One pointer for later, not for this PR: v2 support probably lives mostly in the enrichment I/O. fill_photoz_bands.py currently pairs PhotoPipe and ShapePipe rows by their order within each tile, so a reliable row-matching rule is the main thing to settle.

— Claude on behalf of Cail

"MAGERR_AUTO",
"NGMIX_T_NOSHEAR",
"NGMIX_T_PSF_RECONV_NOSHEAR",
"NGMIX_Tpsf_NOSHEAR",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

read_cat() already maps v1 catalogues onto the canonical names (through grammar), and it hides NGMIX_Tpsf_NOSHEAR in the process. So this lookup raises KeyError even on v1.6 inputs. The canonical column also carries the adapter's NGMIX_Tpsf_1P correction, so it's the one we want anyway:

Suggested change
"NGMIX_Tpsf_NOSHEAR",
"NGMIX_T_PSF_RECONV_NOSHEAR",

(The first_present() fallback in fill_cat_gal() then isn't needed for this.)

good: False

# Output file path base
output_base: "footprint_binned"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

With this section present, calibrate_comprehensive_cat.py reads cbm["output_path"] (line 170), so it'll KeyError before writing anything. output_base is what create_binned_mask_comprehensive.py reads, so keeping both is the smallest fix:

Suggested change
output_base: "footprint_binned"
output_base: "footprint_binned"
output_path: "footprint_binned_8192.fits"

mag_col: MAG_GAAP_0p7_z
mag_col2: MAG_GAAP_0p7_z2
label: "z-band imaging"
kind: covered_2bands

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

MASK_256_z is in SPATIAL_CUTS in scripts/masking.py, so with footprint_only=True this cut gets sent to apply_condition(), which only handles single-column cuts. The result is ValueError: Unknown mask condition kind: 'covered_2bands'.

It's worth deciding what footprint-only should mean for this cut. One option reproduces the catalogue selection, magnitude checks included. The other is purely geometric: the union of the two imaging footprints, with bad = bad_z & bad_z2. demo_create_footprint_mask.py has the same gap, since it ignores col_name2.

@martinkilbinger

Copy link
Copy Markdown
Contributor Author

Nice progress, Martin.

image

renovate Bot and others added 6 commits October 12, 2026 04:39
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…tion, test the guarantees (#420)

* Refuse blinded tomography at direct pseudo-Cl producers

* Check catalogue blind stamps before consuming SACC parts

* Resolve physical shear paths for same-file blind declarations

* Test blind determinism, envelope, multi-tracer shifts and secret-free outputs

* Validate blind stamps in SACC loads, including paper-workflow readers

* Observe actual CCL tracer pairs in the multi-tracer blind test

* Reject hidden cosmology values in saved outputs and captured logs

* Keep the blind gate to the cosmo_val path; Paper II readers stay as they were

papers/bmodes runs only on public (blind: none) catalogues, so threading a
blind through its readers and adding Snakemake adapters is out of scope here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ruff autofix (format + safe lint fixes)

Pushed by the lint gate.

* Run CI on the lint autofix head

The lint gate's autofix commit is pushed with GITHUB_TOKEN, which triggers no workflows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ay8NWFocUojrbRVfYoC5nH

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* implement cosmocov

* ruff check

* ruff format

* ruff format

* edits after review

* edits after review

* updated path files

* update snakemake files with tomographic option

* ruff autofix (format + safe lint fixes)

Pushed by the lint gate.

* OneCovariance inputs: per-component sigma_e and the footprint FITS mask

cat_config's cov_th.sigma_e sums both ellipticity components; OneCovariance's
ellipticity_dispersion is per component, so divide by sqrt(2) at the boundary.
mask_file_lensing must be a healpix FITS map: pass the catalogue's mask: key
instead of the ASCII mask-Cl text, which OneCovariance could not read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NbbToHtxp4TtFr3KEEiNkZ

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Cail Daley <cail.daley@cea.fr>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
cailmdaley and others added 7 commits October 25, 2026 22:33
#423)

* Preserve logical-mask booleans when writing HDF5 catalogues

* ruff autofix (format + safe lint fixes)

Pushed by the lint gate.

---------

Co-authored-by: Cail Daley <cdaley@l1.nibi.sharcnet>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Default external-mask cut excludes the star halos
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
The catalogue reader presents v1 NGMIX_Tpsf_NOSHEAR under its v2 name,
so requesting the v1 name fails in get_col after calibration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants