tf_cavity.py 1.52 KB
#!/usr/bin/python
# -*- coding: utf-8 -*-

'''TF of FP cavity in reflection

                                   ----------
 X(s)          -----               | -tau⋅s |
-------------->|1-R|----->(X)----->|e       |------
       |       -----       ^       ----------     |
       |                   |                      |
       |                   |                      V
     ----                ----                   ----
     |-R|                |-R|                   |-R|
     ----                ----                   ----
       |                   ^                      |
       |                   |       ----------     |
 Y(s)  V       -----       |       | -tau⋅s |     |
<-----(X)<-----|1-R|<--------------|e       |<-----
               -----               ----------

'''

from sympy import *

init_printing()

w, r, L, c = symbols('omega, r, L, c', imaginary=False, real=True)

tau = L/c
fsr = 1/(2*tau)

#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))

dw = symbols('dw', imaginary=False, real=True)
Fr_dw_0 = simplify(simplify(Fr(2*pi*fsr+dw).series(dw, 0, 2).expand().coeff(dw))*dw)

'''results

         ⎛      -2.0⋅ⅈ⋅L⋅ω ⎞
         ⎜      ───────────⎟
         ⎜           c     ⎟
       r⋅⎝-1 + ℯ           ⎠
F(w) = ─────────────────────
             -2.0⋅ⅈ⋅L⋅ω
             ───────────
          2       c
       - r ⋅ℯ            + 1

'''