Skip to content

One definition of shear response, weights, additive bias and image-sim m (DES case d) - #425

Open
cailmdaley wants to merge 79 commits into
developfrom
feat/consistent-response-weights
Open

cailmdaley wants to merge 79 commits into
developfrom
feat/consistent-response-weights

Conversation

@cailmdaley

@cailmdaley cailmdaley commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Goal: one definition of the galaxy weights, the metacalibration shear response R = R_shear + R_sel, the additive bias c and the image-simulation residual multiplicative bias m, used end to end on data and on image simulations.
Before this PR the four were inconsistent: the shear, R_shear, R_sel and c were each averaged with different weights, and the image-sim m was measured with an estimator that did not match the response it tested.

The definition is Martin Kilbinger's DES-weight response ("case d", #395).
A weight table W(S/N, size) is fitted once on the unsheared metacal branch and evaluated on each sheared branch at that branch's own S/N and size, and each branch mean is divided by its own weight sum, so R is the derivative of the weighted mean shear it calibrates.
It lives in one module, sp_validation.response, which the data calibration, the tile jackknife and the image-sim m all call.

Findings:

  • On v2 data the response rises by about 10%, almost entirely from weighting R consistently with the shear. Calibrated shear falls by the same factor, and ξ by about 18%.
  • The v2.0.0 calibrated sample is this definition. Rebuilt with this code, all 191,016,178 galaxies match the release (largest difference 3 × 10⁻¹⁴), with R = 0.787.
  • On new image simulations m is consistent with zero for the selected sample: m = (+0.3 ± 1.5, −0.9 ± 1.7) × 10⁻³ with the v2 cuts and weights, on isolated galaxies with the true PSF.
  • The faint end is biased and not fixed here: m = (−6 ± 4, −17 ± 4) × 10⁻³ at S/N 10–20, against (−0.3 ± 0.5, +0.4 ± 0.5) × 10⁻³ above S/N 20. It is followed separately.
  • No m is adopted or applied. October's simulations gave m ≈ −1% for the selected sample with the same estimator; the new ones do not reproduce it, and the difference is not attributed.

Definitions and usage: docs/source/response_calibration.md. Figures: gist.
The response of each tomographic bin, and how the release applies it, is #490, not this PR.

Terms
Term Meaning
Metacal branches Each galaxy is remeasured after an artificial shear ±h (h = 0.01) along component j = 1, 2, giving branches b ∈ {ns, 1+, 1−, 2+, 2−}; ns is the unsheared measurement.
Branch mean ⟨x⟩_b = Σ w_b x / Σ w_b over branch b's own selection, with its own weights.
R_shear (⟨e_{j+}⟩ − ⟨e_{j−}⟩) / 2h on the unsheared selection and weights.
R_sel (⟨e_ns⟩{j+} − ⟨e_ns⟩{j−}) / 2h: the unsheared ellipticity averaged with each sheared branch's selection and weights. It captures galaxies crossing the cuts, weights changing and galaxies moving between table cells.
Case d The weight table W(S/N, T/T_PSF) is fitted once on the unsheared branch, then evaluated at each branch's own S/N and size.
IV weights 1/(2σ_ε² + σ₁² + σ₂²), with σ₁, σ₂ each branch's own measured ellipticity errors.
c c_e = ⟨e⟩_ns, the weighted mean uncalibrated ellipticity; calibrated shear is R⁻¹(e − c_e).
Full-population m Each of the +g and −g simulations keeps its own selection, weights and R. This is the estimator here.
Paired m Only galaxies selected in both the +g and −g simulations, with the pair weight ½(w₊ + w₋). The former estimator; here a low-noise diagnostic.
Tile jackknife Delete-one-tile errors; each deletion recomputes R, and refits the table when the table was fitted on the same galaxies.

What the PR contains

  • sp_validation.response. Every weight is w = u × W[cell]: the cell is the galaxy's (S/N, size) cell on the branch being averaged, and u is 1 (DES and unit weights) or that branch's inverse variance (IV weights). Every estimate is then a table contracted with per-tile, per-cell sums. Those sums add over chunks and tiles, so one object serves a catalogue in memory, the 191M-row build read pixel by pixel, the tile jackknife and the image-sim m.
  • Four former implementations are removed, with the legacy response path. A metacal config block declares weight_scheme: des or iv; R_sel and c are weighted like R_shear and the shear.
  • The response record names its weights. A calibrated catalogue's record (JSON beside it) holds R, its parts, c, their jackknife covariance and the weight scheme. A cat_config.yaml entry that names the record takes its weight column from it, so the weight is not declared a second time; cosmo_val reads such a catalogue's shear as stored.
  • Image-sim m from full populations, with the data's weight table held fixed and tile-jackknife covariance of (m1, c1, m2, c2). Pair matching is removed from the estimator (agreed with Martin, 26 October). The image-sims workflow is Martin's; this PR changes its calibrate and m-bias steps.
  • Errors on c in cosmo_val, shape-noise and jackknife (Martin's Fix c-bias error estimation #408, rewritten on this module).
  • Inverse-variance weights refuse a catalogue without the sheared branches' ellipticity errors, naming the missing columns. The current v2 merge lacks them (Re-merge the v2 final catalogue so it carries the per-branch NGMIX_G{1,2}_ERR shapepipe#1006).
  • Tests: hand-computed cases, and a synthetic ±0.02-shear simulation in which S/N and size move with shear: the full response gives m consistent with zero, R_shear alone is off by more than 5σ. Before the old code was removed, each of the four former implementations agreed with the module to ≤ 2 × 10⁻¹³ on synthetic catalogues. Fast suite: 860 passed in the develop image on Fir.

Results

v2 data

Before and after on the same v2 catalogue (measured in October, with the upper size cut then in use, T/T_PSF < 3):

develop this PR
R_shear 0.641, 0.643 0.734, 0.735
R_sel +0.002, +0.002 −0.022, −0.022
R 0.643, 0.645 0.711, 0.713
c_e (× 10⁻⁴) (−0.6, +0.7) (−0.1, +1.8) ± 0.3

develop combined an inverse-variance-weighted R_shear with an unweighted R_sel and c.
DES weights favour galaxies of high response: R_shear is 0.602 unweighted and 0.734 with DES weights.

The v2.0.0 release uses 0.707 < T/T_PSF < 9, which gives R_shear = 0.758, R_sel = +0.029, R = 0.787 ± 0.0002 (tile jackknife over 22,901 tiles) and c_e = (0.18 ± 0.23, 1.09 ± 0.23) × 10⁻⁴.
R_sel changes sign with the upper size cut, near T/T_PSF = 4.5.

The response depends strongly on S/N, from 0.41 at S/N 10–12 to about 0.89 at S/N 50–100, so a subsample with a different S/N mix needs its own R.

R_shear, R_sel and R of the v2.0.0 sample against S/N

Image simulations: the estimator

Measured in October on the four v2 simulation grids, with this branch's earlier implementation of the same estimator. m is (m1, m2) × 10⁻³.

m on the October grids for each estimator

Estimator m
Paired, self-fitted table (−4, 0)
Full populations, self-fitted table (−19.3 ± 4.0, −14.3 ± 4.7)
Full populations, v2 data table (the rule here) (−9.2 ± 3.2, −8.9 ± 3.6)
  • Pair matching hides about 1.5 percentage points. The pair weight ½(w₊ + w₋) removes the weight change from the numerator while R keeps it.
  • A table fitted on the simulations' own shapes biases m low, by −1/N for N objects per cell in a noiseless test and by 0.5–1 percentage point on the grids. The simulations therefore take the data's table.

Image simulations: m with the v2 selection and weights

New simulations made on Fir: 150 interior CFIS tiles re-simulated from their real exposures (WCS, noise level, weight and flag maps), SKiLLS galaxies on a 10″ lattice, five constant-shear branches, processed with the ShapePipe commit that made v2 and given the true PSF.
m and R come from this PR's module with the v2.0.0 cuts and weight table, with tile-jackknife errors.

m1 (10⁻³) m2 (10⁻³)
Selected sample, v2 weights +0.3 ± 1.5 −0.9 ± 1.7
Selected sample, unit weights +0.5 ± 2.7 −5.2 ± 2.9
Paired, S/N 10–20 −6 ± 4 −17 ± 4
Paired, S/N > 20 −0.3 ± 0.5 +0.4 ± 0.5

c = (+0.4 ± 0.3, −0.1 ± 0.3) × 10⁻³.

m against S/N and against input magnitude on the new simulations

  • The selected sample is unbiased to about 2 × 10⁻³ under these conditions: isolated galaxies, known PSF. The v2 weights down-weight the faint galaxies that carry the bias.
  • The faint-end bias is in the shape measurement. It appears in galaxies paired across ±g, which carry no selection response, and it survives binning on the input magnitude (lower panels), so it is not an effect of selecting on a noisy S/N. It is stronger in g2.
  • These simulations have no blending, no stars and no PSF-model error, so they do not give m for the data. They differ from October's −1% by 2.7σ and 2.0σ; the two sets differ in camera model, PSF, coadd and processing, and the difference is not attributed.

Not checked

  • Inverse-variance weights on real data.
  • m with blended galaxies or a modelled PSF.

Follow-ups

Each choice is recorded with its alternatives in the ASTRA record scratch/cdaley/unions_astra/analyses/dr6_catalogue/astra.yaml and cited from the function that implements it.
Earlier validation scripts and Martin's reference implementation of case d are on archive/pr425-before-unification.

Closes #395, Closes #156, Closes #21, Closes #22. Refs #23, #346, #382, #408, #435.

— Claude (Fable) on behalf of Cail

🤖 Generated with Claude Code

https://claude.ai/code/session_01JK7o9ESjsJpK9G5wRraxC1

cailmdaley and others added 26 commits August 31, 2026 03:03
The ShapePipe pipeline stage's ngmix ini (which owns METACAL_PSF) is
resolved from the shapepipe worktree's example/cfis_image_sims via
run_job's self-computed config_dir, so nothing in the run config could
select a different ini -- an A/B on the metacal reconvolution PSF needed
a separate worktree per arm.

Add an optional operational key `pipeline_config_dir`. When set it is
passed to run_job as `-c DIR`, redirecting the pipeline stage's whole
ShapePipe config tree (ngmix ini included) at a per-arm copy; when empty
(the default) no `-c` is passed and run_job self-computes exactly as
before, so runs predating this key reproduce bit-exact. Merge/final_cat
still read the top-level cfis symlink (config_dir), untouched.

Candidate upstream PR for the image-sims orchestration branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XSWPiisH6y7NFFbjHqthuC
ImageSimMBias.load_catalogs hardcoded the '_grid_' infix between branch
name and run number, so blended arms ({branch}_{num} dirs) hit
FileNotFoundError on a '{branch}_grid_{num}' path that never existed.
Derive the suffix from sims_type (defaulting to grid for backward
compat and the synthetic-recovery tests), mirroring the workflow's own
_SUFFIX contract. Emit sims_type into the generated m_bias_config, and
bump im_mbias mem to 8G since blended catalogues are ~5x grid size and
OOM the snakemake 1000M default.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HubFhoU6bH8ij6hcTWxw7s
…lization

Add an optional `exp_num` config key so the exposure input can be pulled from a
different SKiLLS realization than the tiles. Tiles stay on `{branch}_{num}`;
exposures resolve `{branch}_{exp_num}` via a new SIM_EXP_BASE mapping, consumed
by rule im_init's `sim_exp` symlink source. Unset `exp_num` defaults to `num`,
reproducing prior behaviour bit-for-bit. Guarded to non-grid sims (grid names
embed sims_type; the pathology this addresses is a blended-family concern).

Motivation: the blended-family realizations _1.._4 carry stale cross-linked
SP_exp (grid-sims exposures symlinked in, signal-free); _5 is the clean all-real
exposure set. This reproduces Fabian's production split (exposures from _5, tiles
from _1), unblocking the blended smoke arms whose ngmix flux collapsed ~10x on
the contaminated z-branch exposures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HubFhoU6bH8ij6hcTWxw7s
…flow

im_pipeline shelled out per tile to the legacy bash runner
(run_job_sp_canfar_v2.0.bash -t image_sims) over example/cfis_image_sims,
configs frozen before the real-data chain gained background-RMS vignets,
PIXEL_SCALE, chunked ngmix and the new flags. An m measured that way does
not calibrate the pipeline that makes the real catalogue.

im_shapepipe replaces it: one localrule per shear branch writes a ShapePipe
run config (input_type: image_sims, psf_model, tile list, the branch's
SP_tiles/SP_exp, run_dir = grids_base/<sim>) and runs `sp run`, whose jobs
ShapePipe submits through its own profile. The output is a campaign record
(ShapePipe commit, resolved image, final_cat count) that im_merge consumes.
im_init no longer stages input_tiles/input_exp; its cfis link now points at
the checkout's workflow/config/cfis_image_sims, and it writes tiles_<sim>.txt,
which is both the campaign's tile_list and params.py's tile-ID file.

Config: drop config_dir, pipeline_config_dir and n_smp (dead with the bash
runner; an A/B of the ngmix ini is now a ShapePipe config change); add
sp_profile, sp_jobs, clean_exposures; psf_model defaults to fake, the true
PSF of the star-free grid sims.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSjZrhgsGCLAJCLb5Zjmc3
…iles

im_shapepipe recorded the ShapePipe commit and dirty state by asking the
live checkout when the campaign ENDED -- hours after sp run snapshotted the
code it actually ran, so an edit or commit in between put the wrong code in
the record. It now copies sp's own launch snapshot
(<run_dir>-state/code/snapshot.json: source, branch, head, dirty, taken_at).

im_mbias's provenance adds those per-branch records (commit, image, tile and
final_cat counts) as shapepipe_campaigns, beside the checkout the merge
stage reads; the records are now declared inputs.

config.yaml: tile_ids must leave out tiles without data. A tile with no
detections fails its ShapePipe campaign and so im_shapepipe; the SKiLLS
coadds of grid_1 248.288, grid_2 259.285, grid_3 265.285 and grid_4
281.281/282.281 are all zeros, and 1m2z_2's 257.289 is truncated. The
psf_model comment no longer offers *_star_grid (inputs for 1z2z only).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSU9pPZjpBjzWorAL88aKQ
…r run

null (the default) keeps the profile's node-local store and leaves the
key out of the branch run configs, so earlier campaigns keep their
params. The star sims set it to NFS: candide's 31 GB node /tmp cannot
hold their ~5 GB tile stores.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qv5MwRiVKa8wnH665dWBia
…l's real-data workflow

A from-scratch, one-tile-scale port of the image-sims chain onto the
per-unit manifest/completeness pattern from shapepipe/workflow/ (calling
shapepipe_run directly, no run_job_sp_canfar_v2.0.bash), built and verified
step by step (prepare -> exposure -> tile chain -> tile_ngmix ->
tile_make_cat) against the 240.291 reference tile from grid_1, plus
clean_exposure/clean_tile reclamation reusing shapepipe's own scripts
unmodified.

Kept separate from feat/imsims-shapepipe-workflow (the more mature,
overlay-config-based port already in progress there) -- this is an
independent, simpler exploration, not meant to replace it.
run.sh's mktemp targeted /tmp directly -- a small node-local disk shared by
every job/user on the node (candide policy), and this runs on the login
node besides. Use a gitignored .batch/ dir alongside the workflow instead.
…atch

Node-local /scratch (the previous fix's instinct, per CLAUDE.md's per-job
scratch pattern) doesn't actually work here: verified empirically that a
login-node /scratch path is invisible from the compute node the job lands
on, so both the job's own stdout file and a file it tried to write there
silently never appeared. This script runs before the job exists (login
node) and its log is written from a not-yet-chosen compute node, so it
needs network storage -- CLAUDE.md's own fallback for anything that must
be visible beyond one node -- not /scratch, not /tmp, and not the
repository directory either. Moved to /n17data/$USER/.im_sims_batch/.
TIME[compute]=02:00:00 was sized for the original single reference-tile
run (~80 min end to end). COMPUTE runs the whole tile list in one
--cores 8 allocation, so its wall clock has to cover the campaign, not
one tile: at 40 tiles (1z2z_grid_1) the 2h cap timed out at 40/376 steps
with no ngmix job finished (candide job 867554). 47h leaves margin under
comp/pscomp's 48h MaxTime.
The 47h compute job hung on n23 with zero CPU for ~30 min after
tile_merge_headers; shapepipe's candide profile already excludes n23
for past job failures.

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

- scripts/run_config_sims.py: $name in any run-config value expands to the
  top-level scalar key `name` (my_base_dir, sim, ...), repeatedly; an
  unexpanded $name is an error rather than a literal directory. Used by the
  Snakefile and by status_sims.py.
- config.yaml: container, psf_dict and shapepipe_repo become shared defaults,
  so a run config need not repeat them (it may still override them).
- status_sims.py: optional -c/--config reads outputs.run_dir and
  outputs.products_dir from the run config; final_cat is counted on the
  products root, not under run_dir.
- run.sh: TMPDIR is /n23data1/mkilbing/tmp, passed to snakemake
  (--default-resources tmpdir=) and into the container (--env TMPDIR, plus a
  bind), since --cleanenv drops the host value. Nothing writes to the node's
  /tmp any more, per ~/CLAUDE.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013NzWDtdQbsK1VhvYbDnmTo
Brings the image-sims m-bias changes of imsims_workflow onto develop:
pipeline_config_dir, sims_type naming, exp_num, ShapePipe processing through
ShapePipe's own workflow (sp), campaign provenance, tile_store_root, and the
candide profile's latency-wait 60 / job cap. The native shapepipe_run
prototype (workflow/image_sims/native) is left out: ShapePipe's unified
workflow superseded it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e's sp

- spv run -c RUN_CONFIG [-t TARGET] [snakemake args]: the main config
  (workflow/image_sims/config.yaml) plus the user's run config, default
  target im_mbias. The code is snapshotted into <grids_base>/spv-state/code
  and the run executes out of it (image_sims.sp_validation_repo is set to the
  snapshot), so editing the checkout cannot reach running jobs.
- On candide TMPDIR/APPTAINER_TMPDIR must be set outside /tmp and /scratch
  (the slurm executor exports the head's TMPDIR to every job, and Slurm
  falls back to the node's /tmp when it cannot be created); the snapshot's
  profile passes the same directory into the container.
- spv status -c sp_*.yaml | DIR: disk-scan status of ShapePipe campaigns,
  workflow/scripts/status_sims.py (from the native prototype's script, which
  already read the unified layout; now with its own $name/${name} reader).
- The image-sims Snakefile loads its config next to itself, not relative to
  the working directory; im_mbias_config.py reads repo provenance from a
  snapshot's snapshot.json when there is no .git.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The state the grid m-bias runs actually used (sp_validation_imsims_workflow
working tree, 2026-10-02), so that spv runs it: the image_sims.smk chain on
top of ShapePipe's own workflow (init -> extract -> calibrate -> m-bias), the
matching workflow/image_sims/config.yaml, the per-tile response jackknife and
related calibration/m-bias changes with their tests, and the mask configs
mask_v1.X.10_im_sim{,_R_now}.yaml. Tests: test_calibration.py and
test_image_sims.py pass (20) in the m-bias image.

Left out: the profile's `config: image_sims={"sif": ...}` -- the image is a
per-user choice and goes in the run config (image_sims.sif). Added: n35 to
the candide excludes (its /tmp was filled on 2026-09-30).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
config_mask.yaml was a symlink into the sp_validation checkout the run came
from. Removing that checkout left every run dir's link dangling, and the next
launch failed at DAG time ("config_mask.yaml seems to be a broken symlink",
evaluating im_calibrate's mem_mb from its input sizes). With spv the source
is the code snapshot, which each launch refreshes. A copy keeps the mask the
run dir was calibrated with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
n34 hit the per-user thread limit during the image-sims runs, as did n35.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge of the uncommitted imsims_workflow work (b268fd6) dropped exp_num
from the recognised keys while EXP_NUM still reads it and config.yaml still
documents it for the star sims (tiles from *_N, exposures from *_5), so a
star-sim run config naming it died at parse as an unknown key.

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

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ ruff is clean — nothing to fix here.

cailmdaley and others added 9 commits November 15, 2026 10:39
…reshold and default min_count

Each fails under the mutation it guards: training on R_g11 alone, linear
edges, pooling at count == min_count or requiring a window above it, and a
default des_min_count other than 3.

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

A selected row with a nonfinite shape on a branch it enters made R or c NaN
silently; the NGMIX_MCAL_TYPES_FAIL == 0 preselection removes such rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESEcatXjL8bDkTC5c
The α(θ) diagnostic rebuilt a per-magnitude-bin response from weighted R_g
plus a global R_sel read from calibration.json, which nothing writes. A
magnitude bin's selection response is not in the cut catalogue, so the core
cannot give that R; the bins now use the calibrated shapes as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESEcatXjL8bDkTC5c
…sion declares DES weights

No caller passes R, R_shear, R_select, c or c_err: the response record is the
_response.json beside the catalogue. test_release_regression pins the
calibration script's selection and per-object columns against the v1.4.6.3
release window; it now sets weight_scheme (absent from the release's config,
and irrelevant to the selection) and no longer compares w_iv, which the
script writes only for the IV scheme.

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

A chunk accumulated over the tiles it holds stays small; gather places
each into the full label set in place, so a catalogue read pixel by pixel
never builds a dense per-chunk array over every tile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESEcatXjL8bDkTC5c
Its rows as a preselection, the full sample's table held fixed; membership is
fixed across the metacal branches, so it includes the response of the cuts
and weights within the subsample but not of what assigned the subsample.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESEcatXjL8bDkTC5c
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESEcatXjL8bDkTC5c
…es as ASTRA decisions

dr6_catalogue gains decisions response_estimator, galaxy_weights,
weight_table, simulation_shear_bias, simulation_weight_table,
calibration_uncertainties and additive_bias, each with its alternatives and
evidence; outputs response_record and image_sim_shear_bias; and the finding
residual_image_sim_m. response.py carries the matching @sc contract lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESEcatXjL8bDkTC5c
@cailmdaley cailmdaley changed the title Consistent shear response, weights and additive bias (DES case d) One definition of shear response, weights, additive bias and image-sim m (DES case d) Nov 15, 2026
cailmdaley added a commit that referenced this pull request Nov 15, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cailmdaley and others added 18 commits November 15, 2026 11:31
…ims reads it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ogue demo and hist_mag

demo_calibrate_minimal_cat.py read a config_minimal.yaml that exists nowhere
and repeated calibrate_comprehensive_cat.py with a debug truncation; the doc
now shows the calibrate_catalogue call in a few lines. papers/catalog/hist_mag.py
was a one-off paper figure that no rule or doc depends on.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
extract_info.py and calibrate_comprehensive_cat.py run from the checkout that
launched the workflow, as the m-bias step does, so the config loses
extract_script, calibrate_script and sp_validation_repo; the remaining paths
(shapepipe_repo, grids_base, input_sims_base, psf_dict, config_dir) have no
default and a run config states them.

im_mbias_config and im_mbias become one script rule, workflow/scripts/im_mbias.py,
which reads the manifest and the simulations' sums and writes
m_bias_results.yaml with its provenance. compute_m_bias_image_sims.py goes,
with its cumulative-across-runs tracking and text copy of the results, and so
does diagnostics_image_sims.py: no rule ran it and it read keys (w_col,
catalog_name) the workflow never wrote.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
The overlay, im_compose_mask.py and the test that the two reproduce the
runtime file byte for byte existed only to tie mask_v1.X.9_im_sim.yaml to the
v1.X.9 data config, which no longer holds: the simulations now take the v2
data's metacal selection. No rule ran the composer. The runtime file's header
now says what it is and how it differs from the data configs.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
The IPython autoreload block, a bare obj._params expression, a disabled
debug truncation and a loop that deleted nothing; the header says what the
script reads.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
Co-Authored-By: Claude Opus <noreply@anthropic.com>
The response belongs to a sample. A catalogue entry names its response record
(shear.response); cosmo_val calibrates the whole catalogue with the record's R,
and each tomographic bin with that bin's R from the record, each minus its own
weighted mean: R_k^-1 R_all e - <R_k^-1 R_all e>_k. A bin the record lacks is
an error. response.sample_response and response.calibrated_shear are the one
definition; xi, pseudo-Cl, tau, object-wise leakage, the additive bias and the
ellipticity histograms use it. SP_v2.0.0 reads catalogs/response.json.

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

Co-Authored-By: Claude Opus <noreply@anthropic.com>
Each caller of _calibrated_g (_shear_columns, _pseudo_cl_catalogue, and the
shear calculate_rho_tau_stats hands get_rho_tau_w_cov) recovers the input
shear in each bin of the two-population release.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9E2jzNjuJU8HV3b13n
Each bin's sigma_e is that of R_k^-1 R e minus its weighted mean
(response.calibrated_shear with the record's bin R), measured by
analyses/cosmo-val-v2-tomo-perbin/survey.py on the release catalogue;
n_e, A and the whole-sample values are unchanged.

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

A catalogue calibrated on disk names its response record in shear.response:
cosmo_val reads its e1, e2 as they are, applies no response and subtracts no
mean, and takes its weight column w_<weights> from the record, so the entry
declares no w_col. Any other entry is calibrated as one sample at read, with
its scalar R or DES's R11, R22, as on develop. ξ±, pseudo-Cℓ, τ, object-wise
leakage and characterisation read columns again: the per-bin loop,
_responses, _ShearCatalogue, _pseudo_cl_catalogue, the shear hand-over to
rho_tau and the FITS calibration-header guard go, with
response.sample_response, recalibrate and calibrated_shear.

response.record takes the weight scheme the response was measured with.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESjsJpK9G5wRraxC1
G1_ERR and G2_ERR join the per-branch metacal quantities of params.py and
params_im_sim.py, replacing the separate no-shear listing and extract_info's
conditional copy of the sheared ones; the column schema documents all five
branches. accumulate refuses inverse-variance weights on rows that lack a
branch's errors, naming the columns; DES weights do not need them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESjsJpK9G5wRraxC1
… response

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESjsJpK9G5wRraxC1
…has them

The v2 final catalogue merged before shapepipe#1003 holds only the no-shear
errors, and extraction must still read it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESjsJpK9G5wRraxC1
…rd are the calibrated sample build's

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JK7o9ESjsJpK9G5wRraxC1

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

1 participant