Download plot_disk_bound.py from PureOne/neoryae-aegis: direct link, hf CLI and curl.
- Browser
- Download file 3.58 kB
-
https://huggingface.co/datasets/PureOne/neoryae-aegis/resolve/main/plot_disk_bound.py
- Command line
-
hf download hf://datasets/PureOne/neoryae-aegis/plot_disk_bound.py
-
curl -L -o plot_disk_bound.py https://huggingface.co/datasets/PureOne/neoryae-aegis/resolve/main/plot_disk_bound.py
3.58 kB
| """Scientific summary of the proved rotation bound; plots are not certification.""" | |
| from pathlib import Path | |
| from fractions import Fraction | |
| import json | |
| import numpy as np | |
| import matplotlib | |
| matplotlib.use('Agg') | |
| import matplotlib.pyplot as plt | |
| def main(): | |
| root=Path(__file__).parent | |
| cert=json.loads((root/'ROTATION_BOUND_CERTIFICATE.json').read_text()) | |
| pars=cert['parameters'] | |
| r,t,d,g=[float(Fraction(pars[k])) for k in ('r','t','delta','kappa')] | |
| a=1+r | |
| w=np.sqrt(a*a-t*t) | |
| C,S=np.cos(np.pi/8),np.sin(np.pi/8) | |
| A,H=2*(t*S-w*C),2*(t*C+w*S) | |
| eta0=(1-t)/2 | |
| q=lambda z:A*A*z*z/(4*a*(A*A+(z+H)**2)) | |
| reward=lambda eta:q(4*eta/3)+q(2*eta/3) | |
| derivative=float(cert['packing_reward_derivative_at_eta0'][0]) | |
| plt.rcParams.update({'font.size':10,'axes.spines.top':False, | |
| 'axes.spines.right':False,'figure.facecolor':'white'}) | |
| fig,axes=plt.subplots(1,3,figsize=(13.2,4.2),constrained_layout=True) | |
| ax=axes[0] | |
| angles=np.linspace(0,2*np.pi,1000) | |
| ax.fill(np.cos(angles),np.sin(angles),color='#edf2f7') | |
| for rotation,color,alpha in [(0,'#1591a2',.75),(np.pi/6,'#d48332',.55)]: | |
| for k in range(4): | |
| phi=np.pi/4+k*np.pi/2+rotation | |
| u=np.array([np.cos(phi),np.sin(phi)]) | |
| v=np.array([-np.sin(phi),np.cos(phi)]) | |
| ss=np.linspace(t,1,100) | |
| zz=np.sqrt(a*a-ss*ss) | |
| pts=np.r_[ss[:,None]*u+zz[:,None]*v,ss[::-1,None]*u-zz[::-1,None]*v] | |
| ax.fill(pts[:,0],pts[:,1],color=color,alpha=alpha) | |
| ax.plot(np.cos(angles),np.sin(angles),color='#1e3a5f',lw=1.2) | |
| ax.set(xlim=(-1.18,1.18),ylim=(-1.18,1.18),aspect='equal', | |
| title='A. Average over all cap rotations') | |
| ax.set_xticks([-1,0,1]);ax.set_yticks([-1,0,1]) | |
| ax.text(.5,.53,r'Point membership $\leq 2\arccos t$',transform=ax.transAxes, | |
| ha='center',fontsize=10) | |
| ax.text(.5,.41,'Two example orientations shown',transform=ax.transAxes, | |
| ha='center',fontsize=8,color='#526276') | |
| ax.text(.5,-.1,'Cap regions; no candidate barrier shown',transform=ax.transAxes, | |
| ha='center',fontsize=8,color='#526276') | |
| ax=axes[1] | |
| vals=[1.076457,d*1e6] | |
| ax.bar([0,1],vals,color=['#94a3b8','#1591a2'],width=.58) | |
| ax.set_xticks([0,1],['Published parameter\nchoice (2026)','Rotation certificate\nhere']) | |
| ax.set(ylabel=r'Excess above $\pi$, in units of $10^{-6}$',ylim=(0,9.7), | |
| title='B. Complete-barrier lower bound') | |
| for x,y in enumerate(vals):ax.text(x,y+.14,f'{y:.7f}',ha='center',fontsize=9) | |
| ax.text(.04,.96,f'Excess ratio: {vals[1]/vals[0]:.3f}'+r'$\times$', | |
| transform=ax.transAxes,va='top') | |
| ax=axes[2] | |
| x=np.linspace(0,1,501) | |
| U=np.pi*eta0*x | |
| nonlinear=g*reward(eta0-U/np.pi)/d | |
| linear=np.maximum(0,g*(reward(eta0)-derivative*U/np.pi)/d) | |
| ax.plot(x,nonlinear,color='#1591a2',lw=2.5,label='Nonlinear robust gain') | |
| ax.plot(x,linear,color='#d48332',lw=1.8,ls='--',label='Linear corollary (with zero)') | |
| ax.set(xlabel=r'Missed-line measure $U/(\pi\eta_0)$', | |
| ylabel=r'Gain over $L\geq\pi-U/2$, divided by $d$',ylim=(-.02,1.12), | |
| title='C. Robustness to incomplete coverage') | |
| ax.grid(alpha=.17);ax.legend(fontsize=8,loc='upper right') | |
| fig.suptitle(r'Rotation-averaged disk opacity: $L>\pi+'+f'{d*1e6:.7f}'+r'\times10^{-6}$', | |
| fontsize=16,fontweight='bold') | |
| for suffix in ('png','pdf'): | |
| fig.savefig(root/'figures'/f'disk_bound.{suffix}',dpi=180,bbox_inches='tight') | |
| plt.close(fig) | |
| if __name__=='__main__': | |
| main() | |