"""Generate gaussian-field-power-width.png in cwd (_media). Tested with Python 3.14.4 and Matplotlib 3.10.7; NumPy/Matplotlib dependencies are recorded in the repository pyproject.toml. """ import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np t=np.linspace(-1.5,1.5,901) fig,axes=plt.subplots(1,2,figsize=(7,3.2),dpi=100,layout='constrained') for ax,exponent,half,color,title,label,width in [ (axes[0],2*np.log(2),np.sqrt(2)/2,'#b35806','Field-envelope magnitude',r'$|A(t)|/|A(0)|$',r'$\tau_E=\sqrt{2}\,\tau_P$'), (axes[1],4*np.log(2),.5,'#2166ac','Optical power',r'$P(t)/P(0)$',r'FWHM $=\tau_P$'), ]: ax.plot(t,np.exp(-exponent*t*t),color=color,linewidth=2) ax.axhline(.5,color='gray',linestyle=':',linewidth=1) ax.vlines([-half,half],0,.5,color=color,linestyle='--',linewidth=1) ax.scatter([-half,half],[.5,.5],color=color,zorder=3) ax.set(xlim=(-1.5,1.5),ylim=(0,1.05),xlabel=r'Time / power FWHM ($t/\tau_P$)',ylabel=label,title=title) ax.set_xticks([-1.5,-1,-.5,0,.5,1,1.5]) ax.text(0,.88,width,ha='center',fontsize=11,bbox={'facecolor':'white','edgecolor':'none','alpha':.85}) ax.grid(alpha=.15) fig.savefig('gaussian-field-power-width.png',facecolor='white',dpi=100) plt.close(fig)