test_plot.py 916 Bytes
Newer Older
Daniel Brown's avatar
Daniel Brown committed
1
2
3
4
5
from pykat import finesse
from pykat.detectors import *
from pykat.components import *
from pykat.commands import *
from pykat.structs import *
6

Daniel Brown's avatar
Daniel Brown committed
7
8
9
import numpy as np
import pylab as pl

10
11
12
13
14
15
16
17
18
code = """
l l1 1 0 0 n1
s s1 10 1 n1 n2
m m1 0.5 0.5 0 n2 n3
s s2 10 1 n3 n4
m m2 0.5 0.5 0 n4 n5
s s3 10 1 n5 n6
"""

19
#kat = finesse.kat(katexe='/Users/adf/work/bin/kat')
Daniel Brown's avatar
Daniel Brown committed
20
kat = finesse.kat()
Daniel Brown's avatar
Daniel Brown committed
21

Daniel Brown's avatar
Daniel Brown committed
22
23
24
kat.parseCommands(code)

kat.add(cavity('cav1', 'm1', 'n3', 'm2', 'n4'))
Daniel Brown's avatar
Daniel Brown committed
25

26
27
28
kat.add(photodiode('pd_cav','n4'))
kat.add(photodiode('pd_ref','n2'))
kat.add(photodiode('pd_trs','n5'))
Daniel Brown's avatar
Daniel Brown committed
29

30
kat.add(xaxis("lin", [0, 360], kat.m2, kat.m2.phi, 100))
Daniel Brown's avatar
Daniel Brown committed
31
32
33
34
35
36
37
38

kat.m1.Rcx = -1000.0
kat.m1.Rcy = -1000.0
kat.m2.Rcx =  1000.0
kat.m2.Rcy =  1000.0

kat.maxtem = 0

39
out = kat.run(printout=0,printerr=0)
Daniel Brown's avatar
Daniel Brown committed
40

41
pl.figure()
42
43
pl.plot(out.x,out.y)
pl.xlabel(out.xlabel)
44
pl.ylabel("Intensity [W]")
45
pl.legend(out.ylabels)
46
pl.show()