Skip to content

Commit be04023

Browse files
committed
ipynb
1 parent 9c39e49 commit be04023

File tree

4 files changed

+222
-0
lines changed

4 files changed

+222
-0
lines changed

notebooks/00_sanity.ipynb

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "0",
6+
"metadata": {},
7+
"source": [
8+
"# 00 — sanity\n",
9+
"Quick import + TT luminality smoke (should be exactly 1 at LO)."
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": null,
15+
"id": "1",
16+
"metadata": {},
17+
"outputs": [],
18+
"source": [
19+
"import numpy as np\n",
20+
"from palatini_pt.gw.quadratic_action import tensor_action_coeffs\n",
21+
"from palatini_pt.spurion.pt_even import project_scalar\n",
22+
"from palatini_pt.spurion.profile import constant_gradient"
23+
]
24+
},
25+
{
26+
"cell_type": "code",
27+
"execution_count": null,
28+
"id": "2",
29+
"metadata": {},
30+
"outputs": [],
31+
"source": [
32+
"k = np.logspace(-3, -1, 64)\n",
33+
"deps = constant_gradient([0.0, 0.0, 1.0]) # ∂ε 指向 z\n",
34+
"Seps = project_scalar(np.dot(deps, deps))\n",
35+
"\n",
36+
"K, G = tensor_action_coeffs(Seps)\n",
37+
"cT2 = G / K\n",
38+
"print(\"K(LO)=\", K, \"G(LO)=\", G, \"c_T^2(LO)=\", cT2)\n",
39+
"assert np.allclose(cT2, 1.0), \"locked LO must be luminal\""
40+
]
41+
}
42+
],
43+
"metadata": {
44+
"jupytext": {
45+
"cell_metadata_filter": "-all",
46+
"main_language": "python",
47+
"notebook_metadata_filter": "kernelspec,language_info"
48+
},
49+
"language_info": {
50+
"codemirror_mode": {
51+
"name": "ipython",
52+
"version": 3
53+
},
54+
"file_extension": ".py",
55+
"mimetype": "text/x-python",
56+
"name": "python",
57+
"nbconvert_exporter": "python",
58+
"pygments_lexer": "ipython3",
59+
"version": "3.12.3"
60+
}
61+
},
62+
"nbformat": 4,
63+
"nbformat_minor": 5
64+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "0",
6+
"metadata": {},
7+
"source": [
8+
"# 10 — C2 symbolic demo\n",
9+
"Show DBI / closed-metric reduce to A_* * I_T at quadratic order."
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": null,
15+
"id": "1",
16+
"metadata": {},
17+
"outputs": [],
18+
"source": [
19+
"import sympy as sp\n",
20+
"from palatini_pt.equivalence.coeff_extractor import reduce_to_IT\n",
21+
"\n",
22+
"lam, eta, Seps = sp.symbols(\"lambda eta Seps\", positive=True)\n",
23+
"res_dbi = reduce_to_IT(route=\"dbi\", lam=lam, eta=eta, Seps=Seps)\n",
24+
"res_cm = reduce_to_IT(route=\"closed_metric\", lam=lam, eta=eta, Seps=Seps)\n",
25+
"sp.simplify(res_dbi - res_cm)"
26+
]
27+
}
28+
],
29+
"metadata": {
30+
"jupytext": {
31+
"cell_metadata_filter": "-all",
32+
"main_language": "python",
33+
"notebook_metadata_filter": "kernelspec,language_info"
34+
},
35+
"language_info": {
36+
"codemirror_mode": {
37+
"name": "ipython",
38+
"version": 3
39+
},
40+
"file_extension": ".py",
41+
"mimetype": "text/x-python",
42+
"name": "python",
43+
"nbconvert_exporter": "python",
44+
"pygments_lexer": "ipython3",
45+
"version": "3.12.3"
46+
}
47+
},
48+
"nbformat": 4,
49+
"nbformat_minor": 5
50+
}

notebooks/20_flux_ratio.ipynb

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "0",
6+
"metadata": {},
7+
"source": [
8+
"# 20 — Flux ratio R_{X/Y}(R) -> 1\n",
9+
"Finite-domain FRW ball visualization."
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": null,
15+
"id": "1",
16+
"metadata": {},
17+
"outputs": [],
18+
"source": [
19+
"import numpy as np, matplotlib.pyplot as plt\n",
20+
"from palatini_pt.equivalence.flux_ratio import flux_ratio_FRW\n",
21+
"\n",
22+
"R = np.linspace(5.0, 80.0, 60)\n",
23+
"out = flux_ratio_FRW(R, {\"flux\": {\"sigma\": 1.0, \"c\": 0.5}})\n",
24+
"plt.plot(out[\"R\"], out[\"R_DBI_CM\"])\n",
25+
"plt.axhline(1.0, ls=\"--\")\n",
26+
"plt.xlabel(\"R\"); plt.ylabel(r\"$\\mathcal R_{X/Y}$\")\n",
27+
"plt.title(\"Flux ratio → 1 with $R^{-\\sigma}$ tail\")\n",
28+
"plt.show()"
29+
]
30+
}
31+
],
32+
"metadata": {
33+
"jupytext": {
34+
"cell_metadata_filter": "-all",
35+
"main_language": "python",
36+
"notebook_metadata_filter": "kernelspec,language_info"
37+
},
38+
"language_info": {
39+
"codemirror_mode": {
40+
"name": "ipython",
41+
"version": 3
42+
},
43+
"file_extension": ".py",
44+
"mimetype": "text/x-python",
45+
"name": "python",
46+
"nbconvert_exporter": "python",
47+
"pygments_lexer": "ipython3",
48+
"version": "3.12.3"
49+
}
50+
},
51+
"nbformat": 4,
52+
"nbformat_minor": 5
53+
}

notebooks/30_nlo_offsets.ipynb

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "0",
6+
"metadata": {},
7+
"source": [
8+
"# 30 — NLO offsets\n",
9+
"δc_T^2(k) ~ b k^2 / Λ^2"
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": null,
15+
"id": "1",
16+
"metadata": {},
17+
"outputs": [],
18+
"source": [
19+
"import numpy as np, matplotlib.pyplot as plt\n",
20+
"from palatini_pt.gw.nlo import predict_offsets\n",
21+
"\n",
22+
"k = np.logspace(-3, -1, 200)\n",
23+
"cfg = {\"nlo\": {\"gradT_sq_eff\": 1.0, \"Ricci_deps_deps_eff\": 0.3, \"Lambda2\": 1e6}}\n",
24+
"out = predict_offsets(k, cfg)\n",
25+
"\n",
26+
"plt.loglog(k, np.abs(out[\"delta_cT2\"]), label=r\"$|\\delta c_T^2|$\")\n",
27+
"plt.loglog(k, (out[\"delta_cT2\"][0]/(k[0]**2))*k**2, ls=\"--\", label=r\"$\\propto k^2$\")\n",
28+
"plt.legend(); plt.xlabel(\"k\"); plt.ylabel(r\"$|\\delta c_T^2|$\")\n",
29+
"plt.title(\"NLO: $k^2/\\\\Lambda^2$\")\n",
30+
"plt.show()"
31+
]
32+
}
33+
],
34+
"metadata": {
35+
"jupytext": {
36+
"cell_metadata_filter": "-all",
37+
"main_language": "python",
38+
"notebook_metadata_filter": "kernelspec,language_info"
39+
},
40+
"language_info": {
41+
"codemirror_mode": {
42+
"name": "ipython",
43+
"version": 3
44+
},
45+
"file_extension": ".py",
46+
"mimetype": "text/x-python",
47+
"name": "python",
48+
"nbconvert_exporter": "python",
49+
"pygments_lexer": "ipython3",
50+
"version": "3.12.3"
51+
}
52+
},
53+
"nbformat": 4,
54+
"nbformat_minor": 5
55+
}

0 commit comments

Comments
 (0)