diff --git a/bin/test_fsig.py b/bin/test_fsig.py index f55e828c645cb585fbe0bfce7159f179104c87bd..9fc47b5f150ed9a87fceb6a1300e213b1179e263 100644 --- a/bin/test_fsig.py +++ b/bin/test_fsig.py @@ -27,10 +27,14 @@ put up_refl f $x1 put low_refl f $mx1 yaxis log re:im + +fsig noise 9 """ kat = finesse.kat(kat_code=code) +kat.removeLine("fsig noise 9") + kat.signals.apply(kat.l1.P, 1, 0) kat.signals.apply(kat.m1.phi, 1, 90) @@ -48,3 +52,5 @@ pl.xlabel(out.xlabel) pl.title("Reflection quadratures with no relative carrier phase") pl.legend(["Amplitude","Phase"]) #pl.show() + +kat.remove(kat.signals) \ No newline at end of file diff --git a/pykat/finesse.py b/pykat/finesse.py index 1483c250edbb29164e5a316a5caf49cbc36da772..d793e7291dd3ed364a8ecde25524c7bc95fd1643 100644 --- a/pykat/finesse.py +++ b/pykat/finesse.py @@ -39,6 +39,7 @@ import ctypes import ctypes.util import collections import re +import copy from collections import namedtuple, OrderedDict @@ -260,6 +261,9 @@ class Signals(object): def removed(self): return self.__removed def remove(self): + self.__signal._kat.remove(self) + + def _on_remove(self): if self.__removed: raise pkex.BasePyKatException("Signal {0} has already been marked as removed".format(self.name)) else: @@ -311,20 +315,20 @@ class Signals(object): def remove(self): for t in self.targets: t.remove() - + + del self.targets[:] + @property def f(self): return self.__f @f.setter def f(self,value): self.__f.value = SIfloat(value) def __init__(self, kat): - if kat == None: - raise pkex.BasePyKatException("kat object must be specified") self.targets = [] self._params = [] - self.__kat = kat self.__f = Param("f", self, 1) - + self._kat = kat + def _register_param(self, param): self._params.append(param) @@ -1073,7 +1077,7 @@ class kat(object): elif isinstance(obj, pykat.finesse.Signals): obj.remove() elif isinstance(obj, pykat.finesse.Signals.fsig): - obj.remove() + obj._on_remove() for b in self.__blocks: if obj in self.__blocks[b].contents: