#!/usr/bin/env python3 """Redraw manuscript figures from saved numerical results, without reintegration. Run beside reproduce_cycles.py; requires its Python dependencies, pdfLaTeX, Latin Modern, PGF, and pdftoppm. Output PDFs are 156 mm wide (121.68 mm for the phase portrait), with text set by LaTeX at 10.95 TeX pt, the normal body size of article[11pt]. """ from pathlib import Path import json import numpy as np import reproduce_cycles as rc base = Path(__file__).resolve().parent source = base / 'outputs' output = base.parent / 'figures' output.mkdir(exist_ok=True) metadata = json.loads((source / 'results.json').read_text()) results = {int(k): v for k, v in metadata['cases'].items()} coeffs = {n: np.array([float(c) for c in r['interpolation']['coefficients']]) for n, r in results.items()} samples = [np.genfromtxt(source / f'cycle_N3_{i}.csv', delimiter=',', names=True) for i in range(1, 4)] rc.set_plot_style() rc.plot_melnikov(results, coeffs, output) rc.plot_phase(results[3], samples, output) rc.plot_concavity(results, coeffs, metadata['parameter_delta'], output) print('Rebuilt all three manuscript figures.')