sp_validation.cosmo_val.core¶
- class CosmologyValidation(versions, catalog_config='./cat_config.yaml', output_dir=None, rho_tau_method='lsq', cov_estimate_method='th', compute_cov_rho=True, n_cov=100, theta_min=0.1, theta_max=250, nbins=20, var_method='jackknife', npatch=20, quantile=0.1587, theta_min_plot=0.08, theta_max_plot=250, ylim_alpha=[-0.005, 0.05], ylim_xi_sys_ratio=[-0.02, 0.5], nside=1024, nside_mask=8192, binning='powspace', power=0.5, n_ell_bins=32, ell_step=10, pol_factor=True, cell_method='map', noise_bias_method='analytic', fiducial_input_inka='coupled', nrandom_cell=10, cell_seed=8192, path_onecovariance=None, cosmo_params=None, blind=None)[source]¶
Bases:
CosebisMixin,PureEBMixin,RealSpaceMixin,PSFSystematicsMixin,CatalogCharacterizationMixin,PseudoClMixinFramework for cosmic shear validation and systematics analysis.
Handles two-point correlation function measurements, PSF systematics (rho/tau), pseudo-C_ell analysis, and covariance estimation for weak lensing surveys. Supports multiple catalog versions with automatic leakage-corrected variants.
- Parameters:
versions (list of str) – Catalog version identifiers to analyze. Appending ‘_leak_corr’ to a base version creates a virtual catalog using leakage-corrected ellipticity columns (e1_col_corrected/e2_col_corrected) from the base version configuration.
catalog_config (str, default './cat_config.yaml') – Path to catalog configuration YAML defining survey metadata, file paths, and analysis settings for each version.
output_dir (str, optional) – Override for output directory. If None, falls back to the COSMO_VAL environment variable, then to the catalog config’s paths.output.
rho_tau_method ({'lsq', 'mcmc'}, default 'lsq') – Fitting method for PSF leakage systematics parameters.
cov_estimate_method ({'th', 'jk'}, default 'th') – Covariance estimation: ‘th’ for semi-analytic theory, ‘jk’ for jackknife.
compute_cov_rho (bool, default True) – Whether to compute covariance for rho statistics during PSF analysis.
n_cov (int, default 100) – Number of realizations for covariance estimation when using theory method.
theta_min (float, default 0.1) – Minimum angular separation in arcminutes for correlation function binning.
theta_max (float, default 250) – Maximum angular separation in arcminutes for correlation function binning.
nbins (int, default 20) – Number of angular bins for TreeCorr real-space correlation functions.
var_method ({'jackknife', 'sample', 'bootstrap', 'marked_bootstrap'}, default 'jackknife') – TreeCorr variance estimation method.
npatch (int, default 20) – Number of spatial patches for jackknife variance estimation.
quantile (float, default 0.1587) – Quantile for uncertainty bands in plots (default: 1-sigma ≈ 0.159).
theta_min_plot (float, default 0.08) – Minimum angular scale for plotting (may differ from analysis cut).
theta_max_plot (float, default 250) – Maximum angular scale for plotting.
ylim_alpha (list of float, default [-0.005, 0.05]) – Y-axis limits for alpha systematic parameter plots.
ylim_xi_sys_ratio (list of float, default [-0.02, 0.5]) – Y-axis limits for xi systematics ratio plots.
nside (int, default 1024) – HEALPix resolution for pseudo-C_ell analysis and area computation.
binning ({'powspace', 'linspace', 'logspace'}, default 'powspace') – Ell binning scheme for pseudo-C_ell (powspace = ell^power spacing).
power (float, default 0.5) – Exponent for power-law binning when binning=’powspace’.
n_ell_bins (int, default 32) – Number of ell bins for pseudo-C_ell analysis (used with binning=’powspace’).
ell_step (int, default 10) – Bin width in ell for linear binning (used with binning=’linear’).
pol_factor (bool, default True) – Apply polarization correction factor in pseudo-C_ell calculations.
nrandom_cell (int, default 10) – Number of random realizations for C_ell error estimation.
cell_seed (int, default 8192) – Seed for the random-rotation noise realizations in the pseudo-C_ell noise debiasing, making those realizations reproducible run-to-run.
cosmo_params (dict, optional) – Cosmological parameters to pass to get_cosmo(). If None, uses Planck 2018.
- catalog_config_path¶
Resolved path to the catalog configuration file.
- Type:
Path
- cosmo¶
Cosmology object for theory predictions.
- Type:
pyccl.Cosmology
Notes
Path resolution: Relative paths in catalog config are resolved using each version’s ‘subdir’ field as the base directory.
Virtual _leak_corr versions: These create deep copies of the base version config, swapping e1_col/e2_col with e1_col_corrected/e2_col_corrected.
TreeCorr cross_patch_weight: Automatically set to ‘match’ for jackknife, ‘simple’ otherwise, following TreeCorr best practices.
- static _split_seed_variant(version)[source]¶
Return the base version and seed label if version encodes a seed.
- static _materialize_seed_path(base_cfg, seed_label, version, base_version, catalog_config)[source]¶
Render the seed-specific shear path using Python string formatting.
- _output_path(*parts)[source]¶
Absolute path under the catalog config’s output directory.
Joins
*partsontoself.cc["paths"]["output"]and absolutises the result, mirroring theos.path.abspath(f"{output}/...")pattern used throughout the mixins. A singlepartsstring may contain/separators.
- get_redshift(version)[source]¶
Load redshift distribution for a catalog version.
- Parameters:
version (str) – Catalog version identifier
- Returns:
z (ndarray) – Redshift values
nz (ndarray) – n(z) probability density
Notes
If self.blind is set, the redshift path is modified to use the specified blind (A, B, or C) by replacing the blind suffix in the configured path.
- property results¶
- property results_objectwise¶
- _binning(min_sep=None, max_sep=None, nbins=None, **extra)[source]¶
treecorr_config with min_sep/max_sep/nbins overridden.
None falls back to the instance’s treecorr_config value for that key; any further keys in extra override on top.
- _read_shear_cols(ver, *keys)[source]¶
Read shear-catalog columns by their config-key names.
Each key in
*keys(e.g."e1_col","w_col") is resolved to a column name viaself.cc[ver]["shear"][key]and indexed out ofself.results[ver].dat_shear. Must be called inside aself.results[ver].temporarily_read_data()context, since it touchesdat_sheardirectly.Returns one array per key (a bare array, not a 1-tuple, when a single key is requested).
- _calibrated_g(ver)[source]¶
Calibrated shear components
(g1, g2)for a catalog version.Applies additive-bias subtraction and the multiplicative response:
g = (e − c) / R. For DES the response is the catalog-averaged per-componentR11/R22(column names in the config); for every other version it is the scalarRfrom the config. Used identically bycalculate_2pcf()andcalculate_aperture_mass_dispersion().Must be called inside a
self.results[ver].temporarily_read_data()context, since it readsdat_shearcolumns.
- property colors¶