Reproducible codebase for Palatini × PT-even + spurion.
This repo accompanies the manuscript and reproduces all C1/C2/C3 results and figures end-to-end.
Highlights
- ✅ Analytic claims (C1/C2/C3) organized as paper-checkable identities
- ✅ One-command figure regeneration (
make paper) - ✅ Full test suite (44 passed) and CI-ready
- ✅ Notebooks for demonstrations + Colab viewing
- ✅ Snakemake DAG of the figure pipeline (
tex/snakemake_dag.pdf) - ✅ App. D: 2×2 mixing matrix artifact + locking check(
make mixing)
# Option A: conda (recommended)
conda env create -f environment.yml
conda activate palpt
# Option B: venv/pip
python -m venv .venv && source .venv/bin/activate
pip install -U pip
pip install -e .[dev]
# Reproduce all paper figures & data
make paper
# Run tests exactly as used for the paper
make paper-testExpected output (abridged):
Generated:
[pdfs] figs/pdf/fig1_c1_pure_trace.pdf
...
[pdfs] figs/pdf/fig9_flux_ratio.pdf
[data] figs/data/*.csv, *.npz
44 passed in ~5–6s
# conda
conda env create -f environment.yml
conda activate palpt
# or pip/venv
python -m venv .venv && source .venv/bin/activate
pip install -U pip
pip install -e .[dev]Check tooling:
pre-commit install && pre-commit run -a
pytest -q
palpt --help| Task | Command | Output |
|---|---|---|
| Generate all figures & data (paper grids) | make paper |
figs/pdf/fig*.pdf, figs/data/* |
| Run the exact paper test suite | make paper-test |
44 passed |
| App. D mixing matrix + locking check | make mixing |
figs/data/mixing_matrix.csv、figs/data/mixing_matrix_meta.json(含 .md5),並打印鎖定比 w*_ROD:w*_CM |
| Sync notebooks (Jupytext) | make nb |
notebooks/*.py updated |
| Execute notebooks headless | make nb-test |
notebooks executed in-place |
| Build the pipeline DAG | make dag |
tex/snakemake_dag.pdf |
Note (DAG dependencies). make dag 需要:
-
Python 套件:
snakemake,graphviz(py binding 已在.[dev]); -
系統層的
dot可執行檔:如sudo apt-get install graphviz或brew install graphviz。
Colab 安裝小抄(每本筆記首格可用)
# Option 1: 安裝已公開的 GitHub 套件(最簡)
!pip -q install "git+https://github.com/ice91/palatini-pt-spurion.git"
# Option 2: clone + 本地 editable 安裝(便於開發)
!git clone https://github.com/ice91/palatini-pt-spurion.git
%cd palatini-pt-spurion
!pip -q install -e .筆記僅依賴
numpy/sympy/matplotlib等常見庫,Colab 原生可用;不需要graphviz/snakemake。
在 matplotlib 標題/標籤含 LaTeX 字串時請使用 raw string,例如:r"$\\mathcal R_{X/Y}$"。
palpt --help
palpt figs --which all --config configs/paper_grids.yaml # 生成論文圖
palpt figs --which smoke # 快速 smokepalatini-pt-spurion/
├─ palatini_pt/ # 核心邏輯(algebra / palatini / equivalence / gw / spurion / io)
├─ scripts/ # 產圖腳本(fig1–fig9 + make_all_figs + mixing_matrix_extract.py)
├─ configs/ # 掃描與係數設定(含 paper_grids.yaml,coeffs/*)
├─ figs/ # 產出 PDF/PNG 與中間數據(含 .md5;含 mixing_matrix.csv)
├─ notebooks/ # Colab 友善展示 notebook
├─ tests/ # 單元與整合測試(**44 tests**,含 test_mixing_matrix_extract.py)
├─ tex/ # Snakemake DAG、TikZ 原檔
├─ Snakefile # 圖片產製規則
├─ Makefile # 一鍵:paper / tests / nb / dag / mixing
├─ environment.yml, pyproject.toml, CITATION.cff, LICENSE
產製流程圖(需 snakemake 與系統 dot):
make dag
# 輸出:tex/snakemake_dag.pdf-
Figures regenerate with
make paperunder the pinned environment. -
Tests pass with
make paper-test(44 tests). -
App. D:
make mixing生成mixing_matrix.csv與 meta,並檢查兩條混合條件的比例一致(C3 鎖定)。 -
Static artifacts provided in
figs/with.md5sidecars. -
No shell-escape required in LaTeX; figures are external PDFs.
-
DAG of the pipeline:
tex/snakemake_dag.pdf.
See CITATION.cff. If you use this repository, please cite both the companion paper and this software snapshot.
MIT (see LICENSE).
This repository separates paper-checkable identities (C1/C2/C3) from computational artifacts. We thank the community for reproducibility best practices that inspired this layout.