#!/usr/bin/env python3 """Static publication figures for the stated ideal models; no measured data.""" from pathlib import Path import math import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from reproduce import gibbs, entropy_prob, entropy_matched_gibbs, q_work, lhs_work ROOT = Path(__file__).resolve().parent OUT = ROOT / 'figures' OUT.mkdir(exist_ok=True) plt.rcParams.update({'font.family':'DejaVu Sans','font.size':10,'axes.spines.top':False, 'axes.spines.right':False,'savefig.dpi':190,'axes.titlesize':12}) blue, teal, red, gray = '#294F8C', '#008B8B', '#B7494B', '#788490' fig, axes = plt.subplots(1,2,figsize=(9.1,3.5),layout='constrained') for ax, energies, beta, name in zip(axes,[np.array([0,1]),np.array([0,1,2])],[1.,1.],['Two levels','Three levels']): tau=gibbs(energies,beta) entropy=entropy_prob(tau) infos=np.linspace(0,entropy,220) work=[] for info in infos: _,cold=entropy_matched_gibbs(energies,max(0,entropy-info)) work.append((tau-cold)@energies) ax.plot(infos,work,color=blue,lw=2.3,label='Exact attainable frontier') ax.plot(infos,infos/beta,color=gray,ls='--',label='Linear I / beta bound') ax.set(xlabel='Receiver information (nats)',ylabel='Average gross work (gap units)',title=name+'; beta = 1') ax.grid(alpha=.18) axes[0].legend(loc='upper left',fontsize=8) fig.suptitle('Finite thermal receivers: information does not supply unlimited work',fontsize=12) fig.savefig(OUT/'frontier.png') plt.close(fig) r,p,a,Gamma,v,tau=.6,.05,.02,1e4,2e8,5e-6 distance=np.linspace(0,12,350) q=(1-2*p)*np.exp(-Gamma*(distance*1000/v+tau)) theta=np.arctan2(q*np.sqrt(1-r*r),r) work=np.array([q_work(r,float(x)) for x in q]) bound=np.array([lhs_work(r,float(x)) for x in theta]) qmin=max(1/math.sqrt(2),math.sqrt(4*a*(r+a)/(1-r*r))) dmax=v*(math.log((1-2*p)/qmin)/Gamma-tau)/1000 fig,axes=plt.subplots(1,2,figsize=(9.1,3.6),layout='constrained') axes[0].plot(distance,work,color=blue,lw=2.3,label='Quantum gross work') axes[0].plot(distance,bound,color=teal,lw=1.8,label='LHS bound; same controls') axes[0].axhline(a,color=red,ls='--',label='Extraction cost') axes[0].set(xlabel='Distance (km)',ylabel='Energy / epsilon',title='Cost and certification are separate gates') axes[0].legend(fontsize=8) axes[1].plot(distance,q,color=blue,lw=2.3,label='Remaining correlation q') axes[1].axhline(qmin,color=red,ls='--',label='Joint threshold') axes[1].axvline(dmax,color=gray,ls=':',label=f'Distance gate: {dmax:.2f} km') axes[1].fill_between(distance,qmin,q,where=q>qmin,color=teal,alpha=.14) axes[1].set(xlabel='Distance (km)',ylabel='Correlation visibility',title='Strict operating window in a chosen model') axes[1].legend(fontsize=8) for ax in axes: ax.grid(alpha=.18) fig.suptitle('Illustration only: r=.6, p=.05, a=.02, Gamma=10,000 /s, overhead=5 us',fontsize=10) fig.savefig(OUT/'causal_window.png') plt.close(fig) u=np.linspace(.001,2.3,300) aa=np.cosh(2*u)/2 work=(aa-1/(4*aa))/2 bound=(aa-.5)/2 adv=(1-1/(2*aa))/4 fig,axes=plt.subplots(1,2,figsize=(9.1,3.4),layout='constrained') axes[0].plot(u,work,color=blue,lw=2.2,label='Displacement work') axes[0].plot(u,bound,color=teal,lw=1.8,label='Unsteerable benchmark') axes[0].set(xlabel='Squeezing parameter u',ylabel='Energy / (hbar omega)',title='Gross conditional work grows with energy') axes[1].plot(u,adv,color=blue,lw=2.2,label='Quantum excess') axes[1].axhline(.25,color=red,ls='--',label='Quarter-quantum ceiling') axes[1].set(xlabel='Squeezing parameter u',ylabel='Energy / (hbar omega)',title='Excess remains below a quarter quantum') for ax in axes: ax.legend(fontsize=8); ax.grid(alpha=.18) fig.savefig(OUT/'oscillator_scaling.png') plt.close(fig) print('Created three figures from ideal-model formulas.')