Commit bd3099d0023b0610c0faf0d4077f6fd1a9068bf3

Authored by bmarechal
1 parent 2ae5099ce4
Exists in master

add PDH signal

Showing 1 changed file with 38 additions and 18 deletions Side-by-side Diff

tf_cavity/tf_cavity_num.py
... ... @@ -55,44 +55,64 @@
55 55 from numpy import *
56 56 import matplotlib.pyplot as plt
57 57  
58   -r = 0.99
  58 +r = 0.99998
59 59 L = 140e-3
60 60 c = 299792458
61 61  
62 62 tau = L/c
63 63 fsr = 1/(2*tau)
  64 +finesse = pi*r/(1-r**2)
  65 +print('Finesse = %f\n FSR = %f\n FSR/Finesse = %f'%(finesse, fsr, fsr/finesse))
64 66  
65 67 f0 = (193e12//fsr)*fsr
66 68 f = linspace(f0-0.1*fsr, f0+0.1*fsr, 1e5)
67 69  
  70 +fm = 30e6
  71 +
68 72 #TF of cavity in reflection
69 73 def Fr(w):
70 74 s = 1j*w
71 75 return r*(exp(-2*tau*s)-1)/(1-r**2*exp(-2*tau*s))
72 76  
73 77 G = Fr(2*pi*f)
  78 +Glsb = Fr(2*pi*(f-fm))
  79 +Gusb = Fr(2*pi*(f+fm))
74 80  
  81 +#plot setup
  82 +fig, axarr = plt.subplots(3, 2, sharex='col')
  83 +
75 84 #plot bode of F(w)
76   -ax1 = plt.subplot(3, 1, 1)
77   -ax1.set_ylabel('Magnitude')
78   -ax1.plot(f, abs(G))
79   -ax1.grid()
  85 +axarr[0, 1].set_ylabel('Magnitude')
  86 +#axarr[0, 1].set_xlabel('Frequency (Hz)')
  87 +axarr[0, 1].plot(f, abs(G))
  88 +axarr[0, 1].grid()
  89 +axarr[1, 1].set_ylabel('Phase (deg)')
  90 +#axarr[1, 1].set_xlabel('Frequency (Hz)')
  91 +axarr[1, 1].plot(f, angle(G, deg = True))
  92 +axarr[1, 1].grid()
80 93  
81   -ax2 = plt.subplot(3, 1, 2, sharex = ax1)
82   -ax2.set_ylabel('Phase (deg)')
83   -ax2.set_xlabel('omega (rad.s$^{-1}$)')
84   -ax2.plot(f, angle(G, deg = True))
85   -ax2.grid()
  94 +#PDH signal
  95 +iG = (G*Gusb.conjugate()-G.conjugate()*Glsb).imag
  96 +axarr[2, 1].set_ylabel('epsillon normalized')
  97 +axarr[2, 1].set_xlabel('Frequency (Hz)')
  98 +axarr[2, 1].xaxis.set_label_coords(0.5, -0.3)
  99 +axarr[2, 1].plot(f, iG)
  100 +axarr[2, 1].grid()
86 101  
87 102  
88 103 #nyquist
89   -ax3 = plt.subplot(3, 1, 3)
90   -ax3.set_ylabel('$j\omega$')
91   -ax3.set_xlabel('$\sigma$')
92   -ax3.plot(real(G), imag(G))
93   -ax3.grid()
94   -ax3.axis('equal')
  104 +axarr[2, 0].set_ylabel('$j\omega$')
  105 +axarr[2, 0].set_xlabel('$\sigma$')
  106 +axarr[2, 0].plot(real(G), imag(G))
  107 +axarr[2, 0].grid()
  108 +axarr[2, 0].axis('equal')
  109 +axarr[2, 0].set_xlim([-1.1, 1.1])
95 110  
  111 +#layout
  112 +axarr[0, 0].axis('off')
  113 +axarr[1, 0].axis('off')
  114 +fig.subplots_adjust(wspace=0.5)
  115 +plt.tight_layout()
96 116 #plt.savefig('fig.pgf')
97 117 plt.show()
98 118