nrhjsurrogate 1.0.0__tar.gz

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.
Files changed (128) hide show
  1. nrhjsurrogate-1.0.0/ACCURACY.md +81 -0
  2. nrhjsurrogate-1.0.0/CITATION.cff +78 -0
  3. nrhjsurrogate-1.0.0/INSTALL.md +747 -0
  4. nrhjsurrogate-1.0.0/LICENSE +21 -0
  5. nrhjsurrogate-1.0.0/MANIFEST.in +131 -0
  6. nrhjsurrogate-1.0.0/PKG-INFO +182 -0
  7. nrhjsurrogate-1.0.0/README.md +136 -0
  8. nrhjsurrogate-1.0.0/cpp/CMakeLists.txt +402 -0
  9. nrhjsurrogate-1.0.0/cpp/anchor.cpp +203 -0
  10. nrhjsurrogate-1.0.0/cpp/cmake/compiler_flags.cmake +124 -0
  11. nrhjsurrogate-1.0.0/cpp/cmake/kokkos_dependency.cmake +114 -0
  12. nrhjsurrogate-1.0.0/cpp/evaluator.cpp +2087 -0
  13. nrhjsurrogate-1.0.0/cpp/fastpath/CMakeLists.txt +23 -0
  14. nrhjsurrogate-1.0.0/cpp/fastpath/fastpath.cpp +155 -0
  15. nrhjsurrogate-1.0.0/cpp/generated/pn_dynamics_4pn.hpp +163 -0
  16. nrhjsurrogate-1.0.0/cpp/generated/pn_mode_partials_4pn.hpp +1080 -0
  17. nrhjsurrogate-1.0.0/cpp/generated/pn_modes_4pn.hpp +552 -0
  18. nrhjsurrogate-1.0.0/cpp/glibc_cuda_shim/math.h +38 -0
  19. nrhjsurrogate-1.0.0/cpp/glue.cpp +827 -0
  20. nrhjsurrogate-1.0.0/cpp/gpr.cpp +1017 -0
  21. nrhjsurrogate-1.0.0/cpp/mr.cpp +1672 -0
  22. nrhjsurrogate-1.0.0/cpp/pack.cpp +2666 -0
  23. nrhjsurrogate-1.0.0/cpp/piecewise_chebyshev.hpp +108 -0
  24. nrhjsurrogate-1.0.0/cpp/policy_chunk.hpp +77 -0
  25. nrhjsurrogate-1.0.0/cpp/residency.cpp +212 -0
  26. nrhjsurrogate-1.0.0/cpp/swsh.cpp +321 -0
  27. nrhjsurrogate-1.0.0/cpp/workspace.hpp +400 -0
  28. nrhjsurrogate-1.0.0/docs/QUICKSTART.md +120 -0
  29. nrhjsurrogate-1.0.0/docs/RELEASE_NOTES.md +120 -0
  30. nrhjsurrogate-1.0.0/docs/USAGE.md +949 -0
  31. nrhjsurrogate-1.0.0/environment.yml +51 -0
  32. nrhjsurrogate-1.0.0/examples/usage/00_walkthrough.ipynb +1411 -0
  33. nrhjsurrogate-1.0.0/examples/usage/01_load_and_modes.py +73 -0
  34. nrhjsurrogate-1.0.0/examples/usage/02_physical_units.py +61 -0
  35. nrhjsurrogate-1.0.0/examples/usage/03_hybridisation.py +82 -0
  36. nrhjsurrogate-1.0.0/examples/usage/04_derived_routes.py +65 -0
  37. nrhjsurrogate-1.0.0/examples/usage/05_parameter_derivatives.py +101 -0
  38. nrhjsurrogate-1.0.0/examples/usage/06_ada_model.py +70 -0
  39. nrhjsurrogate-1.0.0/examples/usage/07_fisher_matrix.py +61 -0
  40. nrhjsurrogate-1.0.0/examples/usage/08_model_error.py +148 -0
  41. nrhjsurrogate-1.0.0/examples/usage/09_backends.py +68 -0
  42. nrhjsurrogate-1.0.0/examples/usage/10_finding_the_artifacts.py +46 -0
  43. nrhjsurrogate-1.0.0/examples/usage/README.md +38 -0
  44. nrhjsurrogate-1.0.0/nrhjsurrogate/__init__.py +316 -0
  45. nrhjsurrogate-1.0.0/nrhjsurrogate/_environment.py +59 -0
  46. nrhjsurrogate-1.0.0/nrhjsurrogate/calibration_provenance.py +117 -0
  47. nrhjsurrogate-1.0.0/nrhjsurrogate/compiled_backend.py +103 -0
  48. nrhjsurrogate-1.0.0/nrhjsurrogate/compute_kernels/CMakeLists.txt +21 -0
  49. nrhjsurrogate-1.0.0/nrhjsurrogate/compute_kernels/antenna_project.cpp +143 -0
  50. nrhjsurrogate-1.0.0/nrhjsurrogate/data/__init__.py +6 -0
  51. nrhjsurrogate-1.0.0/nrhjsurrogate/data/swsph_mixing_tables.npz +0 -0
  52. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/__init__.py +1 -0
  53. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/aa_api.py +3089 -0
  54. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/aa_batch.py +1470 -0
  55. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/aa_batch_gradients.py +460 -0
  56. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/aa_gradients.py +1277 -0
  57. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/aaintpn.py +476 -0
  58. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/api.py +751 -0
  59. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/bilby_batch.py +224 -0
  60. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/fisher.py +966 -0
  61. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/hybrid_gradient_batch.py +1063 -0
  62. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/hybrid_gradients.py +1300 -0
  63. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/hybridization_states.py +153 -0
  64. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/loader_arguments.py +72 -0
  65. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/nrpn.py +153 -0
  66. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/pn4_dmode_route.py +115 -0
  67. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/pn4_weights_route.py +98 -0
  68. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/reconstruct.py +659 -0
  69. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/smoke.py +404 -0
  70. nrhjsurrogate-1.0.0/nrhjsurrogate/driver/time_domain_response.py +264 -0
  71. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/__init__.py +1 -0
  72. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/_affinity.py +157 -0
  73. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/aa_gradient_device.py +488 -0
  74. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/antenna_kernels.py +133 -0
  75. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/batched_evaluator.py +1901 -0
  76. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/batched_spline.py +363 -0
  77. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/compiled_module_loader.py +2012 -0
  78. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/dispatch.py +170 -0
  79. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/fastpath.py +207 -0
  80. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/mr_gradient_device.py +543 -0
  81. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/residency.py +222 -0
  82. nrhjsurrogate-1.0.0/nrhjsurrogate/execution/swsh_device.py +142 -0
  83. nrhjsurrogate-1.0.0/nrhjsurrogate/gpr_kernel_basis.py +508 -0
  84. nrhjsurrogate-1.0.0/nrhjsurrogate/gradients.py +388 -0
  85. nrhjsurrogate-1.0.0/nrhjsurrogate/legacy_pickle_compat.py +277 -0
  86. nrhjsurrogate-1.0.0/nrhjsurrogate/models.py +750 -0
  87. nrhjsurrogate-1.0.0/nrhjsurrogate/numerical_methods/__init__.py +24 -0
  88. nrhjsurrogate-1.0.0/nrhjsurrogate/numerical_methods/grids.py +70 -0
  89. nrhjsurrogate-1.0.0/nrhjsurrogate/numerical_methods/quadrature.py +61 -0
  90. nrhjsurrogate-1.0.0/nrhjsurrogate/odd_mode_envelope.py +221 -0
  91. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/__init__.py +11 -0
  92. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/action_extend.py +1636 -0
  93. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/anchor.py +497 -0
  94. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/constants.py +65 -0
  95. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/gw_memory.py +249 -0
  96. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/hybridise.py +168 -0
  97. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/pn_action_energy.py +364 -0
  98. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/pn_actions.py +239 -0
  99. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/pn_circular.py +302 -0
  100. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/pn_dynamics_partials.py +481 -0
  101. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/pn_extend.py +418 -0
  102. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/pn_flux.py +194 -0
  103. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/pn_mode_partials.py +480 -0
  104. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/pn_mode_partials_35.py +1453 -0
  105. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/pn_modes.py +631 -0
  106. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/pn_modes_35.py +1318 -0
  107. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/reach.py +273 -0
  108. nrhjsurrogate-1.0.0/nrhjsurrogate/physics/spin_weighted_angular_harmonics.py +921 -0
  109. nrhjsurrogate-1.0.0/nrhjsurrogate/serialize.py +1753 -0
  110. nrhjsurrogate-1.0.0/nrhjsurrogate/spectral.py +587 -0
  111. nrhjsurrogate-1.0.0/nrhjsurrogate/surrogate_prediction.py +407 -0
  112. nrhjsurrogate-1.0.0/nrhjsurrogate/verify/__init__.py +141 -0
  113. nrhjsurrogate-1.0.0/nrhjsurrogate/verify/__main__.py +8 -0
  114. nrhjsurrogate-1.0.0/nrhjsurrogate/verify/checks.py +917 -0
  115. nrhjsurrogate-1.0.0/nrhjsurrogate/verify/reference_values.npz +0 -0
  116. nrhjsurrogate-1.0.0/nrhjsurrogate/verify/test_installed_model.py +100 -0
  117. nrhjsurrogate-1.0.0/nrhjsurrogate/waveform_error_estimate.py +352 -0
  118. nrhjsurrogate-1.0.0/nrhjsurrogate.egg-info/PKG-INFO +182 -0
  119. nrhjsurrogate-1.0.0/nrhjsurrogate.egg-info/SOURCES.txt +127 -0
  120. nrhjsurrogate-1.0.0/nrhjsurrogate.egg-info/dependency_links.txt +1 -0
  121. nrhjsurrogate-1.0.0/nrhjsurrogate.egg-info/entry_points.txt +4 -0
  122. nrhjsurrogate-1.0.0/nrhjsurrogate.egg-info/requires.txt +26 -0
  123. nrhjsurrogate-1.0.0/nrhjsurrogate.egg-info/top_level.txt +2 -0
  124. nrhjsurrogate-1.0.0/pyproject.toml +217 -0
  125. nrhjsurrogate-1.0.0/requirements.txt +46 -0
  126. nrhjsurrogate-1.0.0/setup.cfg +4 -0
  127. nrhjsurrogate-1.0.0/setup.py +419 -0
  128. nrhjsurrogate-1.0.0/setup_env.yml +31 -0
@@ -0,0 +1,81 @@
1
+ # Evaluation-accuracy contract (AA model family, batched paths)
2
+
3
+ This file states the accuracy contract of the AA evaluation stack in
4
+ checkable terms. Enforcement lives in the test suite; every number
5
+ below is either asserted by a named test or recorded with the commit
6
+ that measured it. **No build flag may relax FP semantics anywhere in
7
+ this stack: no fast-math, and no compiler-discretionary FP contraction
8
+ in the canonical files (`cpp/anchor.cpp` pins `FP_CONTRACT OFF` and,
9
+ on non-nvcc hosts, `-ffp-contract=off`).**
10
+
11
+ ## 1. Anchor contractions (tau, J): correctly-rounded-sum semantics
12
+
13
+ The tau/J GPR contractions are conditioning-limited
14
+ (`sum_i |krow_i alpha_i| / |result|` ~ 1.7e5 for tau, ~1.1e7 for J on
15
+ the deployed v2 artifact), so a BLAS dot's value is an accident of its
16
+ summation order at the ~1e-8 (tau) / ~1e-9 (J) absolute level, and
17
+ anchor errors are adiabatically amplified (~dPhi/dln x ~ 2e3) into
18
+ strain phase.
19
+
20
+ Contract: the anchors are computed by ONE canonical reduction —
21
+ Ogita–Rump–Oishi Dot2 (error-free two_prod, Knuth branchless two_sum)
22
+ in a FIXED sequential order — implemented twice and required to agree
23
+ **byte for byte**: numpy-EFT (Dekker two_prod,
24
+ `nrhjsurrogate/physics/anchor.py`) and compiled (explicit `fma`,
25
+ `cpp/anchor.cpp`, host and device execution spaces). For this
26
+ conditioning Dot2 is faithfully rounded (within 1 ulp of the exact dot
27
+ product), i.e. correctly-rounded-sum semantics: order-independent by
28
+ construction, and the fixed order pins the final ulp too.
29
+
30
+ - Enforcement: `tests/test_anchor_canonical.py`
31
+ - layer (a): all available paths bitwise identical;
32
+ - layer (b): golden values (`paper_data/anchor_golden.npz`) bitwise
33
+ from stored inputs; budgeted when kernel rows are recomputed
34
+ through the local libm (budget DERIVED in-test:
35
+ `4u · Σ_i |krow_i||alpha_im|`);
36
+ - layer (c): conditioning sentinel — the naive contraction's
37
+ ordering spread × 2e3 must stay below the cross-machine class with
38
+ ≥ 2x margin (a worse-conditioned retrain fails here first);
39
+ - layer (d): FMA/vectorization canary — deliberately variant
40
+ summations may drift, the canonical paths may not.
41
+
42
+ One-time evaluation-version shift (2026-08-02, adopting canonical over
43
+ BLAS-order values): tau max 2.3e-8 abs (3.8e-12 rel), J 4.4e-10 abs;
44
+ end-to-end native-span strain moved ≤ 1.4e-10 of peak. The canonical
45
+ values are the defensible ones — the correctly-rounded contraction of
46
+ the trained coefficients, not an artifact of BLAS blocking.
47
+
48
+ ## 2. Cross-machine reproducibility limit
49
+
50
+ Same machine (or stored kernel rows): bitwise. Across machines the
51
+ limit is libm — glibc `exp` is faithfully, not correctly, rounded, so
52
+ recomputed kernel rows differ by a few ulp. Propagated through the
53
+ conditioning and the 2e3 amplification this bounds cross-machine
54
+ DEEP-EXTENSION strain agreement at ~1e-5 relative (J-dominated; tau's
55
+ own term is ~1.6e-7). Native-span waveforms are far less sensitive.
56
+ This limit is a property of `exp` + the trained alpha, not of the
57
+ reduction; going below it requires a correctly-rounded exp
58
+ (crlibm-class), which is out of scope.
59
+
60
+ ## 3. End-to-end strain parity classes (measured, deployed v2 artifact)
61
+
62
+ | Comparison | Class | Gate |
63
+ |---|---|---|
64
+ | batched row vs batch-of-one, same times | ~8e-13 rel | `test_aa_batch.py::test_batch_rows_equal_serial` (1e-11) |
65
+ | fused compiled assembly vs numpy reference | 5.8e-16 of peak | `test_fused_assembly_matches_reference` (1e-13) |
66
+ | kokkos vs numpy backend, native span | ~1e-9..2e-6 of peak (tau-inversion + resampling) | `test_vs_numpy_reference` (2e-5) |
67
+ | batched bilby likelihood vs stock serial | 1.5e-14 rel logL | `test_bilby_batch.py` (1e-10) |
68
+ | float32 opt-in vs float64 | ≤ ~1.9e-4 of peak (~1e-8 mismatch) | `test_float32_envelope` (5e-4) |
69
+ | hybrid (f_low) kokkos vs numpy | 1e-12 (Python pack) / 1e-9 (native pack) | `tests/test_kokkos_hybrid.py` |
70
+ | batched gradients vs scalar chain | bitwise | `test_grad_batch_rows_equal_scalar` |
71
+
72
+ Zeros outside a row's span on the shared batch grid are EXACT (the
73
+ grid-policy contract), asserted in both assembly paths.
74
+
75
+ ## 4. What is NOT allowed
76
+
77
+ - fast-math or reassociation flags anywhere in the build;
78
+ - FP contraction in `cpp/anchor.cpp` (pragma + flag + canary test);
79
+ - re-introducing order-accidental (BLAS) anchor values on any path —
80
+ `AAKokkosEvaluator._predict_exact` is retained ONLY as the legacy
81
+ A/B reference for the documented shift.
@@ -0,0 +1,78 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software or its released models, please cite them."
3
+ title: "NRHJsurrogate"
4
+ abstract: >-
5
+ Numerical-relativity waveform surrogate built on a Hamilton-Jacobi
6
+ (action-angle) representation of binary black hole dynamics, with
7
+ hp-adaptive spectral elements and a Kokkos evaluator. Ships two models:
8
+ NRHJSur3dq8_AA (action-angle) and NRHJSur3dq8_AdA (adiabatic-angle), both
9
+ aligned-spin, three-dimensional (q, chi1z, chi2z) with q <= 8, built on
10
+ the N2 NR extrapolation.
11
+ type: software
12
+ license: MIT
13
+
14
+ # ---------------------------------------------------------------------
15
+ # Nothing here was invented: no affiliation, DOI, date or journal reference
16
+ # has been guessed. Everything the owner supplied on 2026-09-02 is now in
17
+ # place: ORCID, affiliation, sole authorship, the release date, the Zenodo
18
+ # DOI for the model files, and the documentation URL.
19
+ #
20
+ # The ONLY remaining "<<<PLACEHOLDER...>>>" markers are inside the
21
+ # commented-out `preferred-citation` block at the foot of this file, which
22
+ # names the paper. They cannot be filled until the paper has a journal, a
23
+ # year and a DOI. Uncomment that block and fill it then, so that citing the
24
+ # software also points at the paper.
25
+ # ---------------------------------------------------------------------
26
+
27
+ authors:
28
+ # Sole attribution found in the tree (git history and pyproject.toml).
29
+ # ORCID and affiliation supplied by the owner 2026-09-02 and recorded here;
30
+ # they are the source for the Zenodo deposit metadata, which is generated
31
+ # from these values rather than typed a second time.
32
+ - family-names: "Prasad"
33
+ given-names: "Vaishak"
34
+ orcid: "https://orcid.org/0000-0001-6712-2457"
35
+ affiliation: "Institute for Gravitation and the Cosmos, and Department of Astronomy and Astrophysics, The Pennsylvania State University"
36
+ # Sole author, confirmed by the owner 2026-09-02. There are no
37
+ # co-authors on this software record.
38
+
39
+ version: "1.0.0"
40
+ # MUST match pyproject.toml's version, which is 1.0.0. It read "1" before
41
+ # 2026-09-02, which is a different string and would have been published as a
42
+ # different version of the same software.
43
+ # Set by the owner 2026-09-02, the date the deposit goes out.
44
+ date-released: "2026-09-02"
45
+
46
+ # The software/model archive deposit. Does not exist yet; the same value
47
+ # belongs in nrhjsurrogate/models.py MODEL_DOI.
48
+ # The DEPOSIT is a dataset of model artifacts; this software record
49
+ # points at it rather than claiming it as the software's own doi.
50
+ repository-artifact: "https://doi.org/10.5281/zenodo.22262339"
51
+ # The documentation site, generated from the private source and served from
52
+ # the gh-pages branch. Confirmed live by the owner 2026-09-02.
53
+ url: "https://psu-edu.github.io/nrhjsurrogate/"
54
+
55
+
56
+ # There is deliberately no public source repository for this release, so
57
+ # no `repository-code` field is given.
58
+
59
+ keywords:
60
+ - gravitational waves
61
+ - numerical relativity
62
+ - surrogate model
63
+ - waveform model
64
+ - action-angle variables
65
+
66
+ # ---------------------------------------------------------------------
67
+ # The paper. Uncomment and complete once it exists -- do NOT cite a
68
+ # preprint number, journal, volume or year that has not been assigned.
69
+ # ---------------------------------------------------------------------
70
+ # preferred-citation:
71
+ # type: article
72
+ # title: "<<<PLACEHOLDER: paper title>>>"
73
+ # authors:
74
+ # - family-names: "Prasad"
75
+ # given-names: "Vaishak"
76
+ # journal: "<<<PLACEHOLDER>>>"
77
+ # year: <<<PLACEHOLDER>>>
78
+ # doi: "<<<PLACEHOLDER>>>"