Repository navigation
Add superposed-epoch chart (Fig. 9) to paper figures - #40
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Execute Python code in an isolated environment
No-op: Execute superposed-epoch analysis script against existing repo code
Mar 14, 2026
Copilot
AI
changed the title
No-op: Execute superposed-epoch analysis script against existing repo code
No-op: execute superposed-epoch analysis script and return plot
Mar 14, 2026
Co-authored-by: dfeen87 <158860247+dfeen87@users.noreply.github.com>
Copilot
AI
changed the title
No-op: execute superposed-epoch analysis script and return plot
Add superposed-epoch chart (Fig. 9) to paper figures
Mar 14, 2026
dfeen87
marked this pull request as ready for review
March 14, 2026 14:16
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Adds a committed, reproducible “superposed-epoch” figure (Fig. 9) for the paper by introducing a shared plotting helper and an experiment script that builds an epoch-aligned ΔΦ(t) ensemble around detected flare onsets.
Changes:
- Add
plot_superposed_epoch()toshared/plot_utils.pyto render mean |ΔΦ(t)| with a 95% CI band and onset marker. - Add
experiments/make_superposed_epoch_figure.pyto compute the superposed-epoch matrix from GOES-18 XRS data and save Fig. 9. - Add smoke tests for the new plot helper in
test/test_plot_utils.py.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
shared/plot_utils.py |
Introduces the new superposed-epoch plotting utility consistent with existing figure helpers. |
experiments/make_superposed_epoch_figure.py |
Adds a standalone generation pipeline for Fig. 9 (load → ΔΦ(t) → detect flares → align windows → plot). |
test/test_plot_utils.py |
Adds smoke tests validating the new plotting helper’s basic behavior and API contract. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+85
to
+93
| sig = delta_phi_df[["time", "delta_phi"]].dropna().sort_values("time").reset_index(drop=True) | ||
| sig["time"] = pd.to_datetime(sig["time"], utc=True) | ||
| sig_times = sig["time"].to_numpy() | ||
| sig_vals = np.abs(sig["delta_phi"].to_numpy(dtype=float)) | ||
|
|
||
| # Infer cadence | ||
| dt_seconds = float( | ||
| np.median(np.diff(sig_times).astype("timedelta64[s]").astype(float)) | ||
| ) |
| windows: list[np.ndarray] = [] | ||
| for onset in flare_df["onset_time"]: | ||
| target_times = onset + pd.to_timedelta(rel_minutes, unit="m") | ||
| target_np = target_times.to_numpy() |
Comment on lines
+171
to
+177
| # Ensemble statistics | ||
| mean = np.nanmean(matrix, axis=0) | ||
| n_eff = np.sum(np.isfinite(matrix), axis=0).astype(float) | ||
| std = np.nanstd(matrix, axis=0, ddof=1) | ||
| sem = std / np.sqrt(np.maximum(n_eff, 1.0)) | ||
| ci = 1.96 * sem | ||
|
|
Comment on lines
+391
to
+393
| ax.set_xlabel("Time relative to flare onset (hours)", fontsize=10) | ||
| ax.set_xlim(rel_hours[0], rel_hours[-1]) | ||
| style_solar_axes(ax, title=title, ylabel="Mean |ΔΦ(t)|") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The superposed-epoch analysis of |ΔΦ(t)| around flare onsets needed a committed figure so it's actually viewable in the repo/PR.
shared/plot_utils.py— Newplot_superposed_epoch(rel_hours, mean, ci, n_flares)function, same(fig, ax)contract as Figs 6–8experiments/make_superposed_epoch_figure.py— Generation script: loads XRS data → computes ΔΦ(t) → detects flares → builds epoch-aligned matrix → plots ensemble mean ± 95% CIoutput/paper_figures/fig9_superposed_epoch.png— The chart (67 flares, Jan 2024, −24h to +6h window)test/test_plot_utils.py— 4 smoke tests for the new plot function✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.