From 0c880204b267c7e327e2ef7a62af8df0093a1217 Mon Sep 17 00:00:00 2001
From: Daniel Brown <ddb@star.sr.bham.ac.uk>
Date: Wed, 24 Jul 2013 17:48:24 +0100
Subject: [PATCH] Fixes to timing profile plotting

---
 bin/parse.kat      | 4 ++--
 bin/test_parser.py | 9 +++++----
 pykat/profiling.py | 5 +++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/bin/parse.kat b/bin/parse.kat
index 8b779fb..5bb4635 100644
--- a/bin/parse.kat
+++ b/bin/parse.kat
@@ -3,7 +3,7 @@ s s1 10 1 n1 n2
 m m1 0.5 0.5 0 n2 n3
 s s2 10 1 n3 n4
 m m2 0.5 0.5 0 n4 dump
-
+maxtem 10
 pd PD1 n2
 
-xaxis m1 phi lin 0 360 10000
+xaxis m1 phi lin 0 360 1000
diff --git a/bin/test_parser.py b/bin/test_parser.py
index ad51e26..43c1683 100644
--- a/bin/test_parser.py
+++ b/bin/test_parser.py
@@ -1,8 +1,7 @@
 import sys
 sys.path.append("../")
 
-from pykat import finesse
-import pykat.profiling
+from pykat import finesse, profiling
 import numpy as np
 import pylab as pl
 
@@ -13,6 +12,8 @@ kat.getPerformanceData = True
 
 [run, perfdata] = kat.run(printout=0,printerr=0)
 
-pykat.profiling.plotReducedPerformanceData(perfdata)
-
+l,t,fig = profiling.plotReducedPerformanceData(perfdata)
 
+fig.savefig("Timing.png",pad_inches=0.1, bbox_inches='tight')
+fig.show()
+    
\ No newline at end of file
diff --git a/pykat/profiling.py b/pykat/profiling.py
index d018f66..c6302a2 100644
--- a/pykat/profiling.py
+++ b/pykat/profiling.py
@@ -21,6 +21,7 @@ def plotReducedPerformanceData(perfdata, ordered=False):
     plt = fig.add_subplot(111)
     plt.barh(ind, times, height=0.5, log=True, align='center')
     pl.yticks(ind, labels)
-    pl.show()
+    pl.xlabel("Time [s]")
+    pl.title("Timing data for FINESSE")
     
-    return labels, times
\ No newline at end of file
+    return labels, times, fig
\ No newline at end of file
-- 
GitLab