Commit ee9aae95 authored by Sean Leavey's avatar Sean Leavey
Browse files

Added isolator component

parent c8ceb252
...@@ -16,6 +16,7 @@ l l1 1 0 0 n1 ...@@ -16,6 +16,7 @@ l l1 1 0 0 n1
s s1 10 1 n1 n2 s s1 10 1 n1 n2
m m1 1 0 0 n2 n3 m m1 1 0 0 n2 n3
gr4 grating 1500 n4 n5 n6 n7 gr4 grating 1500 n4 n5 n6 n7
isol isolator 60 n8 n9
pd refl n2 pd refl n2
......
...@@ -368,9 +368,9 @@ class space(Component): ...@@ -368,9 +368,9 @@ class space(Component):
values.pop(0) # remove initial value values.pop(0) # remove initial value
if len(values) == 5: if len(values) == 5:
return space(values[0],values[3],values[4],L=values[1],n=values[2]) return space(values[0], values[3], values[4], values[1], values[2])
elif len(values) == 4: elif len(values) == 4:
return space(values[0],values[2],values[3],L=values[1]) return space(values[0], values[2], values[3], values[1])
else: else:
raise exceptions.RuntimeError("Space Finesse code format incorrect '{0}'".format(text)) raise exceptions.RuntimeError("Space Finesse code format incorrect '{0}'".format(text))
...@@ -519,6 +519,43 @@ class grating(Component): ...@@ -519,6 +519,43 @@ class grating(Component):
self._QItem = pykat.gui.graphics.SpaceQGraphicsItem(self) # TODO: make SVG graphic for grating self._QItem = pykat.gui.graphics.SpaceQGraphicsItem(self) # TODO: make SVG graphic for grating
return self._QItem return self._QItem
class isolator(Component):
def __init__(self, name, node1, node2, S = 0):
Component.__init__(self, name)
self._requested_node_names.append(node1)
self._requested_node_names.append(node2)
self.__S = SIfloat(S)
@property
def S(self): return Param('S', self.__S)
@S.setter
def S(self, value): self.__S = SIfloat(value)
@staticmethod
def parseFinesseText(text):
values = text.split(" ")
if values[0] != "isol":
raise exceptions.RuntimeError("'{0}' not a valid Finesse isolator command".format(text))
values.pop(0) # remove initial value
if len(values) == 4:
return isolator(values[0], values[2], values[3], values[1])
else:
raise exceptions.RuntimeError("Isolator Finesse code format incorrect '{0}'".format(text))
def getFinesseText(self):
return 'isol {0} {1} {2} {3}'.format(self.name, self.S, self.nodes[0].name, self.nodes[1].name)
def getQGraphicsItem(self):
if self._QItem == None:
self._QItem = pykat.gui.graphics.SpaceQGraphicsItem(self) # TODO: make isolator graphic
return self._QItem
class laser(Component): class laser(Component):
def __init__(self,name,node,P=1,f_offset=0,phase=0): def __init__(self,name,node,P=1,f_offset=0,phase=0):
......
...@@ -207,6 +207,8 @@ class kat(object): ...@@ -207,6 +207,8 @@ class kat(object):
obj = pykat.components.beamSplitter.parseFinesseText(line) obj = pykat.components.beamSplitter.parseFinesseText(line)
elif(first[0:2] == "gr"): elif(first[0:2] == "gr"):
obj = pykat.components.grating.parseFinesseText(line) obj = pykat.components.grating.parseFinesseText(line)
elif(first[0:4] == "isol"):
obj = pykat.components.isolator.parseFinesseText(line)
elif(first[0:2] == "pd"): elif(first[0:2] == "pd"):
obj = pykat.detectors.photodiode.parseFinesseText(line) obj = pykat.detectors.photodiode.parseFinesseText(line)
elif(first == "xaxis" or first == "x2axis" or first == "xaxis*" or first == "x2axis*"): elif(first == "xaxis" or first == "x2axis" or first == "xaxis*" or first == "x2axis*"):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment