Skip to content

Add superposed-epoch chart (Fig. 9) to paper figures - #40

Merged
dfeen87 merged 2 commits into
mainfrom
copilot/run-python-code-in-isolation
Mar 14, 2026
Merged

dfeen87 merged 2 commits into
mainfrom
copilot/run-python-code-in-isolation

Conversation

Copilot AI commented Mar 14, 2026 •

Copy link
Copy Markdown
Contributor

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 — New plot_superposed_epoch(rel_hours, mean, ci, n_flares) function, same (fig, ax) contract as Figs 6–8
  • experiments/make_superposed_epoch_figure.py — Generation script: loads XRS data → computes ΔΦ(t) → detects flares → builds epoch-aligned matrix → plots ensemble mean ± 95% CI
  • output/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
python experiments/make_superposed_epoch_figure.py
python experiments/make_superposed_epoch_figure.py --months 3 --pre-hours 48

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

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 requested a review from dfeen87 March 14, 2026 14:02
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
dfeen87 marked this pull request as ready for review March 14, 2026 14:16
Copilot AI review requested due to automatic review settings March 14, 2026 14:16
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@dfeen87
dfeen87 merged commit 1cac8e9 into main Mar 14, 2026
7 checks passed
@dfeen87
dfeen87 deleted the copilot/run-python-code-in-isolation branch March 14, 2026 14:16

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

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() to shared/plot_utils.py to render mean |ΔΦ(t)| with a 95% CI band and onset marker.
  • Add experiments/make_superposed_epoch_figure.py to 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 thread shared/plot_utils.py
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)|")
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.

3 participants