Datasets:
Formats:
csv
Languages:
English
Size:
< 1K
Tags:
mathematics
homogenization
spectral-theory
variational-methods
matrix-analysis
scientific-computing
Download research/code/make_supporting_figures.py from PureOne/EVE-QELTHA: direct link, hf CLI and curl.
- Browser
- Download file 2.54 kB
-
https://huggingface.co/datasets/PureOne/EVE-QELTHA/resolve/main/research/code/make_supporting_figures.py
- Command line
-
hf download hf://datasets/PureOne/EVE-QELTHA/research/code/make_supporting_figures.py
-
curl -L -o make_supporting_figures.py https://huggingface.co/datasets/PureOne/EVE-QELTHA/resolve/main/research/code/make_supporting_figures.py
2.54 kB
| #!/usr/bin/env python3 | |
| """Render recorded full-model numerical results, without modifying data.""" | |
| from pathlib import Path | |
| import json | |
| import matplotlib | |
| matplotlib.use('Agg') | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| ROOT=Path(__file__).resolve().parents[1] | |
| data=lambda n:json.loads((ROOT/'results'/f'{n}.json').read_text()) | |
| plt.rcParams.update({'font.family':'DejaVu Sans','font.size':9, | |
| 'axes.spines.top':False,'axes.spines.right':False}) | |
| fig,axes=plt.subplots(3,1,figsize=(6.3,7.3),constrained_layout=True) | |
| nx=data('nexus') | |
| for kind,label,color in [('coherent_difference','Difference port','#136d87'), | |
| ('coherent_sum','Sum port','#9b425a')]: | |
| rows=[r for r in nx['rows'] if r['kind']==kind] | |
| # Only the main sequence: refinement runs carry their own kind labels. | |
| axes[0].loglog([r['epsilon'] for r in rows],[r['impedance'] for r in rows], | |
| 'o-',label=label,color=color,ms=4) | |
| axes[0].axhline(467/120,ls='--',color='#9b425a',alpha=.6) | |
| axes[0].invert_xaxis();axes[0].set_xlabel(r'$\varepsilon$') | |
| axes[0].set_ylabel(r'$Z_{22}$');axes[0].set_title('Same kernel spectra; different fate') | |
| axes[0].legend(fontsize=7) | |
| lp=data('logperiodic') | |
| rows=[r for r in lp['full_model_rows'] if abs(r['eta']-1/32)<1e-12 and r['cycle']==2] | |
| rows=sorted(rows,key=lambda r:r['target_phase']) | |
| xx=[r['target_phase'] for r in rows];yy=[r['scaled_capacity'] for r in rows] | |
| zz=[r['limiting_constant'] for r in rows] | |
| axes[1].plot(xx,zz,'o-',label='Scalar phase limit',color='#67499c',ms=4) | |
| axes[1].plot(xx,yy,'x',label='Full model, cycle 2',color='#136d87',ms=6) | |
| axes[1].set_xlabel(r'Logarithmic phase $\phi$');axes[1].set_ylabel(r'$\kappa_\varepsilon/\varepsilon$') | |
| axes[1].set_title(r'Persistent phase, $\eta=1/32$');axes[1].legend(fontsize=7) | |
| un=data('universality')['residual_gram_correction']['rows'] | |
| for v,c in [(.7,'#136d87'),(1.8,'#67499c')]: | |
| rows=[r for r in un if r['target_eigenvalue']==v] | |
| axes[2].semilogx([r['penalty'] for r in rows], | |
| [r['scaled_defect_to_gram_ratio'] for r in rows],'o-',color=c,ms=4,label=f'Target v={v}') | |
| axes[2].axhline(1,ls='--',color='#17243c',lw=1) | |
| axes[2].set_xlabel(r'Drainage strength $\rho$') | |
| axes[2].set_ylabel(r'$\rho(Y_\infty-Y_\rho)/W$') | |
| axes[2].set_title('Sharp first correction');axes[2].legend(fontsize=7) | |
| for ax in axes:ax.grid(alpha=.15) | |
| out=ROOT/'figures';out.mkdir(exist_ok=True) | |
| fig.savefig(out/'research_results.pdf');fig.savefig(out/'research_results.png',dpi=180) | |
| print(out/'research_results.pdf') | |