Skip to content

Analysis - FEATURE - Redraw every Analysis plot with Makie, loaded as a package extension - #658

Open
matt-pharr wants to merge 35 commits into
feature/analysis-result-plotsfrom
feature/analysis-plots-overhaul
Open

matt-pharr wants to merge 35 commits into
feature/analysis-result-plotsfrom
feature/analysis-plots-overhaul

Conversation

@matt-pharr

@matt-pharr matt-pharr commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Release note

  • Audience: users
  • Numerical impact: none (harness @ 80862a4)
  • Migration: Load a Makie backend before plotting (using CairoMakie to save files, using GLMakie for interactive windows); without one, a plot call throws and says so. Plots return a Makie Figure instead of a Plots.Plot, and Plots and PlotlyJS are no longer dependencies. plot_fixed_boundary_stability_criterion is now plot_critical_determinant, and plot_gse_by_theta and plot_gse_integrated are one plot_gse(gse) that takes Equilibrium.equilibrium_gse!'s result.

Overhaul and visual polish of the existing plots. Guidance on when to add a standard plot and when not to (mostly to prevent AI agents from running wild adding superfluous junk). Both interactive/zoomable and panable plots and can be saved to pdf or png in a script. Replaced Plotly library with Makie which is generally the more polished and julia-y option.

The goal of this PR is to make sure all the main plots that were widely used from the OMFIT module are included in some easily accessible form, that diagnosing a run is relatively easy from the REPL, and that the plots that we see are roughly of publication quality. That means that we cannot have anything be difficult to read, look like a first-pass plot, or have overlapping text. This must be balanced by making sure the included plots are not too busy and do not look like vibe code output.

We also add guidance on when to add a plot. All plots to be added as standard plots must be viewed as mockups by a human before an AI adds them, to avoid our standard plots becoming polluted by random one-off plots from rogue claude sessions. AI agents should not propose new plots to the standard plots unless making an entirely new module, or unless they are requested to consider new plots. New plots should be added sparingly otherwise the available_plots() function will become crowded and lose its usefulness.

Regression report

feature/analysis-result-plots @ bd8fe977d against feature/analysis-plots-overhaul @ 80862a4d6 (fan-out on ITER's SDCC cluster, Julia 1.12.6, pinned manifest): 27 cases, 385 quantities, all unchanged.

Per-case report
diiid_error_field            10 unchanged
diiid_kinetic_multi_n        8 unchanged
diiid_multi_n                19 unchanged
diiid_n1                     53 unchanged
diiid_n1_riccati             17 unchanged
diiid_n1_riccati_precompiled 17 unchanged
diiid_slayer_n1              22 unchanged
diiid_slayer_n1_chi_perp_e   22 unchanged
diiid_slayer_n1_coupled      7 unchanged
diiid_slayer_n1_toroidal     5 unchanged
diiid_slayer_n1_winding      22 unchanged
diiid_truncation_n1          12 unchanged
efit_fixedbdy_separatrix     5 unchanged
gal_resistive_diiid          11 unchanged
gal_resistive_diiid_galinner 11 unchanged
ggj_ray_q500i                4 unchanged
ggj_reference                4 unchanged
lar_ggj_tearing_n1           3 unchanged
lar_reversed_shear_n1        22 unchanged
solovev_kinetic_nuzero       14 unchanged
solovev_multi_n              15 unchanged
solovev_n1                   22 unchanged
tj_kinetic_calculated        20 unchanged
tj_kinetic_multiion          6 unchanged
tj_kinetic_ntv               7 unchanged
tj_kinetic_ntv_rates         2 unchanged
tj_n1                        25 unchanged

Plot registry, before and after

34 registered plots before, 42 after, by module

Equilibrium

Plot In #650's registry What it draws
plot_equilibrium_summary ✓ flux surfaces and profiles
plot_qprofile ✓ q against ψ_N with the rational surfaces
plot_pressure_profile ✓ μ₀p against ψ_N
plot_f_profile ✓ 2πF against ψ_N
plot_flux_surfaces ✓ flux surfaces and θ spokes in (R, Z)
plot_gse_by_theta merged into plot_gse(gse) (unregistered) Grad-Shafranov error against ψ_N per θ slice
plot_gse_integrated merged into plot_gse(gse) (unregistered) flux-surface-integrated Grad-Shafranov error

ForceFreeStates

Plot In #650's registry What it draws
plot_ffs_summary ✓ the stability panels the run supplies
plot_critical_determinant renamed from plot_fixed_boundary_stability_criterion critical determinant against ψ_N
plot_eigenvalues ✓ free-boundary energy eigenvalues
plot_mode_displacement ✓ |ξ^ψ_m| of the least stable mode
plot_energy_eigenvectors ✓ free-boundary energy eigenvectors per m
plot_edge_stability_scan ✓ edge energies against the truncation q
plot_delta_prime ✓ Δ′ matrix between rational surfaces
plot_delta_prime_raw new raw outer-region matching matrix D′
plot_delta_coil new Δ_coil: surface response to each edge harmonic
plot_cond_fbar ✓ cond(F̄) scan for kinetic singular surfaces
plot_ballooning_alpha_boundary ✓ ballooning α against its first stability boundary

PerturbedEquilibrium

Plot In #650's registry What it draws
plot_perturbed_equilibrium_summary ✓ resonant field, edge b̄^ψ spectrum, ξ^ψ spectrogram and b_n on the poloidal plane
plot_resonant_area_weighted_field ✓ resonant coupling rows per rational surface
plot_resonant_area_weighted_field_amplitude ✓ |b̄_res| per rational surface
plot_island_widths ✓ island half-width per rational surface
plot_chirikov_parameter ✓ effective island-overlap Chirikov parameter per rational surface
plot_driven_delta_prime ✓ forcing-driven Δ′ per rational surface
plot_mode_spectrogram ✓ response harmonics against ψ_N (component = :xi_psi, :b_psi, :Jb_theta, :Jb_zeta)
plot_dominant_mode_surface new a dominant resonant-coupling mode as b_n on the control surface
plot_singular_mode_rz new dominant resonant-coupling modes as b_n on the control-surface cross-section
plot_coupling_matrix new resonant coupling matrix |C| with its singular values and left and right singular vectors
plot_perturbed_field_rz new b_n or ξ_n on the poloidal plane (deform = true for the displaced boundary)
plot_effective_islands new island chains from the effective resonant flux
plot_islands new island chains from the penetrated field

CoilForcing

Plot In #650's registry What it draws
plot_bn_contour existed, now registered applied b_n on the control surface (coils = true for the coils)
plot_coil_geometry_3d ✓ 3D coils and plasma boundary
plot_coil_geometry_rz ✓ coils over the plasma boundary in (R, Z)
plot_mode_spectrum ✓ |Φ_x(m, n)| forcing spectrum
plot_sources new the coil sources in 3D, coloured by current or by set

ErrorFields

Plot In #650's registry What it draws
plot_error_field_summary ✓ overlap against the threshold, locking risk and coil sensitivities
plot_coil_sensitivities ✓ per-coil dominant-mode sensitivities
plot_overlap_phasors ✓ as-designed overlap δ of each coil set in the complex plane
plot_linearity_residuals ✓ linearity residuals of the coil sensitivities
plot_dominant_mode_spectrum ✓ spectra of the dominant resonant-coupling modes
plot_tolerance_pdf ✓ Monte Carlo distribution of |δ|
plot_threshold_scaling ✓ |δ| distribution against the threshold's CDF
plot_locking_risk ✓ locking risk against tolerance scale

Notes for reviewers

🤖 Generated with Claude Code

…gure theme and a plots CI group

Makie becomes a weak dependency with the GPECMakieExt extension, which holds the figure theme, the label
helpers and saving with whichever backend is loaded. Analysis._draw is the entry point ported plots use; it
throws an ArgumentError naming `using CairoMakie` or `using GLMakie` when no backend is loaded. The plot tests
move to a new `plots` group whose CI job stacks a CairoMakie environment onto LOAD_PATH, so Makie stays out of
the package's own dependencies; changes under ext/ now trigger the test workflow.
…d add the control-surface, (R, Z) and island views
@matt-pharr
matt-pharr requested a review from logan-nc November 6, 2026 10:05
@matt-pharr matt-pharr self-assigned this Nov 6, 2026
@matt-pharr
matt-pharr changed the base branch from develop to feature/analysis-result-plots November 6, 2026 16:24
@matt-pharr
matt-pharr added this pull request to stack #651 November 6, 2026 16:24
@matt-pharr matt-pharr changed the title Feature/analysis plots overhaul Analysis - FEATURE! - Redraw every Analysis plot with Makie, loaded as a package extension Nov 9, 2026
@github-actions github-actions Bot added changed-results Results move or an interface breaks - read before upgrading feature New capability labels Nov 9, 2026
@matt-pharr
matt-pharr marked this pull request as ready for review November 9, 2026 09:13
@matt-pharr

Copy link
Copy Markdown
Collaborator Author

@logan-nc this is PR 3/3 on the analysis/repl interaction overhaul stack. I went through and tried my best to polish all of the plots in the process and make it easier to interact with the Analysis module. In the process, I ported the plots to Makie which is a more polished/julia-idiomatic plotting package and IMO looks much better. I had claude compile all of the plots here, please review and give feedback and/or merge at your leisure.

https://claude.ai/artifact/MfY7eeYYa1K3YLFC1E3Bxi

@matt-pharr matt-pharr changed the title Analysis - FEATURE! - Redraw every Analysis plot with Makie, loaded as a package extension Analysis - FEATURE - Redraw every Analysis plot with Makie, loaded as a package extension Nov 9, 2026
@matt-pharr matt-pharr removed the changed-results Results move or an interface breaks - read before upgrading label Nov 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant