Commit c8d9f73b authored by Daniel Brown's avatar Daniel Brown
Browse files

Fixing trace data not using correct wavelength, adding in new squeezer component parsing

parent 7108068f
...@@ -3,7 +3,7 @@ from __future__ import division ...@@ -3,7 +3,7 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
from __future__ import unicode_literals from __future__ import unicode_literals
__version__ = "1.0.10" __version__ = "1.0.11"
# This flag is used to switch on the gui features in pkat at import time # This flag is used to switch on the gui features in pkat at import time
USE_GUI = False USE_GUI = False
......
...@@ -1327,7 +1327,7 @@ class laser(Component): ...@@ -1327,7 +1327,7 @@ class laser(Component):
return self._svgItem return self._svgItem
class squeezer(Component): class squeezer(Component):
def __init__(self, name, node, f=0, db=0, angle=0, phase=0): def __init__(self, name, node, f=0, db=0, angle=0, phase=0, entangled_carrier=False):
Component.__init__(self,name) Component.__init__(self,name)
self._requested_node_names.append(node) self._requested_node_names.append(node)
...@@ -1337,6 +1337,7 @@ class squeezer(Component): ...@@ -1337,6 +1337,7 @@ class squeezer(Component):
self.__db = Param("db", self, SIfloat(db), canFsig=False, fsig_name="r") self.__db = Param("db", self, SIfloat(db), canFsig=False, fsig_name="r")
self.__angle = Param("angle", self, SIfloat(angle), canFsig=False, fsig_name="angle") self.__angle = Param("angle", self, SIfloat(angle), canFsig=False, fsig_name="angle")
self._svgItem = None self._svgItem = None
self.entangled_carrier = entangled_carrier
@property @property
def db(self): return self.__db def db(self): return self.__db
...@@ -1364,19 +1365,26 @@ class squeezer(Component): ...@@ -1364,19 +1365,26 @@ class squeezer(Component):
@staticmethod @staticmethod
def parseFinesseText(text): def parseFinesseText(text):
values = text.split() values = text.split()
if values[0] != "sq": if values[0][:2] != "sq":
raise pkex.BasePyKatException("'{0}' not a valid Finesse squeezer command".format(text)) raise pkex.BasePyKatException("'{0}' not a valid Finesse squeezer command".format(text))
entangled_carrier = values[0].endswith("*")
values.pop(0) # remove initial value values.pop(0) # remove initial value
if len(values) == 5: if len(values) == 5:
return squeezer(values[0], values[4], f=values[1], db=values[2], angle=values[3]) return squeezer(values[0], values[4], f=values[1],
db=values[2], angle=values[3],
entangled_carrier=entangled_carrier)
else: else:
raise exceptions.FinesseParse("Squeezer Finesse code format incorrect '{0}'".format(text)) raise exceptions.FinesseParse("Squeezer Finesse code format incorrect '{0}'".format(text))
def getFinesseText(self): def getFinesseText(self):
rtn = ['sq {0} {1} {2} {3} {4}'.format(self.name, self.f.value, self.db.value, self.angle.value, self.nodes[0].name)] if self.entangled_carrier:
rtn = ['sq* {0} {1} {2} {3} {4}'.format(self.name, self.f.value, self.db.value, self.angle.value, self.nodes[0].name)]
else:
rtn = ['sq {0} {1} {2} {3} {4}'.format(self.name, self.f.value, self.db.value, self.angle.value, self.nodes[0].name)]
for p in self._params: for p in self._params:
rtn.extend(p.getFinesseText()) rtn.extend(p.getFinesseText())
......
...@@ -1106,7 +1106,7 @@ class kat(object): ...@@ -1106,7 +1106,7 @@ class kat(object):
obj = pykat.components.space.parseFinesseText(line) obj = pykat.components.space.parseFinesseText(line)
elif(first == "l"): elif(first == "l"):
obj = pykat.components.laser.parseFinesseText(line) obj = pykat.components.laser.parseFinesseText(line)
elif(first == "sq"): elif(first[:2] == "sq"):
obj = pykat.components.squeezer.parseFinesseText(line) obj = pykat.components.squeezer.parseFinesseText(line)
elif(first[0:2] == "bs"): elif(first[0:2] == "bs"):
obj = pykat.components.beamSplitter.parseFinesseText(line) obj = pykat.components.beamSplitter.parseFinesseText(line)
...@@ -1681,7 +1681,9 @@ class kat(object): ...@@ -1681,7 +1681,9 @@ class kat(object):
qx = spqx[0].split("=")[1].replace('i','j').replace(' ','') qx = spqx[0].split("=")[1].replace('i','j').replace(' ','')
qy = spqy[0].split("=")[1].replace('i','j').replace(' ','') qy = spqy[0].split("=")[1].replace('i','j').replace(' ','')
traceData[-1][node_name] = (pykat.beam_param(q=complex(qx)), pykat.beam_param(q=complex(qy)), component_name) traceData[-1][node_name] = (pykat.beam_param(q=complex(qx), wavelength=self.lambda0),
pykat.beam_param(q=complex(qy), wavelength=self.lambda0),
component_name)
finally: finally:
ifile.close() ifile.close()
......
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