nmbackend 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nmbackend/__init__.py +22 -0
- nmbackend/adapters/__init__.py +4 -0
- nmbackend/adapters/rift.py +95 -0
- nmbackend/constants.py +55 -0
- nmbackend/cooling/README.md +159 -0
- nmbackend/cooling/__init__.py +13 -0
- nmbackend/cooling/build_nscool.sh +51 -0
- nmbackend/cooling/isothermal.py +76 -0
- nmbackend/cooling/nscool_nmbackend.patch +310 -0
- nmbackend/cooling/physics/__init__.py +18 -0
- nmbackend/cooling/physics/_spline.py +71 -0
- nmbackend/cooling/physics/blanket.py +66 -0
- nmbackend/cooling/physics/conduct.py +196 -0
- nmbackend/cooling/physics/core_conduct.py +68 -0
- nmbackend/cooling/physics/core_nu.py +268 -0
- nmbackend/cooling/physics/crust.py +113 -0
- nmbackend/cooling/physics/crust_nu.py +93 -0
- nmbackend/cooling/physics/curve.py +42 -0
- nmbackend/cooling/physics/envelope.py +37 -0
- nmbackend/cooling/physics/gaps.py +164 -0
- nmbackend/cooling/physics/geometry.py +131 -0
- nmbackend/cooling/physics/heat.py +125 -0
- nmbackend/cooling/physics/native.py +138 -0
- nmbackend/cooling/physics/reference.py +53 -0
- nmbackend/cooling/physics/star.py +225 -0
- nmbackend/cooling/physics/superfluid.py +41 -0
- nmbackend/cooling/physics/whole.py +136 -0
- nmbackend/cooling/runner.py +583 -0
- nmbackend/cooling/validate.py +120 -0
- nmbackend/data/crust_sly_dh2001.dat +81 -0
- nmbackend/data/frib_scenario_ladder.yaml +100 -0
- nmbackend/durca.py +111 -0
- nmbackend/ejecta.py +614 -0
- nmbackend/eos/__init__.py +19 -0
- nmbackend/eos/base.py +523 -0
- nmbackend/eos/compose.py +251 -0
- nmbackend/eos/coolcomp.py +67 -0
- nmbackend/eos/crust.py +318 -0
- nmbackend/eos/ddrmf.py +388 -0
- nmbackend/eos/hybrid.py +173 -0
- nmbackend/eos/leptons.py +74 -0
- nmbackend/eos/metamodel.py +303 -0
- nmbackend/eos/polytrope.py +33 -0
- nmbackend/eos/rmft.py +450 -0
- nmbackend/eos/skyrme.py +352 -0
- nmbackend/inference/__init__.py +13 -0
- nmbackend/inference/fisher.py +174 -0
- nmbackend/inference/synthetic.py +83 -0
- nmbackend/ipad.py +102 -0
- nmbackend/lab_likelihood.py +587 -0
- nmbackend/nscool_io.py +112 -0
- nmbackend/postmerger.py +264 -0
- nmbackend/priors/__init__.py +16 -0
- nmbackend/priors/bridge.py +437 -0
- nmbackend/priors/bridge_jax.py +435 -0
- nmbackend/priors/gp_pca.py +325 -0
- nmbackend/reference/__init__.py +11 -0
- nmbackend/reference/reprimand.py +108 -0
- nmbackend/reference/scipy_tov.py +289 -0
- nmbackend/rift/__init__.py +26 -0
- nmbackend/rift/compressed.py +194 -0
- nmbackend/rift/evidence.py +276 -0
- nmbackend/rift/sequence.py +428 -0
- nmbackend/rotating/__init__.py +7 -0
- nmbackend/rotating/rns.py +197 -0
- nmbackend/rotating/tabulated.py +249 -0
- nmbackend/thermal/__init__.py +1 -0
- nmbackend/thermal/diffusion.py +86 -0
- nmbackend/tov/__init__.py +15 -0
- nmbackend/tov/central.py +72 -0
- nmbackend/tov/family.py +155 -0
- nmbackend/tov/phase_transition.py +93 -0
- nmbackend/tov/solver.py +475 -0
- nmbackend/validation/__init__.py +5 -0
- nmbackend/validation/model_diagnostic.py +67 -0
- nmbackend/validation/reference_matrix.py +216 -0
- nmbackend-0.4.0.dist-info/METADATA +168 -0
- nmbackend-0.4.0.dist-info/RECORD +81 -0
- nmbackend-0.4.0.dist-info/WHEEL +5 -0
- nmbackend-0.4.0.dist-info/licenses/LICENSE +21 -0
- nmbackend-0.4.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"""Reference-matrix harness: run several TOV solvers on a ladder of EOS and tabulate
|
|
2
|
+
per-quantity differences **at fixed gravitational mass**.
|
|
3
|
+
|
|
4
|
+
Comparing at fixed mass (not fixed central density/enthalpy) is deliberate: it is
|
|
5
|
+
convention-independent, so RePrimAnd (central gm1), our solver (central h), and any
|
|
6
|
+
other reference are compared on the physically meaningful M-R-Lambda relation.
|
|
7
|
+
|
|
8
|
+
Solvers (each is *guarded* -- absent backends are simply skipped):
|
|
9
|
+
diffrax : nmbackend production adaptive solver
|
|
10
|
+
scipy_hbeta: independent radius-domain SciPy RK45 + (H,beta) reference
|
|
11
|
+
reprimand : RePrimAnd 1.7 (external; needs pyreprimand)
|
|
12
|
+
lalsim : lalsimulation named-EOS path (planned; needs a shared table)
|
|
13
|
+
qlimr : MUSES qlimr observables (planned; external -- source not yet vendored)
|
|
14
|
+
|
|
15
|
+
Output: for each EOS and target mass, R [km] and Lambda from each solver, plus the
|
|
16
|
+
difference vs the chosen reference (Delta R in metres, Delta Lambda in percent).
|
|
17
|
+
The reference defaults to the most accurate available: reprimand > scipy_hbeta.
|
|
18
|
+
|
|
19
|
+
Lightweight by design: one file, numpy + the package's own solvers, no plotting.
|
|
20
|
+
Run: PYTHONPATH=src python -m nmbackend.validation.reference_matrix
|
|
21
|
+
"""
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import numpy as np
|
|
25
|
+
|
|
26
|
+
from ..eos import MetaModelEOS, HybridEOS, RMFTEOS
|
|
27
|
+
from ..tov import build_family, solve_hybrid
|
|
28
|
+
from ..tov.family import default_hc_grid
|
|
29
|
+
from ..reference.scipy_tov import solve_reference, solve_reference_hybrid
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
from ..reference import reprimand as _rpa
|
|
33
|
+
_HAVE_RPA = bool(_rpa.HAVE_REPRIMAND)
|
|
34
|
+
except Exception:
|
|
35
|
+
_HAVE_RPA = False
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# ---------- stable-branch utilities ----------
|
|
39
|
+
def _rising_branch(M, R, L):
|
|
40
|
+
"""Stable, mass-increasing branch up to M_max, sorted by mass."""
|
|
41
|
+
M, R, L = map(lambda a: np.asarray(a, float), (M, R, L))
|
|
42
|
+
ok = np.isfinite(M) & np.isfinite(R) & (M > 0)
|
|
43
|
+
M, R, L = M[ok], R[ok], L[ok]
|
|
44
|
+
if M.size < 3:
|
|
45
|
+
return M, R, L
|
|
46
|
+
imax = int(np.argmax(M))
|
|
47
|
+
imin = int(np.argmin(M[:imax + 1])) # minimum-mass star (crust tables)
|
|
48
|
+
M, R, L = M[imin:imax + 1], R[imin:imax + 1], L[imin:imax + 1]
|
|
49
|
+
o = np.argsort(M)
|
|
50
|
+
return M[o], R[o], L[o]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _at_masses(M, R, L, targets):
|
|
54
|
+
"""Interpolate R, Lambda at target masses (NaN outside the branch / above Mmax)."""
|
|
55
|
+
M, R, L = _rising_branch(M, R, L)
|
|
56
|
+
if M.size < 2:
|
|
57
|
+
nan = np.full(len(targets), np.nan)
|
|
58
|
+
return nan, nan, (M.max() if M.size else np.nan)
|
|
59
|
+
Rt = np.interp(targets, M, R, left=np.nan, right=np.nan)
|
|
60
|
+
Lt = np.interp(targets, M, L, left=np.nan, right=np.nan)
|
|
61
|
+
return Rt, Lt, float(M.max())
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# ---------- solver sequence runners (return raw M, R, Lambda arrays) ----------
|
|
65
|
+
def _seq_diffrax_smooth(table, hc):
|
|
66
|
+
f = build_family(table, hc)
|
|
67
|
+
return np.asarray(f.M_msun), np.asarray(f.R_km), np.asarray(f.Lambda)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _seq_scipy_smooth(table, hc):
|
|
71
|
+
pts = [solve_reference(table, float(h)) for h in hc]
|
|
72
|
+
return (np.array([p.M_msun for p in pts]),
|
|
73
|
+
np.array([p.R_km for p in pts]),
|
|
74
|
+
np.array([p.Lambda for p in pts]))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _seq_rpa_smooth(table, hc):
|
|
78
|
+
M, R, L, _ = _rpa.reprimand_sequence(table)
|
|
79
|
+
return np.asarray(M), np.asarray(R), np.asarray(L)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _seq_diffrax_hybrid(hybrid, hc):
|
|
83
|
+
pts = [solve_hybrid(hybrid, float(h)) for h in hc]
|
|
84
|
+
return (np.array([float(p.M_msun) for p in pts]),
|
|
85
|
+
np.array([float(p.R_km) for p in pts]),
|
|
86
|
+
np.array([float(p.Lambda) for p in pts]))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _seq_scipy_hybrid(hybrid, hc):
|
|
90
|
+
pts = [solve_reference_hybrid(hybrid, float(h)) for h in hc]
|
|
91
|
+
return (np.array([p.M_msun for p in pts]),
|
|
92
|
+
np.array([p.R_km for p in pts]),
|
|
93
|
+
np.array([p.Lambda for p in pts]))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _seq_rpa_hybrid(hybrid, hc):
|
|
97
|
+
M, R, L, _ = _rpa.reprimand_sequence(hybrid.eos_table())
|
|
98
|
+
return np.asarray(M), np.asarray(R), np.asarray(L)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
# ---------- EOS ladder ----------
|
|
102
|
+
def build_ladder():
|
|
103
|
+
"""(name, kind, obj, hc_grid_fn) for each EOS in the adversarial ladder."""
|
|
104
|
+
mm = MetaModelEOS()
|
|
105
|
+
cases = [
|
|
106
|
+
("MetaModel(L60, cs2_tail=0.4)", "smooth", mm.eos_table(), None),
|
|
107
|
+
("MetaModel(stiff cs2_tail=0.6)", "smooth", mm.eos_table({"cs2_tail": 0.6}), None),
|
|
108
|
+
("MetaModel(soft cs2_tail=0.3)", "smooth", mm.eos_table({"cs2_tail": 0.3}), None),
|
|
109
|
+
("MetaModel(L40)", "smooth", mm.eos_table({"L_sym": 40.0}), None),
|
|
110
|
+
("RMFT(GM1)", "smooth", RMFTEOS().eos_table(), None),
|
|
111
|
+
("Hybrid(pt=80, de=250, cs2q=1)", "hybrid",
|
|
112
|
+
HybridEOS(p_trans_mev=80.0, delta_eps_mev=250.0, cs2_quark=1.0), None),
|
|
113
|
+
]
|
|
114
|
+
return cases
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
# ---------- runners per kind ----------
|
|
118
|
+
def _runners(kind):
|
|
119
|
+
if kind == "smooth":
|
|
120
|
+
r = {"diffrax": _seq_diffrax_smooth, "scipy_hbeta": _seq_scipy_smooth}
|
|
121
|
+
if _HAVE_RPA:
|
|
122
|
+
r["reprimand"] = _seq_rpa_smooth
|
|
123
|
+
else: # hybrid
|
|
124
|
+
r = {"diffrax": _seq_diffrax_hybrid, "scipy_hbeta": _seq_scipy_hybrid}
|
|
125
|
+
if _HAVE_RPA:
|
|
126
|
+
r["reprimand"] = _seq_rpa_hybrid
|
|
127
|
+
return r
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def _hc_grid(kind, obj, n_models):
|
|
131
|
+
if kind == "smooth":
|
|
132
|
+
return default_hc_grid(obj, n_models=n_models)
|
|
133
|
+
table = obj.eos_table()
|
|
134
|
+
return np.linspace(0.04 * float(table.h[-1]), 0.92 * float(table.h[-1]), n_models)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
# ---------- main comparison ----------
|
|
138
|
+
def run(target_masses=(1.2, 1.4, 1.6, 1.8, 2.0), n_models=60, reference=None,
|
|
139
|
+
csv_path=None):
|
|
140
|
+
ladder = build_ladder()
|
|
141
|
+
tm = np.asarray(target_masses, float)
|
|
142
|
+
rows = [] # long-format records for optional CSV (track vs budget over time)
|
|
143
|
+
|
|
144
|
+
print(f"Reference-matrix harness | targets M[Msun]={list(tm)} | n_models={n_models}")
|
|
145
|
+
print(f"available solvers: diffrax, scipy_hbeta"
|
|
146
|
+
+ (", reprimand" if _HAVE_RPA else " (reprimand: not installed)"))
|
|
147
|
+
print("Delta R in metres, Delta Lambda in percent, vs the reference column.\n")
|
|
148
|
+
|
|
149
|
+
for name, kind, obj, _ in ladder:
|
|
150
|
+
runners = _runners(kind)
|
|
151
|
+
hc = _hc_grid(kind, obj, n_models)
|
|
152
|
+
seqs = {}
|
|
153
|
+
for sname, fn in runners.items():
|
|
154
|
+
try:
|
|
155
|
+
seqs[sname] = _at_masses(*fn(obj, hc), tm)
|
|
156
|
+
except Exception as e:
|
|
157
|
+
print(f" [{sname} failed on {name}: {e!r}]")
|
|
158
|
+
ref = reference or ("reprimand" if "reprimand" in seqs else "scipy_hbeta")
|
|
159
|
+
if ref not in seqs:
|
|
160
|
+
print(f"=== {name}: reference {ref} unavailable, skipping ===\n")
|
|
161
|
+
continue
|
|
162
|
+
Rref, Lref, Mmax_ref = seqs[ref]
|
|
163
|
+
order = [s for s in ("reprimand", "scipy_hbeta", "diffrax") if s in seqs]
|
|
164
|
+
|
|
165
|
+
print(f"=== {name} (reference = {ref}) ===")
|
|
166
|
+
hdr = " M " + "".join(f"{'R_'+s:>12}" for s in order) \
|
|
167
|
+
+ "".join(f"{'dR_'+s+'[m]':>16}" for s in order if s != ref)
|
|
168
|
+
print(hdr)
|
|
169
|
+
for i, M in enumerate(tm):
|
|
170
|
+
row = f" {M:4.2f} "
|
|
171
|
+
for s in order:
|
|
172
|
+
row += f"{seqs[s][0][i]:12.4f}"
|
|
173
|
+
for s in order:
|
|
174
|
+
if s == ref:
|
|
175
|
+
continue
|
|
176
|
+
dR_m = (seqs[s][0][i] - Rref[i]) * 1000.0 # km -> m
|
|
177
|
+
row += f"{dR_m:16.1f}"
|
|
178
|
+
print(row)
|
|
179
|
+
hdrL = " M " + "".join(f"{'L_'+s:>12}" for s in order) \
|
|
180
|
+
+ "".join(f"{'dL_'+s+'[%]':>14}" for s in order if s != ref)
|
|
181
|
+
print(hdrL)
|
|
182
|
+
for i, M in enumerate(tm):
|
|
183
|
+
row = f" {M:4.2f} "
|
|
184
|
+
for s in order:
|
|
185
|
+
row += f"{seqs[s][1][i]:12.2f}"
|
|
186
|
+
for s in order:
|
|
187
|
+
if s == ref:
|
|
188
|
+
continue
|
|
189
|
+
dL = 100.0 * (seqs[s][1][i] - Lref[i]) / Lref[i]
|
|
190
|
+
row += f"{dL:14.2f}"
|
|
191
|
+
print(row)
|
|
192
|
+
print(f" (M_max[{ref}] = {Mmax_ref:.3f} Msun)\n")
|
|
193
|
+
|
|
194
|
+
for i, M in enumerate(tm):
|
|
195
|
+
for s in order:
|
|
196
|
+
rows.append(dict(
|
|
197
|
+
eos=name, M_target=float(M), solver=s, reference=ref,
|
|
198
|
+
R_km=float(seqs[s][0][i]), Lambda=float(seqs[s][1][i]),
|
|
199
|
+
dR_m=float((seqs[s][0][i] - Rref[i]) * 1000.0),
|
|
200
|
+
dLambda_pct=float(100.0 * (seqs[s][1][i] - Lref[i]) / Lref[i]),
|
|
201
|
+
))
|
|
202
|
+
|
|
203
|
+
if csv_path:
|
|
204
|
+
import csv
|
|
205
|
+
cols = ["eos", "M_target", "solver", "reference", "R_km", "Lambda",
|
|
206
|
+
"dR_m", "dLambda_pct"]
|
|
207
|
+
with open(csv_path, "w", newline="") as fh:
|
|
208
|
+
w = csv.DictWriter(fh, fieldnames=cols)
|
|
209
|
+
w.writeheader()
|
|
210
|
+
w.writerows(rows)
|
|
211
|
+
print(f"wrote {len(rows)} rows -> {csv_path}")
|
|
212
|
+
return rows
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
if __name__ == "__main__":
|
|
216
|
+
run()
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nmbackend
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: NuclearMatter-Backend: differentiable EOS + TOV tools for neutron-star EOS inference, interfacing RIFT and gwkokab.
|
|
5
|
+
Author: R. O'Shaughnessy, RIT CCRG nuclear-matter group
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 R. O'Shaughnessy and the RIT CCRG nuclear-matter group
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Keywords: neutron-star,equation-of-state,TOV,tidal-deformability,gravitational-waves,automatic-differentiation,jax,RIFT,gwkokab
|
|
29
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
30
|
+
Classifier: Programming Language :: Python :: 3
|
|
31
|
+
Requires-Python: >=3.9
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
License-File: LICENSE
|
|
34
|
+
Requires-Dist: numpy>=1.21
|
|
35
|
+
Requires-Dist: scipy>=1.7
|
|
36
|
+
Requires-Dist: jax>=0.4.20
|
|
37
|
+
Requires-Dist: jaxlib>=0.4.20
|
|
38
|
+
Requires-Dist: diffrax>=0.5
|
|
39
|
+
Requires-Dist: pyyaml>=5.0
|
|
40
|
+
Provides-Extra: reprimand
|
|
41
|
+
Provides-Extra: rift
|
|
42
|
+
Provides-Extra: gwkokab
|
|
43
|
+
Requires-Dist: numpyro; extra == "gwkokab"
|
|
44
|
+
Provides-Extra: test
|
|
45
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
46
|
+
Provides-Extra: docs
|
|
47
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
48
|
+
Requires-Dist: myst-parser; extra == "docs"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# NuclearMatter-Backend (`nmbackend`)
|
|
52
|
+
|
|
53
|
+
An open-source research toolkit for neutron-star **equations of state (EOS),
|
|
54
|
+
stellar structure, tidal deformability, and EOS inference**. The JAX core combines
|
|
55
|
+
nuclear models and imported tables with an adaptive TOV solver and selected
|
|
56
|
+
automatic-differentiation paths. It extends the preliminary EOS tooling in RIFT's
|
|
57
|
+
`EOSManager.py` and provides implemented RIFT adapters and sequence I/O.
|
|
58
|
+
|
|
59
|
+
**Status: v0.4.0, research software.** Capabilities have different validation and
|
|
60
|
+
differentiation coverage; inclusion does not establish precision-inference
|
|
61
|
+
readiness. Start with the [documentation index](docs/index.rst),
|
|
62
|
+
[capability guide](docs/capabilities.rst), and [validation guide](docs/validation.rst).
|
|
63
|
+
|
|
64
|
+
## Capabilities
|
|
65
|
+
|
|
66
|
+
- **EOS families:** nuclear empirical-parameter metamodel with causal tail;
|
|
67
|
+
nonlinear RMFT (GM1), density-dependent RMF (DD2/DDME2), standard/extended
|
|
68
|
+
Skyrme (SLy4/BSkG3), polytropes, Maxwell hybrid transitions, CompOSE/simple
|
|
69
|
+
tables and MUSES-CMF CSV readers, with crust and lepton/composition utilities.
|
|
70
|
+
- **Structure and tides:** adaptive diffrax TOV-in-enthalpy, Love numbers and
|
|
71
|
+
M–R–Λ families; explicit hybrid tidal junctions and an independent radius-domain
|
|
72
|
+
SciPy reference. Twin-star handling remains limited (see below).
|
|
73
|
+
- **Priors and inference:** constrained Brownian-bridge EOS draws, PCA sequence
|
|
74
|
+
compression and Gaussian coefficient-prior tools; fixed-mass and maximum-mass
|
|
75
|
+
sensitivities, Fisher forecasts, density-tagged laboratory likelihoods and
|
|
76
|
+
published merger-ejecta fitting families with uncertainty estimates.
|
|
77
|
+
- **RIFT workflows:** `EOSConcreteNMB`, native tabular and PCA sequences, and legacy
|
|
78
|
+
Landry-format export. A recorded RIFT CIP smoke test establishes plumbing,
|
|
79
|
+
**not** science-grade per-EOS evidence: its 12-EOS input was remapped against an
|
|
80
|
+
interpolant indexed for 10,000 EOS. See [RIFT integration](docs/rift.rst).
|
|
81
|
+
- **Rotation and cooling interfaces:** pinned external RNS equilibrium runner and
|
|
82
|
+
tabulated-EOS adapter, external NSCool driver, and separate JAX thermal transport
|
|
83
|
+
on frozen backgrounds. RNS/NSCool are not bundled; these paths do not establish
|
|
84
|
+
a fully coupled rotating-star cooling model. See [rotation](docs/rotating.md)
|
|
85
|
+
and [thermal limits](docs/cooling/core_transport_validation.md).
|
|
86
|
+
|
|
87
|
+
**Integration boundaries:** gwkokab is a planned adapter, despite an optional
|
|
88
|
+
package dependency. MUSES supplies out-of-band EOS tables/reference targets;
|
|
89
|
+
it is not an integrated inference dependency.
|
|
90
|
+
|
|
91
|
+
## Install and quickstart
|
|
92
|
+
|
|
93
|
+
Use a project-local environment (Python ≥3.9; core dependencies include NumPy,
|
|
94
|
+
SciPy, JAX, diffrax and PyYAML):
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
python -m venv .venv
|
|
98
|
+
source .venv/bin/activate
|
|
99
|
+
python -m pip install -e .
|
|
100
|
+
python examples/quickstart.py
|
|
101
|
+
# Optional test dependencies and suite:
|
|
102
|
+
python -m pip install -e '.[test]'
|
|
103
|
+
python -m pytest
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
For the heavier validation environment and optional references, see
|
|
107
|
+
[installation](docs/installation.rst) and [environment notes](docs/environment.md).
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from nmbackend.eos import MetaModelEOS
|
|
111
|
+
from nmbackend.tov import build_family, m_max, radius_of_mass, lambda_of_mass
|
|
112
|
+
from nmbackend.adapters import EOSConcreteNMB
|
|
113
|
+
|
|
114
|
+
model = MetaModelEOS()
|
|
115
|
+
params = dict(K_sat=230., E_sym=32., L_sym=60., cs2_tail=0.4)
|
|
116
|
+
family = build_family(model.eos_table(params))
|
|
117
|
+
print(m_max(family), radius_of_mass(family, 1.4), lambda_of_mass(family, 1.4))
|
|
118
|
+
eos = EOSConcreteNMB(model, params) # RIFT-compatible single-EOS interface
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Differentiation and branch limits
|
|
122
|
+
|
|
123
|
+
Use forward mode (`jax.jacfwd`, `jax.jvp`) for supported EOS/TOV sensitivities.
|
|
124
|
+
Reverse mode is supported for structure-only solves (`tidal=False`); reverse mode
|
|
125
|
+
through the tidal variable is not recommended. First derivatives in central
|
|
126
|
+
enthalpy are supported, but second derivatives in central enthalpy or EOS
|
|
127
|
+
parameters are not. Accuracy depends on tolerance, EOS representation and
|
|
128
|
+
transitions; the [physics guide](docs/physics.rst) records the current node/jump
|
|
129
|
+
handling and derivative caveats. Fixed-mass sensitivities use the implicit-function
|
|
130
|
+
theorem rather than coarse family interpolation; see [inference](docs/inference.rst).
|
|
131
|
+
|
|
132
|
+
`build_family`/single-EOS adapters do not yet provide complete disconnected
|
|
133
|
+
(twin-star) branch handling. RIFT sequence scalar accessors and legacy export
|
|
134
|
+
retain the primary stable rising branch; sequence branch counts let callers detect
|
|
135
|
+
and reject or route multi-branch EOS. They do not marginalize over all branches.
|
|
136
|
+
|
|
137
|
+
## Validation evidence and remaining work
|
|
138
|
+
|
|
139
|
+
The repository records internal comparisons against an independently implemented
|
|
140
|
+
radius-domain SciPy solver, including <0.1% M/R/Λ agreement for the documented
|
|
141
|
+
smooth/hybrid cases. Hybrid references sharing the same junction formula check
|
|
142
|
+
integration consistency; the smeared-transition limit separately checks the sign.
|
|
143
|
+
October 2026 interpolation/tidal fixes and their table-specific results are
|
|
144
|
+
recorded in the [physics guide](docs/physics.rst).
|
|
145
|
+
|
|
146
|
+
The initial **~200 m RePrimAnd radius mismatch is historical**: the later
|
|
147
|
+
[surface/interpolation report](docs/devlog/2026-06-02f-consistent-interpolation.md)
|
|
148
|
+
records **~3–10 m in R and <0.1% in Λ against RePrimAnd 1.7** for the compared cases.
|
|
149
|
+
That dated result is separate from the internal SciPy comparison and is not a
|
|
150
|
+
comprehensive accuracy certification of today's entire model/parameter space.
|
|
151
|
+
External-reference coverage, convergence, crust systematics and disconnected
|
|
152
|
+
branches remain work items. See the [evidence and limits](docs/validation.rst),
|
|
153
|
+
[validation plan](docs/validation-plan.md), and [roadmap](docs/roadmap.md).
|
|
154
|
+
|
|
155
|
+
## Scientific credit and license
|
|
156
|
+
|
|
157
|
+
MIT-licensed, by R. O'Shaughnessy and the RIT CCRG nuclear-matter group.
|
|
158
|
+
[ATTRIBUTION.md](ATTRIBUTION.md) distinguishes independently implemented methods,
|
|
159
|
+
reused data and optional external software; external licenses remain separate.
|
|
160
|
+
Data products we generate and archive (for example on Zenodo) are released
|
|
161
|
+
under CC-BY-4.0. Third-party data shipped here keep their own licenses, listed
|
|
162
|
+
in ATTRIBUTION.md.
|
|
163
|
+
Foundations include Margueron, Hoffmann Casali & Gulminelli's metamodel
|
|
164
|
+
([I](https://arxiv.org/abs/1708.06894), [II](https://arxiv.org/abs/1708.06895)),
|
|
165
|
+
[Hinderer's tidal calculation](https://arxiv.org/abs/0711.2420),
|
|
166
|
+
[Damour & Nagar](https://arxiv.org/abs/0906.0096), and laboratory constraints from
|
|
167
|
+
[Huth et al.](https://arxiv.org/abs/2107.06229) and
|
|
168
|
+
[Tsang et al.](https://arxiv.org/abs/2310.11588).
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
nmbackend/__init__.py,sha256=je9xIzNfRezf-nklvhzLxqFNmVioovdR7Xlbz72zktU,784
|
|
2
|
+
nmbackend/constants.py,sha256=5Fl-vfB6dwD36bcoL8qb94rdLxNDxMZTGZ4J6RYZcxc,2701
|
|
3
|
+
nmbackend/durca.py,sha256=MR77181iWr2cBKQWyzFw7IhamnC05r4VGCB_TPZFWFU,4618
|
|
4
|
+
nmbackend/ejecta.py,sha256=hKDAFUVm4C4sVNs4w5_LmrYhR_YtHWTr75ab1X_3TOQ,28266
|
|
5
|
+
nmbackend/ipad.py,sha256=eix7p4GaoYPgvL5K4LLzdNXcyW5ik_oeuh2qMS7gnrI,4003
|
|
6
|
+
nmbackend/lab_likelihood.py,sha256=BQ275-9GpywU7ZjWQj3H0d4x1w3n0F2lfu2svWP7cUE,28520
|
|
7
|
+
nmbackend/nscool_io.py,sha256=oXkJvHKBRD5pyIlYTvIRqErFzKWycjYGa5OkPTtXsa0,5637
|
|
8
|
+
nmbackend/postmerger.py,sha256=6K_S_x4khJ_-jd_VJKJzCSS3bJ-xO_NOHMelxpB-Wv4,11372
|
|
9
|
+
nmbackend/adapters/__init__.py,sha256=3vVosOWnOKO0SSXQzeixB1Ptauzh3MrPsXRKpRs8P34,142
|
|
10
|
+
nmbackend/adapters/rift.py,sha256=fZgqJrNL3uO3IC5mcGftDribbYkfcFPGIcI_v4KFk-o,3861
|
|
11
|
+
nmbackend/cooling/README.md,sha256=nQlFmJGbACRJTn_fahH-AYOd0AZ9ie5U94P05TSzYvA,8220
|
|
12
|
+
nmbackend/cooling/__init__.py,sha256=9Fv2MT9uNBP_NaP6d6Cm7FQm8YKxM-3CznnETweTmU0,684
|
|
13
|
+
nmbackend/cooling/build_nscool.sh,sha256=YyvRtYwhCPBoekxdqru_z7mWlKGeVyXvA1NeYkLNv-I,2275
|
|
14
|
+
nmbackend/cooling/isothermal.py,sha256=OpURH7iwEDtvR_HdygbgRrARVXpxovXZMrf_sGcunCM,3209
|
|
15
|
+
nmbackend/cooling/nscool_nmbackend.patch,sha256=nV5uwW5u-7RWyDviAGKA49A8v3LBmM73Ckqqy223Grk,11381
|
|
16
|
+
nmbackend/cooling/runner.py,sha256=jW16-grurige1yFu4GLyFkA4IbsSuI5UAhv2bseapOk,25923
|
|
17
|
+
nmbackend/cooling/validate.py,sha256=3PaGZKNN8CfAH095NGUs3ZilkFTu5nP03RsilQkwq1c,4907
|
|
18
|
+
nmbackend/cooling/physics/__init__.py,sha256=YtI5bKIjp75D9tc5RMmoo74HiFgcyVK7F1F_HI4Mww0,838
|
|
19
|
+
nmbackend/cooling/physics/_spline.py,sha256=QOaUUZi8e8Hl7nn_MtdD0tHYrXp81ulLkQiHwB51sA0,2680
|
|
20
|
+
nmbackend/cooling/physics/blanket.py,sha256=7Bc79iK2IP0V4bEGA80ayeaMXPwkFp4HJ4OvgUpoC1g,3102
|
|
21
|
+
nmbackend/cooling/physics/conduct.py,sha256=ujuonl8zHon-3Shl06_B2GRz3Gq_HMHMGEJSK7FzCZ0,9009
|
|
22
|
+
nmbackend/cooling/physics/core_conduct.py,sha256=C-ffZSm1DtSFzlpi6QGYU_m4Cxp6yexMhAHtdBNjCE0,3024
|
|
23
|
+
nmbackend/cooling/physics/core_nu.py,sha256=nGgF9Yh9WUCb7TIy2SkHQLLSh7WYUl4lYv9U_xcRFjE,11002
|
|
24
|
+
nmbackend/cooling/physics/crust.py,sha256=MfXQ_o5cq0kHib3aY3fHNTi9o6sjTM2vU8RBBuVcjs4,5288
|
|
25
|
+
nmbackend/cooling/physics/crust_nu.py,sha256=GSlyzv7FSrBUDkpP0LnOycJVbw0lN-Cnv039jBR8sNo,3629
|
|
26
|
+
nmbackend/cooling/physics/curve.py,sha256=ApLQTjz-7nPDqMBf3afnp-1rEvr23cRYLqb4SbDdeWU,1612
|
|
27
|
+
nmbackend/cooling/physics/envelope.py,sha256=yVEOcu5bt7Y6ZjqYexP8AFUDK8FNK6_KiOT4_TIsW90,1377
|
|
28
|
+
nmbackend/cooling/physics/gaps.py,sha256=O52VkqjGlmA1zaO_Y8Da2S5pMHp44ZT9M5cDTRm8cIY,6730
|
|
29
|
+
nmbackend/cooling/physics/geometry.py,sha256=oORNi6TW7JcHyFSR4axs6nINh7bbHvIAhomWDdSz2QI,6305
|
|
30
|
+
nmbackend/cooling/physics/heat.py,sha256=CviFLldX7tpXvGKTjCRCRyEFwbkPQJzeGgHeF_dPOw4,4750
|
|
31
|
+
nmbackend/cooling/physics/native.py,sha256=0jqS4w52t8EPDc_7E-dmnpPYsPYA6ut3QG9XHP_8nkU,6162
|
|
32
|
+
nmbackend/cooling/physics/reference.py,sha256=FlWojy9i70v9n_Jqvpq7WWsLrZcK2TrzltwS6V-wj9s,2253
|
|
33
|
+
nmbackend/cooling/physics/star.py,sha256=9pjaf9R7-pG86t1nvAtYVsW4IrUXYl_DoQ_YyxKV1XI,9041
|
|
34
|
+
nmbackend/cooling/physics/superfluid.py,sha256=we7NKXXnO1WTjfhwo78YWzKVUsPesKSFJ88hn_Syz3A,1310
|
|
35
|
+
nmbackend/cooling/physics/whole.py,sha256=tEfevJJHJffuaXz8GJwCqZBJbotRI6paV3WKPKU3hEI,6835
|
|
36
|
+
nmbackend/data/crust_sly_dh2001.dat,sha256=OJv7kZ9SvkXS5p5Qxw7BrUEUoDfZVodXfAaVmwzZsu4,2836
|
|
37
|
+
nmbackend/data/frib_scenario_ladder.yaml,sha256=YpbTuxgDdbm6W8zVw8bFKn2KWeYHCItQaQfSY_bAd-o,4598
|
|
38
|
+
nmbackend/eos/__init__.py,sha256=Oh6qNMBV6QBgI5ZiQOhJ09bxcQu-9OG6wRq1R0fPbfU,869
|
|
39
|
+
nmbackend/eos/base.py,sha256=Bl07WiaQTunGogcuqqWU26zOBnGJ_kdjDTAHEznPRtc,24529
|
|
40
|
+
nmbackend/eos/compose.py,sha256=5R_1jdEbA99YSyEJuutqz8GGSjlZSOXWa0wrL2MiW1w,12242
|
|
41
|
+
nmbackend/eos/coolcomp.py,sha256=eUWFt41glVtkHE7tE5HHgMMPq47RODjNJAde6-kZCik,2666
|
|
42
|
+
nmbackend/eos/crust.py,sha256=HNl1PQ3s3PCVUUq3EsAYmPy2eLDVX7ya6Or45en11-E,15366
|
|
43
|
+
nmbackend/eos/ddrmf.py,sha256=skczxrRU300gQ0vETmc-j0K-uE2cnanz0KIkFqffl68,15033
|
|
44
|
+
nmbackend/eos/hybrid.py,sha256=wl1D1zlw9InZ9ejD04crbfAXPQBD2WHL-vVhZos0KH0,7893
|
|
45
|
+
nmbackend/eos/leptons.py,sha256=qvqivaavVf0JTdVNLEzBuLFMykVnasS3MKfX95oJYLs,2816
|
|
46
|
+
nmbackend/eos/metamodel.py,sha256=Z3eF9mNlbFhjYSwlu5Ly6aicCbwdnWcA1i4O0yLwxe8,13152
|
|
47
|
+
nmbackend/eos/polytrope.py,sha256=BLRZ2_J336OmldrvUq_NrdtQXFkMb-k4IBTR-1XqIiw,1038
|
|
48
|
+
nmbackend/eos/rmft.py,sha256=SnF-_JrnmJWHbiUpwtLwMlzVrfs2JRvzxg6h6sDMN3w,19743
|
|
49
|
+
nmbackend/eos/skyrme.py,sha256=OZX96wGqungto2YAs3_L1ACzO-_UQlXlMw-VeQ4ljiU,14064
|
|
50
|
+
nmbackend/inference/__init__.py,sha256=c31IBu2RsZ39MPXZp8QQrB_6K1VudDbNMWLADRMa3AA,703
|
|
51
|
+
nmbackend/inference/fisher.py,sha256=GrU_0DVbUwGruObN6Dr9CJrW-ljlOBv2IGDJXEEd0iU,7818
|
|
52
|
+
nmbackend/inference/synthetic.py,sha256=z_rz6bU80Lzb76okSLILN2oVq8_AtisVoVuEAIZf1e8,3596
|
|
53
|
+
nmbackend/priors/__init__.py,sha256=C67O3MCyr0cphW6fqRwAUcNB4Qz5LgSozZZd4aSkmzA,865
|
|
54
|
+
nmbackend/priors/bridge.py,sha256=fo3JfFrySTRtgRKeb3iNv5uQRAH3D7ETJbpGbV_fDWE,18828
|
|
55
|
+
nmbackend/priors/bridge_jax.py,sha256=J4ULv1UKWelXh_NNi-cfk33Vc84Q_g8_nHbIbQJJSdA,19763
|
|
56
|
+
nmbackend/priors/gp_pca.py,sha256=SPGsiRA9FmTNrhQpMJIHPXovwATnpCwmhbbh8d4L7Js,15440
|
|
57
|
+
nmbackend/reference/__init__.py,sha256=nYzPVIRuveS8GedsRbkAsTQt0-vUmu9IYHCnmbHaDlY,516
|
|
58
|
+
nmbackend/reference/reprimand.py,sha256=YTK63nne-2Idxz2ylZIj28SKT54Sski65AJbImcqpuk,4704
|
|
59
|
+
nmbackend/reference/scipy_tov.py,sha256=7-SXwQnlHt1huGm7v6pQ_Hky8_vh7Tz5B7Hq-DBNRDQ,11908
|
|
60
|
+
nmbackend/rift/__init__.py,sha256=gq10J1UeNV1x62DFo45q8nPmBcvskosfN6aXvOeVZck,1513
|
|
61
|
+
nmbackend/rift/compressed.py,sha256=9oV84fNxrgvpSPIuBrDfMytwqbxjbIWmPj8OE2nJYds,8582
|
|
62
|
+
nmbackend/rift/evidence.py,sha256=7c5BcyOAZsqnS9js5xgDAL4c4CI2eEIpez1ug3sbDPw,12766
|
|
63
|
+
nmbackend/rift/sequence.py,sha256=5Aem_NTOEWezgSGZiY2_tdclM6nvrXwG7_7L78Y48lI,19653
|
|
64
|
+
nmbackend/rotating/__init__.py,sha256=FDJk6-9LneQQHHV5DJ1TqdAy3U82YhrxvXDs6Wdt8SU,313
|
|
65
|
+
nmbackend/rotating/rns.py,sha256=W9k8seJUa2Wdx0MBJ_N4U415xq8CkgX3h-u2seesJeA,9404
|
|
66
|
+
nmbackend/rotating/tabulated.py,sha256=5uT_slXO7GDqSroaaex_Jo_M2CYUbtsMPUpfUMIe_vM,12881
|
|
67
|
+
nmbackend/thermal/__init__.py,sha256=GT5aH-aQHycXcv_Aeno2JMjEAXnCrb5KpzC980hqcYY,79
|
|
68
|
+
nmbackend/thermal/diffusion.py,sha256=LUq5qI-KZVU75cQ8mu-BfNaW0m3rb_yba-Oym12jNPg,3688
|
|
69
|
+
nmbackend/tov/__init__.py,sha256=PkQZXq0HbBlsxuBL-l8OKqAsRyojJeJ_x7eIOUNrAfU,592
|
|
70
|
+
nmbackend/tov/central.py,sha256=5LKq-pVpQbpUmgLkn2-aKr6gYMkGtH-hj4MR09E7vhM,2687
|
|
71
|
+
nmbackend/tov/family.py,sha256=UxoFC5gvmUthKUqPdJW9bfSnrhpJEy99ku-N_Cjaq0Q,6262
|
|
72
|
+
nmbackend/tov/phase_transition.py,sha256=UnjoC49x5T4XiupRw5Xxbtn0BQD7phlKNqx8awC0ts4,4247
|
|
73
|
+
nmbackend/tov/solver.py,sha256=fdMOqQMCTHn91C2xkAahTfxfO28Jy-cF4d_lpKsapas,23877
|
|
74
|
+
nmbackend/validation/__init__.py,sha256=kIE-ACkPdnRhVaI8DY7O4fY77CLPySw7UplUIq_eXBw,277
|
|
75
|
+
nmbackend/validation/model_diagnostic.py,sha256=41-wgyJwikb6fVJVmSaMLUnqne8M4kJkX_Nh5XvapHk,3004
|
|
76
|
+
nmbackend/validation/reference_matrix.py,sha256=MUgVUxJb1N7A89e74iT_Xgin3bYELiG87v9-sy7m2P4,8511
|
|
77
|
+
nmbackend-0.4.0.dist-info/licenses/LICENSE,sha256=SVFG8ABKOTIN--08k5U0YD3zfpnZ7PhMvqM2OZ69Gdc,1111
|
|
78
|
+
nmbackend-0.4.0.dist-info/METADATA,sha256=tPyTnniD9GRiWKJGl2STQDmg2nsJWfxkb1_I4Xx-_FY,8777
|
|
79
|
+
nmbackend-0.4.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
80
|
+
nmbackend-0.4.0.dist-info/top_level.txt,sha256=tLWQPoG-w99sQPmR1R_KqhX4zZ8gu5hWnCzw3NWYiw4,10
|
|
81
|
+
nmbackend-0.4.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 R. O'Shaughnessy and the RIT CCRG nuclear-matter group
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nmbackend
|