chaotic_pfc.analysis.sweep_plotting¶
sweep_plotting.py¶
Figures for Lyapunov classification maps produced by
chaotic_pfc.sweep.
Three plot types are provided:
plot_heatmap_continuous()— raw λ_max heatmap.plot_classification_interleaved()— publication-style discrete classification (periodic / chaotic / unbounded) with gaps between orders.plot_difficulty_map()— heatmap of the number of Lyapunov iterations actually used at each grid point. Only meaningful when the sweep was run withadaptive=True; shows where the spectrum converges quickly (light) vs. where it needs the full budget (dark) — a “difficulty map” of the parameter space.
All three accept a SweepResult (or its
individual arrays for the first two) and optionally a save_path.
They return the matplotlib.figure.Figure so callers can
compose or display them. The module also re-uses the RC params from
chaotic_pfc.plotting, so sweep figures look consistent with the
rest of the pipeline.
Functions
|
Map raw λ_max values to discrete classes. |
|
Generate the standard figures for a sweep and save them to |
|
Publication-style layout with gaps between adjacent orders. |
|
Heatmap of Lyapunov iterations actually used at each grid point. |
|
Continuous λ_max heatmap over the (N_z, ω_c/π) plane. |
- chaotic_pfc.analysis.sweep_plotting.classify(h)[source]¶
Map raw λ_max values to discrete classes.
Returns an array with the same shape as
hwhere each entry is:-1— periodic orbit (λ_max ≤ 0)0— chaotic orbit (λ_max > 0)2— unbounded / divergent (NaN inh)
The unusual integer codes match the
matplotlib.colors.BoundaryNormbins used below.
- chaotic_pfc.analysis.sweep_plotting.plot_heatmap_continuous(result=None, *, h=None, orders=None, cutoffs=None, save_path=None)[source]¶
Continuous λ_max heatmap over the (N_z, ω_c/π) plane.
- chaotic_pfc.analysis.sweep_plotting.plot_classification_interleaved(result=None, *, h=None, orders=None, cutoffs=None, save_path=None, data_slots=3, gap_slots=1, lang='pt')[source]¶
Publication-style layout with gaps between adjacent orders.
Each order occupies
data_slotscolumns of coloured data followed bygap_slotsblank columns, producing the striped appearance used in Baptista et al.- Parameters:
- Return type:
- chaotic_pfc.analysis.sweep_plotting.plot_difficulty_map(result, *, save_path=None, cmap='viridis')[source]¶
Heatmap of Lyapunov iterations actually used at each grid point.
A “difficulty map” of the parameter space: low values mean the spectrum estimate converged quickly (strongly chaotic or strongly stable points), high values mean the running estimate stayed within the convergence tolerance only after many iterations (typically fronteira points where |λ_max| ≈ 0). Diverged grid points are shown in the same light grey used for unbounded orbits in the classification figures, so the two layers can be visually overlaid.
- Parameters:
result (SweepResult) – A
SweepResultproduced withadaptive=True. The function relies onresult.n_iters_usedand onresult.metadata['Nmap_min']/result.metadata['Nmap']for the colour-bar limits.save_path (str | Path | None) – Optional path to write the figure to.
cmap (str) – Sequential matplotlib colormap name.
viridisis perceptually uniform and prints well in greyscale.
- Raises:
ValueError – If
resultwas produced withadaptive=False(the heatmap would be a single colour, which is misleading rather than informative). The error message points the user to theadaptive=Trueflag inrun_sweep().- Return type:
- chaotic_pfc.analysis.sweep_plotting.plot_all(result, out_dir, *, fmt='png', close_figures=True, lang='pt')[source]¶
Generate the standard figures for a sweep and save them to
out_dir/<fig>.{fmt}. Returns the list of written paths.Always produces the two classification figures listed in
FIGURE_FILENAMES. Additionally producesfig3_difficulty_map.{fmt}(seeDIFFICULTY_FIGURE_FILENAME) whenresultwas generated withadaptive=True: the figure is silently skipped for non-adaptive sweeps because it would be monochromatic and therefore uninformative.The output directory is created if it does not exist.