"""Uniform hot-wire line-average power transfer. Tested with Python 3.14, NumPy 2.3.5 and Matplotlib 3.10.7. The horizontal coordinate is length / spatial wavelength along the wire, not frequency / sample rate. Run via Make in the mirrored media working directory. """ from pathlib import Path import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np def power_transfer(length_over_wavelength): """Squared transfer of a uniform line average; np.sinc(x)=sin(pi*x)/(pi*x).""" return np.sinc(np.asarray(length_over_wavelength))**2 def main(): x = np.linspace(0, 2.5, 2001) fig, ax = plt.subplots(figsize=(8, 4.6), facecolor='white') ax.set_facecolor('white') ax.plot(x, power_transfer(x), color='#165f87', linewidth=2.4) points = [(.25, r'$\lambda_s=4\ell$', (.52, .91)), (.50, r'$\lambda_s=2\ell$', (.82, .53)), (1., r'$\lambda_s=\ell$', (1.35, .19))] for xx, label, text in points: yy = float(power_transfer(xx)) ax.plot(xx, yy, 'o', color='#a74716', markersize=6) ax.annotate(f'{label}\nPower fraction {yy:.3f}', xy=(xx, yy), xytext=text, fontsize=10, ha='left', arrowprops={'arrowstyle':'-', 'color':'#666666'}) ax.set(xlim=(0, 2.5), ylim=(-.025, 1.04), xlabel=r'Wire length / spatial wavelength, $\ell/\lambda_s$', ylabel=r'Power transfer $|H|^2$', title='Spatial averaging by an ideal finite-length hot wire') ax.set_xticks([0, .25, .5, 1, 1.5, 2, 2.5]) ax.grid(alpha=.20) ax.spines[['top', 'right']].set_visible(False) fig.text(.5, .025, 'Uniform linear averaging model; electronics are assumed ideal.', ha='center', fontsize=10) fig.subplots_adjust(left=.11, right=.98, bottom=.19, top=.88) fig.savefig(Path.cwd()/'hot-wire-spatial-transfer.png', dpi=110, facecolor='white') plt.close(fig) if __name__ == '__main__': main()