From 51d0dbcdfeca4cdd6b1801fa943cf8c71058289b Mon Sep 17 00:00:00 2001
From: Daniel Brown <ddb@star.sr.bham.ac.uk>
Date: Wed, 28 Sep 2016 14:58:08 -0700
Subject: [PATCH] adding setRTL method for BS and mirror, fixing db plotting
 with out.plot

---
 pykat/components.py |  7 ++++++-
 pykat/finesse.py    | 14 ++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/pykat/components.py b/pykat/components.py
index 3606f67..7b962bc 100644
--- a/pykat/components.py
+++ b/pykat/components.py
@@ -334,7 +334,12 @@ class AbstractMirrorComponent(Component):
         self.__Fs1 = Param("s1", self, None, canFsig=True, isPutable=False, isPutter=False, isTunable=False, fsig_name="s1")
             
         self._default_fsig_param = self.__phi
-        
+    
+    def setRTL(self, R=None, T=None, L=None):
+        if R is not None: self.R.value = R
+        if T is not None: self.T.value = T
+        if L is not None: self.L.value = L
+    
     @property
     def z(self): return self.__z
     @property
diff --git a/pykat/finesse.py b/pykat/finesse.py
index b535e18..3aaf92c 100644
--- a/pykat/finesse.py
+++ b/pykat/finesse.py
@@ -331,6 +331,8 @@ class katRun(object):
         if kat.noxaxis == True:
             raise  pkex.BasePyKatException("This kat object has noxaxis=True, so there is nothing to plot.")
 
+        original_yaxis = kat.yaxis
+
         if yaxis is not None:
             kat.yaxis = yaxis
 
@@ -367,7 +369,11 @@ class katRun(object):
             
             dual_plot = True
         elif "db:deg" in kat.yaxis:
-            _func1 = lambda x: 10*np.log10(x)
+            if "db" not in original_yaxis:
+                _func1 = lambda x: 10*np.log10(x)
+            else:
+                _func1 = lambda x: x
+                
             _func2 = lambda x: np.rad2deg(np.angle(x))
 
             plot_cmd1 = plot_cmd
@@ -379,7 +385,11 @@ class katRun(object):
             _func1 = np.real
             plot_cmd1 = plot_cmd
         elif "db" in kat.yaxis:
-            _func1 = lambda x: 10*np.log10(x)
+            if "db" not in original_yaxis:
+                _func1 = lambda x: 10*np.log10(x)
+            else:
+                _func1 = lambda x: x
+                
             plot_cmd1 = plot_cmd
         elif "deg" in kat.yaxis:
             _func1 = lambda x: np.rad2deg(np.angle(x))
-- 
GitLab