sp_validation.image_sims

IMAGE_SIMS.

Description:

Multiplicative and additive shear bias from image simulations.

Author:

Martin Kilbinger

_is_unweighted(scheme)[source]

True for the unit-weight scheme ("none" or None).

_load_cat(path, w_cols)[source]

Load RA, Dec, ellipticities and per-scheme weights from a FITS catalogue.

Reads the e1/e2 columns, which the calibration stage writes as the calibrated shear estimate g = R^-1 g_uncal - c (metacal response and additive-bias corrected) – not the raw e1_uncal/e2_uncal columns that sit alongside them in the same catalogue. The bias this estimator measures is therefore the residual m/c left after the chain’s own metacal calibration, not the raw pre-calibration bias.

w_cols is the list of weight schemes to load. The scheme "none" (equivalently a None/null entry) gives every object unit weight – the no-weighting mode for m-bias runs (#227: shape weights are excluded from sim calibration); any other entry is read as a FITS column name. The weights come back as a dict keyed by scheme so one catalogue load serves every scheme in a multi-weight run.

class ImageSimMBias(config)[source]

Bases: object

Compute multiplicative and additive shear bias from image simulations.

The estimator consumes the calibrated e1/e2 columns (the metacal response- and additive-bias-corrected shear g = R^-1 g_uncal - c), so the headline m/c is the residual bias remaining after the chain’s own metacal calibration, not the raw pre-calibration bias.

Parameters:
  • config (dict) –

    Configuration dictionary with keys: - grids_dir : str, path to the grids directory - num : int, run number (e.g. 2 for *_grid_2) - catalog_name : str, filename of the cut catalogue

    (default ‘shape_catalog_cut_ngmix.fits’)

    • shear_amplitude : float, input shear |g| (from manifest.yaml)

    • branches : list of str, branch names in load order (incl. the unsheared reference); defaults to the conventional 5-branch layout

    • pairs : list of dicts {plus, minus, component}, the +/- sheared branch pairing per component; defaults to the conventional pairs

    • match_radius_deg : float, matching radius in degrees (required)

    • pair_match : bool, match objects between the +g and -g sheared catalogues (required); if False, use all objects of each catalogue (the paired per-object cancellation is then unavailable)

    • w_cols : list of str, weight schemes to compute in one run (required); "none" (or a null entry) means unit weights, any other entry is a FITS column name. The first entry is the primary result surfaced at the top level of run()’s output. Our fiducial run leads with the unweighted scheme (["none", ...]), per the #227 verdict that shape weights are excluded from sim calibration; the unweighted m also avoids the cov(w, e) residual weighted estimators carry on constant-shear sims.

    • w_col : str or None, deprecated single weight scheme; accepted for back-compat and used as [w_col] only when w_cols is absent.

    • n_bootstrap : int, number of bootstrap resamples for errors (required)

    • bootstrap_seed : int, seed for the per-pair bootstrap RNG (required); makes the bootstrap errors bit-reproducible. The resample indices are drawn once per pair and shared across every weight scheme, so the schemes differ only in their weighting, never in their draws.

  • (match_radius_deg (The science knobs)

  • pair_match

  • w_cols

:param : :param n_bootstrap: :type n_bootstrap: a :param bootstrap_seed) are read with no in-code default: :type bootstrap_seed) are read with no in-code default: a :param missing one is a config bug and raises KeyError at construction: :param per the: :param fail-fast contract (the workflow emits every one into the m_bias config).: :param The lone exception is the deprecated w_col: :param which is honoured as a: :param fallback so pre-w_cols configs still run.:

load_catalogs(verbose=True)[source]

Load the 5 sheared and reference catalogues.

print_mean_ellipticities()[source]

Print the mean e1, e2 for each catalogue and weight scheme, as a check.

The unweighted scheme ("none") gives the plain unweighted means.

_m_c_pair(name_p, name_m, comp, verbose=True)[source]

Compute m and c for one shear pair and component (0=g1, 1=g2).

Paired (“pool”) estimator. The +g and -g simulations inject opposite input shear on the same galaxies, so matching them directly by RA/Dec yields a one-to-one correspondence. Differencing the two ellipticities per object,

m = <(e_+ - e_-) / (2 g_in) - 1> , c = <(e_+ + e_-) / 2> ,

cancels the intrinsic shape (sigma_e ~ 0.3) object-by-object in the multiplicative term, leaving only measurement noise – so sigma(m) shrinks by ~sigma_e/sigma_meas relative to differencing two independent means. (The additive term c is a sum, so intrinsic shape does not cancel there and its error stays shape-noise limited.)

With pair_match=False the +g and -g sims are not matched: every object of each catalogue is used, so the per-object cancellation is lost and m, c fall back to differencing/summing the two independent weighted means. The paired bootstrap likewise cannot be applied (the two arrays generally have different lengths), so each side is resampled independently per replicate.

run(verbose=True)[source]

Compute m and c for both shear components and every weight scheme.

Returns:

results["weights"][scheme] holds m1, m1_err, c1, c1_err, m2, m2_err, c2, c2_err for each weight scheme. The primary (first) scheme’s keys are also mirrored at the top level, so a reader that wants the headline m/c never has to know the scheme name.

Return type:

dict