Skip to content

Add option to utilize GPR model to create zero eccentricity initial orbital parameters - #12

Open
vtommasini wants to merge 1 commit into
sxs-collaboration:mainfrom
vtommasini:gpr-initial-orbital-params
Open

Add option to utilize GPR model to create zero eccentricity initial orbital parameters#12
vtommasini wants to merge 1 commit into
sxs-collaboration:mainfrom
vtommasini:gpr-initial-orbital-params

Conversation

@vtommasini

@vtommasini vtommasini commented Aug 20, 2026

Copy link
Copy Markdown

Expanded file to allow option of utilizing either PN approximation or a pre-trained GPR model to create zero eccentricity initial orbital parameters. Original PN logic remains unchanged.

method = GPR option: first computes the standard PN baseline for D_0, Omega_0, and adot_0, then applies a correction from a trained GPR model on top of the PN baseline.

currently only works for zero eccentricity GPR; eccentric GPR option is left for a future PR.

runnable both in Python and as a CLI.

Copilot AI lite review requested due to automatic review settings August 20, 2026 14:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends SimulationSupport.EccentricityControl.InitialOrbitalParameters to optionally compute zero-eccentricity initial orbital parameters using a PN baseline plus a Gaussian Process Regression (GPR) correction, and adds a Click-based CLI wrapper for the same functionality.

Changes:

  • Add method=("PN"|"GPR") and gpr_checkpoints to select PN-only vs. PN+GPR-corrected parameter estimation.
  • Refactor PN computation into a dedicated helper and add GPR helpers for feature vector assembly and checkpoint-based corrections.
  • Add a CLI command (initial-orbital-parameters) with text/JSON output.
Suppressed comments (2)

src/SimulationSupport/EccentricityControl/InitialOrbitalParameters.py:429

  • NotImplementedError is raised with an empty message. Since this is a user-facing code path (selected by method == "GPR" and nonzero eccentricity), it should explain the limitation (e.g. GPR currently supports only zero eccentricity).
    raise NotImplementedError("")

src/SimulationSupport/EccentricityControl/InitialOrbitalParameters.py:161

  • Spelling typo in the comment (supperted -> supported).
    # Only zero eccentricity is supperted here, since it utilizes ZeroEccParamsFromPN

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +449 to +471
"""Estimate the initial orbital parameters for a BBH evolution.

Estimates the initial coordinate separation, D_0, orbital angular velocity, Omega_0, and
radial expansion velocity, adot_0, from a Post-Newtonian approximation, optionally
corrected by a trained Gaussian Process Regression (GPR) model.

Specify the target eccentricity and either '--separation', '--orbital-angular-velocity',
'--num-orbits', or '---time-to-merger'.
"""
orbital_params_specified = [
param is not None
for param in [
separation,
orbital_angular_velocity,
num_orbits,
time_to_merger,
]
]
if sum(orbital_params_specified) != 1:
raise click.UsageError(
"Specify either '--separation', '--orbital-angular-velocity',"
"'--num-orbits', or '---time-to-merger'."
)
if gpr_adot_checkpoint:
gpr_checkpoints["adot"] = gpr_adot_checkpoint
if not gpr_checkpoints:
raise click.UsagError(
Comment on lines +11 to +13
import click
import numpy as np
import rich
Comment on lines +327 to +330
from SimulationSupport.gpr import (
load_gpr_checkpoint,
predict_with_gpr_model,
)
Comment on lines +310 to +314
f"GPR checkpoint expects input feature {missing_feature},"
"which is not available. Available features:"
f"{sorted(available_values.keys())}. Update the"
"'available_values' mapping in this module to match"
"the checkpoint's input_features metadata."
Comment on lines +389 to +395
corrected = {"omega": pn_omega, "adot": pn_adot}
for quantity_name, checkpoint_path in gpr_checkpoints.items():
if quantity_name not in corrected:
raise ValueError(
f"Unknown quantity `{quantity_name}` in `gpr_checkpoints`."
"Expected one of `D_0`, `Omega_0`, or `adot_0`."
)
separation: Optional[float] = None,
orbital_angular_velocity: Optional[float] = None,
radial_expansion_velocity: Optional[float] = None,
method: str = "PN", # accpets both "PN" and "GPR"
Comment on lines +551 to +554
help=(
"Dimensionless spin vector of the smaller black hole, for example,"
"written as '--spin-b 0.0, 0.0, 0.1'."
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants