Stages¶
sp_validation turns ShapePipe and PhotoPipe outputs into cosmology in four stages. Each one hands the next a file, and nothing downstream reaches back past that file. This page maps the code as it is today and lists where it does not yet match.
Stage |
Does |
Code |
Hands on |
|---|---|---|---|
Assemble |
Joins per-campaign ShapePipe outputs, star catalogues, structural masks and PhotoPipe photometry into one comprehensive catalogue |
|
comprehensive catalogue ( |
Calibrate |
Selection, metacal response and weights, PSF-leakage correction, multiplicative bias from image sims, and the redshift distribution |
|
a |
Validate |
Two-point statistics, PSF systematics, B-mode and other nulls, covariance, all blinded |
|
|
Infer |
Likelihood, priors, sampler |
|
chains |
The calibrate → validate contract is the catalogue entry. Everything
validation needs about a catalogue is named in its cat_config.yaml entry,
and validation reads only what is named there. A calibration that changes
(a new n(z), a new weight) changes the file the entry points to, or adds an
entry; it never changes validation code.
Mocks run beside the stages. GLASS mocks (glass_mock.py,
scripts/glass_mock/, workflow/rules/glass_mock.smk) are registered as
catalogue entries and go through validate exactly as data do. Image
simulations feed calibrate’s multiplicative bias.
Redshifts¶
The n(z) is calibrated, not validated:
Assemble gives each shape its PhotoPipe row (
scripts/assembly/). ShapePipe v2 and theUNIONS.<tile>_ugriz_photoz_ext.catPhotoPipe run both number objects with Stephen Gwyn’s DR6 IDs, so the join is exact on (tile,NUMBER=SeqNr). The spectra PhotoPipe matched to those objects on every tile become the collection’s spec-z extension, on the sameOBJECT_ID.Calibrate runs the SOM recipe (
config/calibration/nz/v2.yaml,scripts/calibration/step 5) on that photometry and the spectra PhotoPipe matched to the same objects, and writes the n(z) file, its realisations and each row’sTOM_BIN_ID.Validate reads the file through
shear.redshift_pathand the bins throughtomo_bin_col.
Paths across machines¶
Configs name data by root, not by machine. config/data_roots.yaml lists,
for each root, the directory that holds it on each cluster; a config writes
${unions_v2}/v2.0.0/nz/nz_tomo.txt, and sp_validation.data_roots.load_yaml replaces
the root with the first of its directories that exists. SPV_ROOT_<NAME>
points a root at a copy the file doesn’t list. A root found nowhere stays
written as ${name}, so the path fails when opened and names what is missing.
Every loader of cosmo_val/cat_config.yaml (cosmo_val, the workflow,
blinding.py, the dashboard) goes through load_yaml, so an entry runs
wherever its roots resolve. A root’s directories share one relative layout.
Where the code does not match yet¶
ShapePipe v1 keeps its own photometry join.
fill_photoz_bands.pyjoins v1 by row order against the_SP_ugrizPhotoPipe files, which ran on v1 detections. v2’s join (scripts/assembly/) is exact on Stephen’s IDs.Top-level
scripts/mixes stages. Assembly (merge_psf_cat.py,combine_hp_masks.py,apply_hsp_masks.py,fill_photoz_bands.py), calibration (apply_alpha*.py,compute_m_bias_image_sims.py,get_nz_txt_files_from_fits.py) and one-off diagnostics sit side by side. Moving them intoscripts/assembly/andscripts/calibration/is mechanical; only the v2 collection lives inscripts/assembly/so far.catalog_builders.pyholds both assemble (JointCat,ApplyHspMasks) and calibrate (CalibrateCat) classes.Only the v2 collection, validate and infer are workflow rules. The v1 assembly and calibrate run as ordered scripts, apart from the image-sim bias.
Most catalogue entries carry candide paths. Only
SP_v2.0is written with roots; the others move as their data land on a reachable machine.