Commit 85a688f2 authored by Andreas Freise's avatar Andreas Freise
Browse files

Merge branch 'master' of gitlab.aei.uni-hannover.de:finesse/pykat

parents 8eee71ee 7d635b06
......@@ -466,12 +466,8 @@ class xaxis(Command):
Command.__init__(self, axis_type, True)
self._axis_type = axis_type
self.x = putter("x1", self)
self.mx = putter("mx1", self)
self._putters.append(self.x)
self._putters.append(self.mx)
self._set_variables()
if scale == "lin":
scale = Scale.linear
......@@ -508,6 +504,13 @@ class xaxis(Command):
self.__param = param
self.__comp = param._owner()
def _set_variables(self):
self.x = putter("x1", self)
self.mx = putter("mx1", self)
self._putters.append(self.x)
self._putters.append(self.mx)
@property
def param(self): return self.__param
@param.setter
......@@ -549,12 +552,14 @@ class xaxis(Command):
class x2axis(xaxis):
def __init__(self, scale, limits, param, steps, comp=None, axis_type="x2axis"):
xaxis.__init__(self, scale, limits, param, steps, comp=comp, axis_type=axis_type)
def _set_variables(self):
self.x = putter("x2", self)
self.mx = putter("mx2", self)
self._putters.append(self.x)
self._putters.append(self.mx)
@staticmethod
def parseFinesseText(text):
values = text.split()
......
......@@ -1022,6 +1022,49 @@ class isolator(Component):
self._svgItem = pykat.gui.graphics.ComponentQGraphicsItem(":/resources/isolator.svg", self ,[(-4,15,self.nodes[0]), (14,15,self.nodes[1]), (14,24,self.nodes[2])])
return self._svgItem
class isolator1(Component):
def __init__(self, name, node1, node2, node3, node4):
"""
Creates a 4-port isolator component.
"""
Component.__init__(self, name)
self._requested_node_names.append(node1)
self._requested_node_names.append(node2)
self._requested_node_names.append(node3)
self._requested_node_names.append(node4)
self._svgItem = None
@staticmethod
def parseFinesseText(text):
values = text.split()
if values[0] != "isol1":
raise pkex.BasePyKatException("'{0}' not a valid Finesse isolator command".format(text))
values.pop(0) # remove initial value
if len(values) == 5:
return isolator1(values[0], values[1], values[2], values[3], values[4])
else:
raise pkex.BasePyKatException("Isolator1 Finesse code format incorrect '{0}'".format(text))
def getFinesseText(self):
rtn = ['isol1 {0} {1} {2} {3} {4}'.format(self.name, self.nodes[0].name,
self.nodes[1].name, self.nodes[2].name,
self.nodes[3].name)]
for p in self._params:
rtn.extend(p.getFinesseText())
return rtn
class lens(Component):
def __init__(self, name, node1, node2, f=1, p=None):
......
......@@ -471,6 +471,7 @@ class katRun(object):
if ylim is not None:
pyplot.ylim(ylim[0],ylim[1])
pyplot.margins(0, 0.05)
pyplot.tight_layout()
if legend:
......@@ -1112,6 +1113,8 @@ class kat(object):
obj = pykat.components.beamSplitter.parseFinesseText(line)
elif(first[0:2] == "gr"):
obj = pykat.components.grating.parseFinesseText(line)
elif(first[0:5] == "isol1"):
obj = pykat.components.isolator1.parseFinesseText(line)
elif(first[0:4] == "isol"):
obj = pykat.components.isolator.parseFinesseText(line)
elif(first[0:4] == "lens"):
......
Markdown is supported
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