Datasets:
Languages:
English
Size:
< 1K
ArXiv:
Tags:
nanofabrication
photochemistry
photonics
mathematical-physics
optimal-control
reaction-diffusion
File size: 3,307 Bytes
d980d12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #!/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()
|