Datasets:
Languages:
English
Size:
< 1K
ArXiv:
Tags:
nanofabrication
photochemistry
photonics
mathematical-physics
optimal-control
reaction-diffusion
Download code/make_figures.py from PureOne/ELYRION-III: direct link, hf CLI and curl.
- Browser
- Download file 3.31 kB
-
https://huggingface.co/datasets/PureOne/ELYRION-III/resolve/main/code/make_figures.py
- Command line
-
hf download hf://datasets/PureOne/ELYRION-III/code/make_figures.py
-
curl -L -o make_figures.py https://huggingface.co/datasets/PureOne/ELYRION-III/resolve/main/code/make_figures.py
3.31 kB
| #!/usr/bin/env python3 | |
| """Recreate the five manuscript figures from the declared model and saved ledger. | |
| These are synthetic mathematical calculations, not experimental micrographs. | |
| Run verify.py first if results/verification.json is missing. | |
| """ | |
| from pathlib import Path | |
| import json | |
| import numpy as np | |
| import matplotlib | |
| matplotlib.use('Agg') | |
| import matplotlib.pyplot as plt | |
| from model import comb_profile, optimal_action, cubic_constant, diffusion_comb | |
| ROOT=Path(__file__).resolve().parents[1] | |
| def finish(fig, name): | |
| fig.tight_layout() | |
| fig.savefig(ROOT/'figures'/name,dpi=200) | |
| plt.close(fig) | |
| def main(): | |
| (ROOT/'figures').mkdir(exist_ok=True) | |
| ledger=ROOT/'results'/'verification.json' | |
| if not ledger.exists(): | |
| raise FileNotFoundError('Run python code/verify.py before plotting.') | |
| report=json.loads(ledger.read_text(encoding='utf-8')) | |
| theta=np.linspace(0,2*np.pi,4097) | |
| fig=plt.figure(figsize=(7.5,4.3)) | |
| for m in (2,4,8): | |
| plt.plot(theta/(2*np.pi),comb_profile(m,optimal_action(m,.5),theta), | |
| label=f'{m} sequential gates') | |
| plt.xlabel('Position / original optical fringe period') | |
| plt.ylabel('Retained molecular fraction') | |
| plt.title('A finer pattern from sequential chemical memory') | |
| plt.ylim(-.025,.57); plt.legend() | |
| finish(fig,'comb_profiles.png') | |
| orders=np.arange(2,129) | |
| fig=plt.figure(figsize=(7.5,4.3)) | |
| for q in (.1,.5,.9): | |
| dose=[m*optimal_action(int(m),q) for m in orders] | |
| plt.loglog(orders,dose,label=f'Midpoint fraction q = {q}') | |
| plt.xlabel('Pitch multiplication factor m');plt.ylabel('Minimum marking action U') | |
| plt.title('Exact finite-order frontier; cubic asymptotic growth');plt.legend() | |
| finish(fig,'dose_frontier.png') | |
| fig=plt.figure(figsize=(7.5,4.3)) | |
| for q in (.1,.5,.9): | |
| ratios=[optimal_action(int(m),q)/m**2 for m in orders] | |
| plt.semilogx(orders,ratios,label=f'q = {q}; limit {cubic_constant(q):.6f}') | |
| plt.xlabel('Pitch multiplication factor m');plt.ylabel('Minimum marking action / m³') | |
| plt.title('Convergence to the sharp cubic constants');plt.legend() | |
| finish(fig,'cubic_constants.png') | |
| fig=plt.figure(figsize=(7.5,4.3)) | |
| for d in (0.,.0001,.001): | |
| result=diffusion_comb(6,optimal_action(6,.5),d,n=768) | |
| plt.plot(result['theta']/(2*np.pi),result['survival'],label=f'Dθ = {d:g}') | |
| plt.xlabel('Position / original optical fringe period');plt.ylabel('Retained molecular fraction') | |
| plt.title('Diffusion fills dark nodes and exposes the pulse order');plt.legend() | |
| finish(fig,'diffusion_profiles.png') | |
| hazards=report['hazard_examples'] | |
| fig=plt.figure(figsize=(7.5,4.3)) | |
| plt.loglog([r['factor_gates'] for r in hazards],[r['error'] for r in hazards], | |
| 'o-',label='Observed error on a 24³ grid') | |
| plt.loglog([r['factor_gates'] for r in hazards],[r['bound'] for r in hazards], | |
| 's--',label='Whole-domain analytic upper bound') | |
| plt.xlabel('Number of patterned factor gates');plt.ylabel('Absolute conversion-fraction error') | |
| plt.title('General 3D compilation is constructive, not inexpensive');plt.legend() | |
| finish(fig,'universal_compiler_cost.png') | |
| print('Five figures recreated in',ROOT/'figures') | |
| if __name__=='__main__': | |
| main() | |