1414 - ΔΦ(t) overlaid as a single curve
1515
1616Reproducibility settings:
17- seed = 0, DPI = 150, figure sizes as specified per figure below.
17+ seed = 0, DPI = 300 (manuscript) / 150 (debug) , figure sizes as specified per figure below.
1818"""
1919
2020from __future__ import annotations
4444
4545# ── Reproducibility ──────────────────────────────────────────────────────────
4646SEED = 0
47- DPI = 150
47+ DPI = 300 # manuscript / high-quality – raised from 150 for print clarity
48+ DPI_DEBUG = 150 # debug / quick-inspect output
4849np .random .seed (SEED )
4950
5051# ── Consistent regime colour palette (Stage 2 / Stage 3 compatible) ──────────
5455 "instability" : "#F44336" , # red
5556 "recovery" : "#4CAF50" , # green
5657}
57- REGIME_ALPHA = 0.15 # polished (manuscript) – slightly softer than original
58+ REGIME_ALPHA = 0.13 # polished (manuscript) – reduced ~13% to avoid washout
5859REGIME_ALPHA_UNPOLISHED = 0.18 # original value, kept for debug reproducibility
5960
6061# Minimum contiguous-block length (samples) for a transition marker to be shown
@@ -135,6 +136,7 @@ def plot_regime_segmentation(
135136 out_path : str ,
136137 * ,
137138 polished : bool = True ,
139+ extra_out_paths : list [str ] | None = None ,
138140) -> None :
139141 """Plot broad regime bands with ΔΦ(t) overlaid and transition markers.
140142
@@ -146,17 +148,21 @@ def plot_regime_segmentation(
146148 transition lines, and suppression of short-lived transition markers.
147149 When *False* (debug output) the original visual parameters are used.
148150 Neither mode alters the underlying segmentation logic or thresholds.
151+ extra_out_paths : list of str, optional
152+ Additional output paths (e.g. PDF, SVG) to save alongside ``out_path``.
149153 """
150154 intervals = regime_shading_intervals (regime_labels )
151155 transitions = extract_transition_events (regime_labels )
152156
153157 # ── Visual parameters ─────────────────────────────────────────────────────
154158 if polished :
155- regime_alpha = REGIME_ALPHA # 0.15 – slightly softer bands
156- curve_lw = 1.5 # thicker ΔΦ(t) for readability
159+ regime_alpha = REGIME_ALPHA # 0.13 – reduced to avoid washout
160+ curve_lw = 1.8 # +0.3 thicker ΔΦ(t) for readability
157161 trans_color = "#9E9E9E" # lighter gray
158162 trans_lw = 0.6 # slightly thinner
159163 trans_alpha = 0.45
164+ curve_aa = False # crisp, no anti-alias blur at 300 DPI
165+ trans_aa = False
160166 # Suppress transition markers for short-lived blocks (visual clutter).
161167 major_starts = {
162168 iv .start
@@ -170,6 +176,8 @@ def plot_regime_segmentation(
170176 trans_color = "#616161"
171177 trans_lw = 0.8
172178 trans_alpha = 0.6
179+ curve_aa = True
180+ trans_aa = True
173181 visible_transitions = transitions
174182
175183 fig , ax = plt .subplots (figsize = (14 , 5 ))
@@ -195,6 +203,7 @@ def plot_regime_segmentation(
195203 linewidth = trans_lw ,
196204 linestyle = "--" ,
197205 alpha = trans_alpha ,
206+ antialiased = trans_aa ,
198207 zorder = 3 ,
199208 )
200209
@@ -203,6 +212,7 @@ def plot_regime_segmentation(
203212 t , delta_phi ,
204213 color = "#212121" ,
205214 linewidth = curve_lw ,
215+ antialiased = curve_aa ,
206216 zorder = 4 ,
207217 label = r"$\Delta\Phi(t)$" ,
208218 )
@@ -248,9 +258,13 @@ def plot_regime_segmentation(
248258 ax .grid (True , linestyle = "--" , linewidth = 0.4 , alpha = 0.4 )
249259
250260 fig .tight_layout ()
251- fig . savefig ( out_path , dpi = DPI , bbox_inches = "tight" )
252- plt . close ( fig )
261+ save_dpi = DPI if polished else DPI_DEBUG
262+ fig . savefig ( out_path , dpi = save_dpi , bbox_inches = "tight" )
253263 print (f"Saved: { out_path } " )
264+ for extra_path in (extra_out_paths or []):
265+ fig .savefig (extra_path , bbox_inches = "tight" )
266+ print (f"Saved: { extra_path } " )
267+ plt .close (fig )
254268
255269
256270# ── Entry point ───────────────────────────────────────────────────────────────
@@ -288,12 +302,15 @@ def main() -> None:
288302 )
289303
290304 # ── 6. Plot regime segmentation – polished (manuscript) ───────────────────
305+ _ms_png = os .path .join (_MANUSCRIPT_DIR , "regime_segmentation.png" )
306+ _ms_pdf = os .path .join (_MANUSCRIPT_DIR , "regime_segmentation.pdf" )
291307 plot_regime_segmentation (
292308 t ,
293309 delta_phi ,
294310 regime_labels = regime_result .labels ,
295- out_path = os . path . join ( _MANUSCRIPT_DIR , "regime_segmentation.png" ) ,
311+ out_path = _ms_png ,
296312 polished = True ,
313+ extra_out_paths = [_ms_pdf ],
297314 )
298315
299316
0 commit comments