Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7d1208b
feat(sacc_io): SACC read/write for the standard data-product layout
cailmdaley Jul 10, 2026
16e9c30
fix(sacc_io): enforce ascending grids; readers in insertion order
cailmdaley Jul 10, 2026
7eb8595
One SACC file per catalogue version: fine xi rides as grid='fine' points
cailmdaley Jul 10, 2026
85771ba
Word fine-block covariance source tool-agnostically (OneCovariance go…
cailmdaley Jul 11, 2026
9b7e787
feat(sacc_io): type=data|mock stamp with fail-closed load; merge + up…
cailmdaley Jul 15, 2026
87b3598
Address review: rename grid values to reporting/integration; clarify …
cailmdaley Jul 16, 2026
4489dd4
Simplify sacc_io writers/readers and test builders
cailmdaley Jul 16, 2026
8bd3817
fix(sacc_io): fail loud on unmatched selections; merge/update guards
cailmdaley Jul 16, 2026
90d53af
Rebuild PR4 on feat/sacc-2-sacc-io: drop vendored sacc_io, keep migra…
cailmdaley Jul 16, 2026
72e680f
Migrate to canonical sacc_io API: typed save, fail-closed load, grid …
cailmdaley Jul 16, 2026
3abb566
sacc_io: guard merge() against inconsistent theta grids
cailmdaley Jul 18, 2026
2da8c10
sacc_io: extend merge guard to ell grids and bandpower windows; tag p…
cailmdaley Jul 18, 2026
01fa5eb
Store covariance block-diagonally in assemble_covariance
cailmdaley Jul 21, 2026
b131ae7
Unify pure-EB integration-grid default to 1000 bins
cailmdaley Jul 21, 2026
df28f42
sacc_io: make optional statistic components genuinely optional
cailmdaley Jul 21, 2026
da9a90a
cosmo_val config: align COSEBIs integration grid with the 1000-bin de…
cailmdaley Jul 21, 2026
4635f8a
Merge remote-tracking branch 'origin/feat/sacc-2-sacc-io' into feat/s…
cailmdaley Jul 21, 2026
aa2f474
feat(sacc): one terminal file + fail-closed assembly
cailmdaley Jul 21, 2026
1dfff78
docs(workflow): mark glass-mock A/B/C 'blind' as distinct from Smokes…
cailmdaley Jul 21, 2026
19f8b1f
fix(sacc): reconcile writers with the merged sacc_io API
cailmdaley Jul 21, 2026
20938ac
Merge remote-tracking branch 'origin/develop' into feat/sacc-4-cosmo-…
cailmdaley Jul 21, 2026
f5eb417
chore(deps): restore develop's uv.lock SSOT; drop stale firecrown-era…
cailmdaley Jul 21, 2026
8fc6fcb
chore(ci): restore develop's lint.yml (PR #264 server-side ruff autof…
cailmdaley Jul 21, 2026
4f7dc21
revert(sacc): drop xi_integration from terminal file per #247 ruling
cailmdaley Jul 21, 2026
b60fcb9
chore: drop files resurrected from a stale base (deleted on develop)
cailmdaley Jul 21, 2026
36ff7b1
chore(2pcf): default integration grid to 1000 bins
cailmdaley Jul 21, 2026
6221c18
feat(cosmo_val): cv_cosebis/cv_pure_eb consume the ξ± SACC parts; per…
cailmdaley Jul 21, 2026
8909fd5
Merge remote-tracking branch 'origin/develop' into feat/sacc-4-cosmo-…
cailmdaley Aug 30, 2026
cd630c5
Restore cosmo_inference/ to develop state (stale-base residue reverte…
cailmdaley Aug 30, 2026
16db5b2
One binning-agnostic xi rule (grid + covariance are config, not a sec…
cailmdaley Aug 30, 2026
b437968
Restore develop files wrongly deleted by stale-base cleanup (realspac…
cailmdaley Aug 30, 2026
f14774b
Restore develop content wrongly reverted by stale base (.gitignore uv…
cailmdaley Aug 30, 2026
7e16398
simplify: trim comments to Google style; dedupe helpers; drop dead knobs
cailmdaley Aug 30, 2026
8541fd7
cv_cosebis: derive Bn from the integration part; unpatched integratio…
cailmdaley Aug 31, 2026
f5f086b
test: make the COSEBIs override stub work under the blinded-part writ…
cailmdaley Aug 31, 2026
e37aeaa
Leave inference.smk untouched: it is #255's to rewrite
cailmdaley Aug 31, 2026
f11670c
Assemble against the real CosmoCov ξ± covariance; drop the placeholder
cailmdaley Aug 31, 2026
726a0ca
covariance_process: run the launched checkout's cosmocov_process.py
cailmdaley Aug 31, 2026
34db82f
Leave cosmo_inference/README.md untouched (inference is out of scope …
cailmdaley Aug 31, 2026
dfe3a5b
Restore image_sims include + README section (out of scope here)
cailmdaley Aug 31, 2026
9abf08d
README: state the 3.12 requirement, not its rationale
cailmdaley Aug 31, 2026
bfa4819
Comment sweep: each concept once, at the thing itself
cailmdaley Aug 31, 2026
f56bede
Each grid carries its own covariance; COSEBIs derives from ξ± arrays
cailmdaley Aug 31, 2026
aaedb50
cv_cosebis: bind the COSEBIs grid's part, and declare the figures
cailmdaley Aug 31, 2026
cabc582
Pure E/B derives from its parts; per-patch vectors are never written
cailmdaley Aug 31, 2026
770619d
cv_summarize_bmodes reads the products instead of recomputing them
cailmdaley Aug 31, 2026
40d20a8
Review round: one pseudo-Cl producer, analytic covariance wins, grid …
cailmdaley Aug 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,25 @@ docker run --rm -it ghcr.io/cosmostat/sp_validation:develop python -c "import sp

We do not currently build images for Apple Silicon/arm64; however the amd64 images should work on these systems, albeit with reduced performance.

## Local Installation

Requires Python ≥ 3.12. With [uv](https://docs.astral.sh/uv/):

```bash
uv venv --python 3.12
uv pip install -e '.[test]'
```

To also install the data-vector blinding stack (Smokescreen + firecrown, PRD
[#241](https://github.com/CosmoStat/sp_validation/issues/241)), pass the
dependency-override file — firecrown is not pip-resolvable without it (see
`uv-overrides.txt` for why):

```bash
uv pip install --overrides uv-overrides.txt -e '.[test,blinding]'
python scripts/patch_firecrown.py # make pip-installed firecrown importable without NumCosmo
```



## Flow chart
Expand Down
18 changes: 7 additions & 11 deletions papers/bmodes/rules/claims.smk
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ def _xi_reporting_path(version):


def _xi_integration_path(version):
"""Path to fine-binned 2PCF integration file."""
"""Path to fine-binned 2PCF integration file. Unpatched: values only, no covariance."""
return (
f"{COSMO_VAL_OUTPUT}/{version}_xi_minsep={FIDUCIAL['min_sep_int']}"
f"_maxsep={FIDUCIAL['max_sep_int']}_nbins={FIDUCIAL['nbins_int']}_npatch={FIDUCIAL['npatch']}.txt"
f"_maxsep={FIDUCIAL['max_sep_int']}_nbins={FIDUCIAL['nbins_int']}_npatch=1.txt"
)


Expand Down Expand Up @@ -355,25 +355,21 @@ rule pure_eb_covariance:


rule calculate_pure_eb_ptes:
"""Calculate PTE matrices for Pure E/B mode scale cut robustness.
"""PTE matrices for pure E/B-mode scale-cut robustness.

Per-blind: Uses blind-specific integration covariance for PTE calculation.
The pure_eb_data vectors are identical across blinds; only covariance differs.

In practice, BB covariance is blind-independent (validated by
bb_covariance_blind_independence), so downstream consumers (config_space_pte_matrices)
only request blind A. The per-blind wildcard is retained for the blind independence test.
Nothing here varies with the blind: the data vectors come from the blind-A
gather and the PTEs are Hartlap-debiased by the MC draw count, not by a
per-blind covariance. The wildcard survives as the filename slot the
consumer (config_space_pte_matrices) reads, and only blind A is ever built.
"""
input:
pure_eb_data="results/paper_plots/intermediate/{version}_A_pure_eb_semianalytic.npz",
cov_integration=lambda w: _cov_integration_path(w.version, w.blind),
output:
"results/paper_plots/intermediate/{version}_{blind}_pure_eb_ptes.npz",
wildcard_constraints:
blind=r"[ABC]",
params:
version="{version}",
npatch=FIDUCIAL["npatch"],
n_samples=config["covariance"]["n_samples"],
resources:
mem_mb=16000,
Expand Down
35 changes: 6 additions & 29 deletions papers/bmodes/scripts/calculate_pure_eb_ptes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
pure-E/B ``semianalytic.npz`` (data vectors + MC covariance), evaluates the
ξ_+^B / ξ_-^B / joint ξ_tot^B χ² PTE matrices over the scale-cut grid via
``sp_validation.b_modes.calculate_eb_statistics`` (Hartlap-corrected inverse
MC covariance), and writes the PTE matrices to
MC covariance, debiased by the draw count), and writes the PTE matrices to
``{out}/{version}_{blind}_pure_eb_ptes.npz``.

python calculate_pure_eb_ptes.py \
--version SP_v1.4.6.3_leak_corr --blind A \
--pure-eb-data <..._pure_eb_semianalytic.npz> \
--cov-integration <cov ..._processed.txt> \
--npatch 1 --n-samples 2000 --out <output_dir>
--n-samples 2000 --out <output_dir>
"""

import argparse
Expand All @@ -22,31 +21,21 @@
from sp_validation.b_modes import calculate_eb_statistics


class FakeGG:
"""Minimal GGCorrelation-like object for calculate_eb_statistics."""

def __init__(self, nbins, npatch):
self.nbins = nbins
self.npatch1 = npatch
self.npatch2 = npatch


def calculate_ptes(
version,
blind,
pure_eb_data,
cov_integration,
npatch,
n_samples,
output_dir,
):
dataset = np.load(pure_eb_data)

theta = dataset["theta"]
nbins = len(theta)

results = {
"gg": FakeGG(nbins, int(npatch)),
"theta": theta,
# The MC draws are the realisations behind this covariance.
"n_eff": int(n_samples),
"xip_E": dataset["xip_E"],
"xim_E": dataset["xim_E"],
"xip_B": dataset["xip_B"],
Expand All @@ -57,11 +46,7 @@ def calculate_ptes(
}

print(f"Calculating PTE matrices for {version}...")
results = calculate_eb_statistics(
results,
cov_path_int=cov_integration,
n_samples=int(n_samples),
)
results = calculate_eb_statistics(results)

pte_matrices = results["pte_matrices"]
output_data = {
Expand All @@ -83,21 +68,13 @@ def _from_cli(argv=None):
ap.add_argument("--version", required=True)
ap.add_argument("--blind", default="A")
ap.add_argument("--pure-eb-data", required=True, help="Gathered semianalytic .npz")
ap.add_argument(
"--cov-integration",
default=None,
help="Integration-grid covariance _processed.txt (optional)",
)
ap.add_argument("--npatch", type=int, default=1)
ap.add_argument("--n-samples", type=int, default=2000)
ap.add_argument("--out", required=True, help="Output directory (lc {output})")
a = ap.parse_args(argv)
calculate_ptes(
version=a.version,
blind=a.blind,
pure_eb_data=a.pure_eb_data,
cov_integration=a.cov_integration,
npatch=a.npatch,
n_samples=a.n_samples,
output_dir=a.out,
)
Expand Down
6 changes: 3 additions & 3 deletions papers/bmodes/scripts/run_xi_sweep.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Loops the [non-fiducial version list](sweep_versions.nonfiducial_versions) and
runs the same ``run_2pcf.run_2pcf`` compute the fiducial two_point recipes call,
once per version, writing every version's ξ± text dump (+ ξ+/ξ- FITS) into one
lc ``{output}`` dir under run_2pcf's native, already-canonical name
once per version, writing every version's ξ± text dump into one lc ``{output}``
dir under run_2pcf's native, already-canonical name
``{ver}_xi_minsep={min}_maxsep={max}_nbins={nbins}_npatch={npatch}.txt`` — the
exact pattern ``cosebis_version_comparison._xi_integration`` reconstructs.

Expand Down Expand Up @@ -76,7 +76,7 @@ def _from_cli(argv=None):
ver=ver,
cat_config=a.cat_config,
output_dir=a.out,
save_fits=True,
grid=grid,
**GRIDS[grid],
)

Expand Down
10 changes: 5 additions & 5 deletions papers/cosmo_val/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ cosmo_val:
kmax: 20
kmax_extrapolate: 500

# Pure E/B-mode decomposition (config space)
pure_eb:
min_sep_int: 0.08
max_sep_int: 300
nbins_int: 1000
# The fine ξ± grid the B-mode integrals run over.
integration:
min_sep: 0.08
max_sep: 300
nbins: 1000

# COSEBIs decomposition (config space, fine integration binning)
cosebis:
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ dependencies = [
"pymaster",
"regions",
"reproject",
"sacc>=0.12",
# Floor matches the resolved lock; needs sacc's 2.x rewrite (BlockDiagonalCovariance).
"sacc>=2.4,<3",
# scipy 1.18 ported FITPACK from Fortran to C, changing the return shape of
# RectBivariateSpline(scalar, scalar, grid=False) from 0-d `array(x)` to
# shape-(1,) `array([x])`. camb's BBN Y_He predictor (bbn.py) wraps the
Expand Down Expand Up @@ -152,8 +153,8 @@ glass = [
# Snakemake workflow and cross-validation runners are available.
workflow = [
"snakemake",
# run_2pcf_highres.py drives the MPI convergence run; the container ships
# OpenMPI (/opt/ompi) so mpi4py builds against it.
# Optional MPI runners (the container ships OpenMPI at /opt/ompi, so mpi4py
# builds against it).
"mpi4py",
# NOTE: workflow/scripts/cv_*.py also import `cv_runner`, which is not
# published or resolvable (no public repo found) — left undeclared pending
Expand Down
Loading
Loading