PDH.py 2.4 KB
#!/usr/bin/python
# -*- coding: utf-8 -*-

'''Pound-Drever-Hall setup

            -----      ---
------------|EOM|------|/|-----(   )
 w_laser    -----      ---     cavity
              ^         |
              |         U
              |         |
              |         v
              |------->(X) π/2
           (w_pdh)      |
                      -----
                      |LPF|
                      -----
                        |
                        v   eps_pdh

'''

from time import time
tic = time()

from sympy import *
from sympy.simplify.fu import *

init_printing()

#constants
E0, J0, J1, w_laser, w_pdh, t, c = symbols('E0, J0, J1, omega_laser, Omega_pdh, t, c', imaginary=False, real=True)

'''laser and phase-mod laser
E_laser = E0*exp(I*(w_laser*t))

E_inc =                             \
E0*(                                \
  J0*exp(I*((w_laser      )*t))     \
+ J1*exp(I*((w_laser+w_pdh)*t))     \
- J1*exp(I*((w_laser-w_pdh)*t))     \
   )'''

#reflection near resonance
dnu, w_cav = symbols('delta_nu, omega_cav', imaginary=False, real=True)
def F(phi):
    dw = phi.diff(t) - w_cav
    return -(I/pi)*(dw/dnu)

#reflected phase-mod laser
v_x, d_x = symbols('v_x, delta_x', imaginary=False, real=True)
dx = v_x*t + d_x
E_ref =                                                              \
E0*(                                                                 \
   F(           (w_laser      )*t -   w_laser*dx/c )      \
    *J0*exp(I*( (w_laser      )*t - 2*w_laser*dx/c ) )    \
+ -1*J1*exp(I*( (w_laser+w_pdh)*t - 2*w_laser*dx/c ) )    \
- -1*J1*exp(I*( (w_laser-w_pdh)*t - 2*w_laser*dx/c ) )    \
   )

#intensity of reflected phase-mod laser
I_pdh = abs(E_ref)**2
I_pdh = expand(TR8(expand(expand_complex(I_pdh))))

#demodulation of I_pdh at Omega_pdh
kphipdh = symbols('k_phi_pdh', imaginary=False, real=True)
eps_pdh = 2 * kphipdh * I_pdh * cos(w_pdh*t-pi/2)
eps_pdh = expand(TR8(TR7(expand(eps_pdh))))

toc = time()
print('Elapsed time : %fs'%(toc-tic))

'''low-passed demodulated I_pdh signal

eps_pdh =
       2               ⎛                  ω_laser   ⎞
   4⋅E₀ ⋅J₀⋅J₁⋅k_φ_pdh⋅⎜ω_laser - ω_cav - ───────⋅vₓ⎟
                       ⎝                     c      ⎠
 + ──────────────────────────────────────────────────
                         π⋅δ_ν
'''