diff --git a/dstat_interface/dstat_comm.py b/dstat_interface/dstat_comm.py index 6866992e3f13019980dabdc1a8604cd12a7e9cd6..9f4d35358638d4ac1a06657fa540326225aecfb8 100755 --- a/dstat_interface/dstat_comm.py +++ b/dstat_interface/dstat_comm.py @@ -439,11 +439,14 @@ class Experiment(object): data = self.data_handler( (scan, self.serial.read(size=self.databytes))) self.data_pipe.send(data) - elif line.startswith('S'): - self.scan += 1 + + elif line.lstrip().startswith('S'): + scan += 1 + elif line.lstrip().startswith("#"): _logger.error("".join( ("DSTAT: ",line.lstrip().rstrip())), "INFO") + elif line.lstrip().startswith("no"): _logger.error("".join( ("DSTAT: ",line.lstrip().rstrip())), "DBG") diff --git a/dstat_interface/plot.py b/dstat_interface/plot.py index d857673ab0cdb5751fa89767f238dc5cba1f1982..27f9c456a9989beb63e7e7be0b2f1a60246b36b4 100755 --- a/dstat_interface/plot.py +++ b/dstat_interface/plot.py @@ -31,6 +31,10 @@ from matplotlib.backends.backend_gtkagg \ import FigureCanvasGTKAgg as FigureCanvas from matplotlib.backends.backend_gtkagg \ import NavigationToolbar2GTKAgg as NavigationToolbar +try: + import seaborn as sns +except ImportError: + pass from numpy import sin, linspace, pi, mean, trapz from scipy import fft, arange @@ -100,7 +104,7 @@ class plotbox(object): right=0.96, top=0.96) self.axe1 = self.figure.add_subplot(111) - self.lines = self.axe1.plot([0, 1], [0, 1]) + self.axe1.plot([0, 1], [0, 1]) self.axe1.ticklabel_format(style='sci', scilimits=(0, 3), useOffset=False, axis='y') @@ -116,9 +120,9 @@ class plotbox(object): def clearall(self): """Remove all lines on plot. """ - for i in self.lines: - i.remove() - self.lines = self.axe1.plot([0, 1], [0, 1]) + for i in range(len(self.axe1.lines)): + self.axe1.lines.pop(0) + self.addline() def clearline(self, line_number): """Remove a line specified by line_number.""" @@ -127,7 +131,10 @@ class plotbox(object): def addline(self): """Add a new line to plot. (initialized with dummy data)))""" - self.lines.append(self.axe1.plot([0, 1], [0, 1])[0]) + # self.lines.extend(self.axe1.plot([0, 1], [0, 1])) + print self.axe1.lines + self.axe1.plot([0, 1], [0, 1]) + print self.axe1.lines def updateline(self, Experiment, line_number): """Update a line specified by line_number with data stored in @@ -136,9 +143,9 @@ class plotbox(object): # limits display to 2000 data points per line divisor = len(Experiment.data[1+line_number*2]) // 2000 + 1 - self.lines[line_number].set_ydata( + self.axe1.lines[line_number].set_ydata( Experiment.data[1+line_number*2][1::divisor]) - self.lines[line_number].set_xdata( + self.axe1.lines[line_number].set_xdata( Experiment.data[line_number*2][1::divisor]) def changetype(self, Experiment):