Commit 7d635b06 authored by Daniel Brown's avatar Daniel Brown
Browse files

Fixing x2axis variables, adding new isolator

parent 36b80188
......@@ -467,11 +467,7 @@ class xaxis(Command):
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,6 +552,8 @@ 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)
......
......@@ -1023,6 +1023,49 @@ class isolator(Component):
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):
Component.__init__(self, name)
......
......@@ -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"):
......
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