From edc410115817d2f4fb042e3cfe45d974361090e2 Mon Sep 17 00:00:00 2001
From: Daniel Brown <ddb@star.sr.bham.ac.uk>
Date: Wed, 18 Dec 2013 19:53:30 +0000
Subject: [PATCH] adding more selection options for when 1d and 2d data is
 available for multiple outputs

---
 bin/test_plot.py | 4 ++--
 pykat/finesse.py | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/bin/test_plot.py b/bin/test_plot.py
index bb18630..cc54c7c 100644
--- a/bin/test_plot.py
+++ b/bin/test_plot.py
@@ -24,9 +24,10 @@ kat.parseCommands(code)
 
 kat.add(cavity('cav1', 'm1', 'n3', 'm2', 'n4'))
 
-kat.add(photodiode('pd_cav','n4',num_demods=1, demods=[1]))
 kat.add(photodiode('pd_ref','n2'))
 kat.add(photodiode('pd_trs','n5'))
+kat.add(photodiode('pd_cav','n4', num_demods=1, demods=[1]))
+
 
 kat.add(xaxis("lin", [0, 360], kat.m2, kat.m2.phi, 100))
 
@@ -41,7 +42,6 @@ out = kat.run(printout=0,printerr=0)
 
 pl.figure()
 pl.plot(out.x, out["pd_cav"])
-pl.plot(out.x, out["pd_ref"])
 pl.xlabel(out.xlabel)
 pl.ylabel("Intensity [W]")
 pl.legend(out.ylabels)
diff --git a/pykat/finesse.py b/pykat/finesse.py
index e2c8f51..5bbd06a 100644
--- a/pykat/finesse.py
+++ b/pykat/finesse.py
@@ -73,11 +73,13 @@ class katRun(object):
         idx = [i for i in range(len(self.ylabels)) if self.ylabels[i].split(" ")[0] == str(value)]
         
         if len(idx) == 1 and len(self.y.shape) == 1:
-            return self.y.squeeze()
+            return self.y
+        elif len(idx) > 0 and len(self.y.shape) == 1:
+            return self.y[idx]
         elif len(idx) > 0:
             return self.y[:,idx].squeeze()
         elif len(idx) == 1:
-            return self.y[idx].squeeze()
+            return self.y[:,idx].squeeze()
         else:
             raise  pkex.BasePyKatException("No output by the name {0} found".format(str(value)))
       
-- 
GitLab