Skip to content

PlotSpecEccentricityControl#6

Open
vtommasini wants to merge 4 commits into
sxs-collaboration:mainfrom
vtommasini:plot-spec-ecc-control
Open

PlotSpecEccentricityControl#6
vtommasini wants to merge 4 commits into
sxs-collaboration:mainfrom
vtommasini:plot-spec-ecc-control

Conversation

@vtommasini
Copy link
Copy Markdown

@vtommasini vtommasini commented May 1, 2026

Modeled after Spectre's PlotEccentricityControl.py

Makes the three plots below:

Screenshot 2026-04-30 at 5 37 55 PM Screenshot 2026-04-30 at 5 38 10 PM Screenshot 2026-04-30 at 5 38 36 PM

Copilot AI review requested due to automatic review settings May 1, 2026 00:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new plotting utility (PlotSpecEccentricityControl) modeled after SpEC’s eccentricity-control plotting, along with a Gaussian Process Regression helper module and accompanying tests.

Changes:

  • Introduces src/SimulationSupport/PlotSpecEccentricityControl.py to generate eccentricity-vs-iteration, trajectory, and iteration-count plots.
  • Adds a GPR training/prediction pipeline in src/SimulationSupport/gpr.py (and a duplicate root-level GPR_library.py).
  • Adds unit tests for the plotting helpers and GPR pipeline.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
src/SimulationSupport/PlotSpecEccentricityControl.py New plotting + parsing + CLI code for eccentricity-control visualizations.
src/SimulationSupport/gpr.py New GPR model, training loop, prediction, and pipeline helper.
tests/test_PlotSpecEccentricityControl.py New tests for plot/data helper functions (currently not collected by pytest config).
tests/test_gpr.py New tests for GPR functions (currently not collected; also imports wrong module path).
GPR_library.py Duplicate GPR implementation at repo root (not packaged under src/).
TestGPRLibrary.py Additional test file at repo root (not executed by pytest due to testpaths).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread GPR_library.py
Comment on lines +208 to +212
if loss.item() < best_loss:
best_loss = loss.item()
best_state = model.state_dict().copy()

# Load the best model state after training
Comment thread tests/test_gpr.py
Comment on lines +25 to +29
def setUp(self):
self.test_dir = Path("SimulationSupport") / "gpr_library_tests"

# Clean up any existing test directory and create a new one
shutil.rmtree(self.test_dir, ignore_errors=True)

sizes = 80 * counts_df["Iterations"]
unique_sims = counts_df["Sim"].unique()
color_map = dict(zip(unique_sims, plt.cm.tab20.colors[: len(unique_sims)]))
Comment on lines +319 to +320
grouped[sim].append(root / Path(path))
return grouped
Comment thread TestGPRLibrary.py
Comment on lines +1 to +5
# Distributed under the MIT License.
# See LICENSE.txt for details.

# Unit test for GPR_library.py
# Generate a simple, synthetic regression problem and run the pipeline
Comment thread GPR_library.py
Comment on lines +234 to +237
# Normalize the input using the model's stored parameters
normalized_X = (raw_X - model.input_mean) / model.input_std
X_tensor = torch.from_numpy(normalized_X).float()

Comment thread tests/test_gpr.py
Comment on lines +4 to +8
"""
Unit test for gpr.py
Generate a simple, synthetic regression problem and run the pipeline
Assert that the shapes are reasonable, uncertainties are positive, and
that the mean predictions are within a reasonable range of the true values
Comment on lines +657 to +658
fig (matplotlib.figure.Figure): Figure containing the plot
ax (matplotlib.axes.Axes): Axis
Comment thread tests/test_gpr.py
Comment on lines +16 to +20
from gpr import (
predict_with_gpr_model,
run_gpr_pipeline,
train_gpr_model,
)
model
likelihood
Y_pred
uncertainties
@vtommasini vtommasini closed this May 18, 2026
@vtommasini vtommasini reopened this May 19, 2026
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