Skip to main content

NRHJSur3dq8

A surrogate model for gravitational waves from non-eccentric, aligned-spin binary black hole mergers, trained on numerical relativity.

It is built on a Hamilton-Jacobi (action-angle) representation of the binary dynamics: the orbital phase rather than time is the independent coordinate, so simulations of different lengths simply occupy different phase ranges. The waveform is carried in hp-adaptive spectral elements and evaluated either in NumPy or through a compiled Kokkos kernel.

Documentation: https://psu-edu.github.io/nrhjsurrogate/

Range of validity. Non-eccentric orbits, mass ratio 1 to 8, aligned spin components within 0.8 in magnitude. Seven modes: (2,2), (2,1), (3,3), (3,2), (4,4), (4,3), (5,5).

Install

pip install nrhjsurrogate

Every dependency resolves from PyPI, and that line already gives you the compiled multi-threaded evaluator where a wheel is published:

interpreter platform what pip install nrhjsurrogate gives you
3.12, 3.13 Linux x86-64 (manylinux_2_28) a wheel: compiled Kokkos, OpenMP on
3.12, 3.13 macOS arm64 (Apple Silicon, 14+) a wheel: compiled Kokkos, OpenMP on, libomp bundled inside it
3.12, 3.13 Windows x64 a wheel: compiled Kokkos, OpenMP on
anything else (3.14, Intel Mac, Linux aarch64, …) the source distribution, compiled on your machine

Where no wheel matches, pip falls through to the source distribution and compiles it for you, fetching Kokkos if the system does not have it; that needs a C++17 compiler, and on macOS an OpenMP runtime (conda install -c conda-forge llvm-openmp, or brew install libomp). If the compile cannot run the install still succeeds, falls back to NumPy, and says so.

You do not need --no-binary to get the compiled backend. Three reasons to ask for a source build anyway: -march=native, worth 8-17% end to end and deliberately not used in the portable wheels; the CUDA backend; or an unshipped platform, which pip picks by itself. When you do compile, pin both switches so a missing OpenMP is a loud error rather than a quietly single-threaded build:

NRHJ_BUILD_KOKKOS=require NRHJ_BACKEND=openmp \
  pip install --no-binary nrhjsurrogate nrhjsurrogate
NRHJ_BACKEND=cuda NRHJ_CUDA_ARCH=sm_75 \
  pip install --no-binary nrhjsurrogate nrhjsurrogate

NRHJ_BUILD_KOKKOS decides whether to compile, NRHJ_BACKEND decides what: auto (default) takes OpenMP when the compiler has it, numpy skips the compile, serial forces single-threaded, openmp makes a missing OpenMP a build error instead of a silent Serial build, cuda adds the device backend and needs NRHJ_CUDA_ARCH. Neither has any effect on a wheel install, because nothing is compiled. After any install, python -m nrhjsurrogate.compiled_backend says what you actually got, the first import says it once by itself, and nrhjsur-bench --quick prints Kokkos OpenMP: ON or OFF in its header. See INSTALL.md sections 1b, 3 and 5 for the detail.

The model files are not in the package. They are distributed separately and located at run time, in order: an explicit path, then $NRHJ_MODEL_DIR, then the directories on $LAL_DATA_PATH, then a per-user cache. A miss raises FileNotFoundError naming the file, its SHA-256 and how to get it. Nothing degrades silently. If nothing on that list has a released model you named, the package downloads it into the per-user cache and checks its SHA-256 before using it; NRHJ_AUTO_FETCH=0 turns that off, and nrhjsurrogate.fetch_model does the same thing explicitly.

A first waveform

from nrhjsurrogate import NRHJSurAA

model = NRHJSurAA.load_h5("NRHJSur3dq8_AA_v3")

# geometric units: time in M, modes as r h_lm / M
times, modes = model.get_td_waveform_modes_geometric(4.0, 0.3, -0.2)

# physical units, LAL spelling: the two polarizations
h_plus, h_cross = model.get_td_waveform(
    mass1=40.0, mass2=10.0, spin1z=0.3, spin2z=-0.2,
    delta_t=1.0 / 4096.0, f_min=30.0, inclination=0.7, distance=400.0)

Then check the installation against shipped reference values:

nrhjsur-verify

Beyond waveforms the model serves analytic parameter derivatives, its own predictive uncertainty, post-Newtonian extension below the stored inspiral, the orbital dynamics and the remnant mass and spin. The runnable examples in examples/usage/ take one capability each, and 00_walkthrough.ipynb is a guided tour of the main ones.

The public import surface

Everything you are meant to use is importable straight from the package: from nrhjsurrogate import NRHJSurAA (and NRHJSurAdA, AABatch, AAHMCLikelihood, InnerProduct, fetch_model, and more; dir(nrhjsurrogate) lists them). The submodule layout underneath, driver/, physics/, execution/, numerical_methods/, is internal and may be rearranged in any release. Import from the top level and a reorganisation cannot reach you; import nrhjsurrogate.driver.something and it can.

Importing the package also sets OMP_PROC_BIND=close and OMP_PLACES=cores unless you have chosen otherwise; INSTALL.md gives the measured basis, the caveats and the off switch.

What is released

Two model flavours, both 3dq8, meaning aligned-spin (q, chi1z, chi2z) with q up to 8, matching the NRHybSur3dq8 convention. Both are built on the N2 numerical-relativity extrapolation, which the names do not encode and each file records as the root attribute extrapolation = "N2".

file what it is
NRHJSur3dq8_AA_v3 action-angle inspiral. The default.
NRHJSur3dq8_AdA_v3 adiabatic-angle inspiral, 14 elements
NRHJSur3dq8_MR_v3 the merger-ringdown arm both v3 inspirals name
NRHJSur3dq8_AA_v2 previous generation
NRHJSur3dq8_AdA_v2 previous generation
NRHJSur3dq8_MR_v2 previous generation

The inspiral files are de-embedded: each composes at load with the shared merger-ringdown arm it names, resolved by name and checked by content digest, so a crossed pair is refused rather than served. The version digit is the generation, not a patch level. Both generations are deposited; v3 is the default and v2 still loads by name.

The two flavours agree closely, and not by coincidence: the coordinates that give the adiabatic-angle model its structure were identified from the action-angle model's post-Newtonian normalizer.

How it works

  1. Slow variables. Each waveform is decomposed into a fast angle variable (the orbital phase) and slowly evolving action-like variables (a frequency parameter, co-orbital-frame amplitudes). The orbital phase, not time, is the independent coordinate.
  2. Frames and conventions. SXS extrapolated strain, centre-of-mass corrected, output in LAL conventions, round-trip validated against NRHybSur3dq8 through LALSimulation.
  3. Domain decomposition. Spectral elements both across the parameter space and along the phase coordinate, with a dedicated merger-ringdown element where adiabaticity breaks.
  4. Spectral representation. Chebyshev elements in phase, with regression onto spectral bases over the scattered simulation parameters. Accuracy is controlled by h- and p-refinement.
  5. Compiled evaluator. The evaluator is a Kokkos C++ kernel batched over parameter points and exposed through pybind11.
  6. Variable lengths. Handled natively by the phase coordinate and the element decomposition: elements exist only where data exists.

Scope of the distribution

The distribution ships evaluation code only: what turns a frozen model file into a waveform, and nothing that builds one. There is no public source repository. The code is distributed through PyPI and the model files through Zenodo, https://doi.org/10.5281/zenodo.22262339.

Licence

From version 1.1 this software is dual-licensed:

  • Noncommercial use — research, teaching, personal projects — is free and needs no permission, under the PolyForm Noncommercial License 1.0.0 with an additional term on machine-learning training. See LICENSE.
  • Commercial use requires a separate licence, available from the author on request. See NOTICE.

Using the source or documentation as training data for general-purpose code or language models is not permitted. Building an emulator or reduced-order model of the waveforms this software produces is ordinary research use and is fine — see NOTICE for the distinction.

Citation metadata is in CITATION.cff; please cite the paper.

Metadata

Release files for nrhjsurrogate 1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nrhjsurrogate 1.4
File Size Uploaded
nrhjsurrogate-1.4.tar.gz 2.4 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for nrhjsurrogate 1.4
File
nrhjsurrogate-1.4-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
nrhjsurrogate-1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
nrhjsurrogate-1.4-cp314-cp314-macosx_14_0_arm64.whl CPython 3.14 CPython 3.14 macOS 14.0+ ARM64 Details
nrhjsurrogate-1.4-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
nrhjsurrogate-1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
nrhjsurrogate-1.4-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
nrhjsurrogate-1.4-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
nrhjsurrogate-1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
nrhjsurrogate-1.4-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details

Total release size: 24.9 MB

Release files / nrhjsurrogate-1.4.tar.gz

Download URL nrhjsurrogate-1.4.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
8b467cdb0c69c5ad517440bb897f83b6519110b129a88e7e7168831eebde7152
BLAKE2b-256 checksum
How to use checksums
e2765f8e0bd5cb66c71b34ef25513bf15bbd44170e214872ca4b0e17de60934e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / nrhjsurrogate-1.4-cp314-cp314-win_amd64.whl

Download URL nrhjsurrogate-1.4-cp314-cp314-win_amd64.whl
Size 2.6 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
b7a960e7ef2e8585a00da5fb100f1e9accc75c1bab40c41b425edf779423b06d
BLAKE2b-256 checksum
How to use checksums
c013e1c7b0dd4b30e1bc81c21649550594efd123dffae1dba205942f8fa99c5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / nrhjsurrogate-1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nrhjsurrogate-1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.5 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
73435fe3f0351e78f43e18628352176fdb46e09521266713f27d1ac4fa5812f9
BLAKE2b-256 checksum
How to use checksums
91a7b5e8a3961560375cfff981246e00a871a916353fcf77f71792096a37b683
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / nrhjsurrogate-1.4-cp314-cp314-macosx_14_0_arm64.whl

Download URL nrhjsurrogate-1.4-cp314-cp314-macosx_14_0_arm64.whl
Size 2.4 MB
Tags CPython 3.14 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
0a77e00c1442fff624e1a7a8bcf7117512f443c847060bb1335ea155d95f1b6e
BLAKE2b-256 checksum
How to use checksums
d3eb93b498dbf7ee25dd7c45efc3aecc7316f5cf68c2cf6fcdcdabf1cb4a32be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / nrhjsurrogate-1.4-cp313-cp313-win_amd64.whl

Download URL nrhjsurrogate-1.4-cp313-cp313-win_amd64.whl
Size 2.6 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
38f1f9e64c8d6f242c4848ac2fa322e8bf56128eef6c2f2c8232f150cdae6da3
BLAKE2b-256 checksum
How to use checksums
2f042c08d3a78d6fa0e230994754e6d1e6d259f3babfc208359b0591e8b96d3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / nrhjsurrogate-1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nrhjsurrogate-1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.5 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
66602504e114a059e24bd004f138f0ec547bac59f9403a57abb17c660c1dc93b
BLAKE2b-256 checksum
How to use checksums
cb9558b0671c59bab68f095a52509bd6c50a0fb0c829d9338d9e6052e83fdbbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / nrhjsurrogate-1.4-cp313-cp313-macosx_14_0_arm64.whl

Download URL nrhjsurrogate-1.4-cp313-cp313-macosx_14_0_arm64.whl
Size 2.4 MB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
93f0eb3a9e3e8e312b2434d1aa9022b4897584ed3105cd0dce698002d3740cff
BLAKE2b-256 checksum
How to use checksums
2d0330f20cea0393b04899dc8dacac5dd9fe61b459bfdd1d9ed5a15fe2b844bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / nrhjsurrogate-1.4-cp312-cp312-win_amd64.whl

Download URL nrhjsurrogate-1.4-cp312-cp312-win_amd64.whl
Size 2.6 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
2da46c8b8bd86870da27bdbe4a9b2230460981287d011fa22cb0c3abfa367ee3
BLAKE2b-256 checksum
How to use checksums
cc221b9a149d600207dfd3def70466cd6a18894dc7ac6c36b0ee0d83acbf88c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / nrhjsurrogate-1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL nrhjsurrogate-1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.5 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e71d661ee72783830e5cf34e14e6855cd49f156baf2cc0fe23160566fe28c5ee
BLAKE2b-256 checksum
How to use checksums
6fe003aaf09b0c74b9c0fa1b6e0d9dc1b1b8b6481aa5ee43c02d846725fb6bbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / nrhjsurrogate-1.4-cp312-cp312-macosx_14_0_arm64.whl

Download URL nrhjsurrogate-1.4-cp312-cp312-macosx_14_0_arm64.whl
Size 2.4 MB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
24f8749d4cc530c5f40e5d0352aef641605b7aa4958a1364fa5d2266c6c7c184
BLAKE2b-256 checksum
How to use checksums
d441989034e964082e4b171215dc73f8fcaedfa7e06b172e317e83fcfdedf365
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

1.5

16 release files

This release

1.4 This release

10 release files

1.3

7 release files

1.1

7 release files

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page