From 243e44d68b2a078e2535ab2bf8f12df1ddb892d4 Mon Sep 17 00:00:00 2001 From: Daniel Brown <ddb@star.sr.bham.ac.uk> Date: Wed, 11 Dec 2013 15:29:39 +0000 Subject: [PATCH] changing append to extend for adding base class attribute code. Also adding real and imag properties to the gauss_param object to reflect that it is a complex number --- pykat/components.py | 4 ++-- pykat/finesse.py | 3 ++- pykat/utilities/optics/gaussian_beams.py | 12 +++++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pykat/components.py b/pykat/components.py index d8b01e5..1d3506c 100644 --- a/pykat/components.py +++ b/pykat/components.py @@ -125,12 +125,12 @@ class Component(object): """Parses Finesse syntax""" raise NotImplementedError("This function is not implemented") - @staticmethod @abc.abstractmethod def getFinesseText(self): """ Base class for individual Finesse optical components """ raise NotImplementedError("This function is not implemented") + @abc.abstractmethod def getQGraphicsItem(self): return None @@ -272,7 +272,7 @@ class mirror(AbstractMirrorComponent): self.name, self.R, self.T, self.phi, self.nodes[0].name, self.nodes[1].name)) - rtn.append(super(mirror, self).getAttributeText()) + rtn.extend(super(mirror, self).getAttributeText()) return rtn diff --git a/pykat/finesse.py b/pykat/finesse.py index 1ab2361..2301c60 100644 --- a/pykat/finesse.py +++ b/pykat/finesse.py @@ -446,7 +446,8 @@ class kat(object): if txt != None: if isinstance(txt,list): - for t in txt: out.append(t + "\n") + for t in txt: + out.append(t + "\n") else: out.append(txt + "\n") diff --git a/pykat/utilities/optics/gaussian_beams.py b/pykat/utilities/optics/gaussian_beams.py index f0e9f95..93dd035 100644 --- a/pykat/utilities/optics/gaussian_beams.py +++ b/pykat/utilities/optics/gaussian_beams.py @@ -131,4 +131,14 @@ class gauss_param(object): return gauss_param(self.__lambda, self.__nr, -self.__q) def __eq__(self, q): - return complex(q) == self.__q \ No newline at end of file + return complex(q) == self.__q + + @property + def real(self): return self.__q.real + @real.setter + def real(self, value): self.__q.real = SIfloat(value) + + @property + def imag(self): return self.__q.imag + @imag.setter + def imag(self, value): self.__q.imag = SIfloat(value) \ No newline at end of file -- GitLab