Repository navigation
Photoz catalogue handling - #409
martinkilbinger wants to merge 19 commits into
Conversation
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
Pushed by the lint gate.
|
🤖 autofix pushed |
cailmdaley
left a comment
There was a problem hiding this comment.
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_maskneedsoutput_pathfor the calibration scriptfootprint_onlymode inmasking.pycan'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", |
There was a problem hiding this comment.
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:
| "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" |
There was a problem hiding this comment.
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:
| 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 |
There was a problem hiding this comment.
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.

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.