From bd3099d0023b0610c0faf0d4077f6fd1a9068bf3 Mon Sep 17 00:00:00 2001 From: mer0m Date: Mon, 23 Jan 2017 09:40:13 +0100 Subject: [PATCH] add PDH signal --- tf_cavity/tf_cavity_num.py | 56 +++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/tf_cavity/tf_cavity_num.py b/tf_cavity/tf_cavity_num.py index 85fcc77..724f6d7 100644 --- a/tf_cavity/tf_cavity_num.py +++ b/tf_cavity/tf_cavity_num.py @@ -55,44 +55,64 @@ mpl.rcParams.update(pgf_with_latex) from numpy import * import matplotlib.pyplot as plt -r = 0.99 +r = 0.99998 L = 140e-3 c = 299792458 tau = L/c fsr = 1/(2*tau) +finesse = pi*r/(1-r**2) +print('Finesse = %f\n FSR = %f\n FSR/Finesse = %f'%(finesse, fsr, fsr/finesse)) f0 = (193e12//fsr)*fsr f = linspace(f0-0.1*fsr, f0+0.1*fsr, 1e5) +fm = 30e6 + #TF of cavity in reflection def Fr(w): s = 1j*w return r*(exp(-2*tau*s)-1)/(1-r**2*exp(-2*tau*s)) G = Fr(2*pi*f) +Glsb = Fr(2*pi*(f-fm)) +Gusb = Fr(2*pi*(f+fm)) -#plot bode of F(w) -ax1 = plt.subplot(3, 1, 1) -ax1.set_ylabel('Magnitude') -ax1.plot(f, abs(G)) -ax1.grid() +#plot setup +fig, axarr = plt.subplots(3, 2, sharex='col') -ax2 = plt.subplot(3, 1, 2, sharex = ax1) -ax2.set_ylabel('Phase (deg)') -ax2.set_xlabel('omega (rad.s$^{-1}$)') -ax2.plot(f, angle(G, deg = True)) -ax2.grid() +#plot bode of F(w) +axarr[0, 1].set_ylabel('Magnitude') +#axarr[0, 1].set_xlabel('Frequency (Hz)') +axarr[0, 1].plot(f, abs(G)) +axarr[0, 1].grid() +axarr[1, 1].set_ylabel('Phase (deg)') +#axarr[1, 1].set_xlabel('Frequency (Hz)') +axarr[1, 1].plot(f, angle(G, deg = True)) +axarr[1, 1].grid() + +#PDH signal +iG = (G*Gusb.conjugate()-G.conjugate()*Glsb).imag +axarr[2, 1].set_ylabel('epsillon normalized') +axarr[2, 1].set_xlabel('Frequency (Hz)') +axarr[2, 1].xaxis.set_label_coords(0.5, -0.3) +axarr[2, 1].plot(f, iG) +axarr[2, 1].grid() #nyquist -ax3 = plt.subplot(3, 1, 3) -ax3.set_ylabel('$j\omega$') -ax3.set_xlabel('$\sigma$') -ax3.plot(real(G), imag(G)) -ax3.grid() -ax3.axis('equal') - +axarr[2, 0].set_ylabel('$j\omega$') +axarr[2, 0].set_xlabel('$\sigma$') +axarr[2, 0].plot(real(G), imag(G)) +axarr[2, 0].grid() +axarr[2, 0].axis('equal') +axarr[2, 0].set_xlim([-1.1, 1.1]) + +#layout +axarr[0, 0].axis('off') +axarr[1, 0].axis('off') +fig.subplots_adjust(wspace=0.5) +plt.tight_layout() #plt.savefig('fig.pgf') plt.show() -- 2.16.4