test_fsig.py 997 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from pykat import finesse
from pykat.detectors import *
from pykat.components import *
from pykat.commands import *
from pykat.structs import *

import numpy as np
import pylab as pl

code = """
l l1 2 0 n1
m m1 0.99 0.01 0 n1 n2
s cav1 1200 n2 n3
m m2 0.99 0.01 -0.1 n3 n4

attr m2 m 1  # mech sus1

18
19
ad up_refl $fs n1
ad low_refl $fs n1
20
21
22
23
24
25

qd refl_A 0 0 n1
qd refl_Q 0 90 n1
qd tran_A 0 0 n4
qd tran_Q 0 90 n4

26
27
qnoised qnd 1 $fs max n4
qshot   qsd 1 $fs max n4
28

29
pd1 p1 $fs max n4
30

31
fsig noise l1 amp 1 0
32
33
34
35
"""

kat = finesse.kat(kat_code=code)

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# kat.signals.apply(kat.m2.z, 1.0, 0.0)
# kat.yaxis = "re:im"
# kat.add(xaxis('log', [1, 1000], kat.signals.f, 1000))
#
# out = kat.run(printout=0, printerr=0)
#
# a_up = out[kat.up_refl]
# a_lo = out[kat.low_refl]
#
# pl.figure(1)
# ax = pl.subplot(111)
# pl.grid()
# ax.loglog(out.x, abs(a_up))
# ax = ax.twinx()
# ax.plot(out.x, np.rad2deg(np.angle(a_up)), 'r')
# pl.xlabel(out.xlabel)

#pl.show()
print(kat.generateKatScript())
kat.remove(kat.signals)