diff --git a/schainpy/model/graphics/figure.py b/schainpy/model/graphics/figure.py index 1b8dc8a..09f90d5 100644 --- a/schainpy/model/graphics/figure.py +++ b/schainpy/model/graphics/figure.py @@ -197,6 +197,7 @@ class Axes: self.plot = None self.__firsttime = True + self.idlineList = [] def setText(self, text): @@ -244,12 +245,26 @@ class Axes: ylabel=ylabel, title=title, **kwargs) + + self.idlineList.append(0) self.__firsttime = False return self.__driver.pline(self.plot, x, y, xlabel=xlabel, ylabel=ylabel, title=title) + + def addpline(self, x, y, idline, **kwargs): + lines = self.ax.lines + + if idline in self.idlineList: + self.__driver.set_linedata(self.ax, x, y, idline) + + if idline not in(self.idlineList): + self.__driver.addpline(self.ax, x, y, **kwargs) + self.idlineList.append(idline) + + return def pmultiline(self, x, y, xmin=None, xmax=None, diff --git a/schainpy/model/graphics/mpldriver.py b/schainpy/model/graphics/mpldriver.py index 9a3b784..c0dd4cc 100644 --- a/schainpy/model/graphics/mpldriver.py +++ b/schainpy/model/graphics/mpldriver.py @@ -130,7 +130,14 @@ def pline(iplot, x, y, xlabel='', ylabel='', title=''): printLabels(ax, xlabel, ylabel, title) - iplot.set_data(x, y) + set_linedata(ax, x, y, idline=0) + +def addpline(ax, x, y, color, linestyle, lw): + ax.plot(x,y,color=color,linestyle=linestyle,lw=lw) + + +def set_linedata(ax, x, y, idline): + ax.lines[idline].set_data(x,y) def createPmultiline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None, ticksize=9, xtick_visible=True, ytick_visible=True, diff --git a/schainpy/model/jroplot.py b/schainpy/model/jroplot.py index 02d0789..0760306 100644 --- a/schainpy/model/jroplot.py +++ b/schainpy/model/jroplot.py @@ -465,6 +465,9 @@ class SpectraPlot(Figure): xlabel='dB', ylabel='', title='', ytick_visible=False, grid='x') + + noiseline = numpy.repeat(noise[i], len(y)) + axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2) self.draw() diff --git a/schainpy/model/jroprocessing.py b/schainpy/model/jroprocessing.py index 631392d..9d1dd6a 100644 --- a/schainpy/model/jroprocessing.py +++ b/schainpy/model/jroprocessing.py @@ -216,6 +216,7 @@ class VoltageProc(ProcessingUnit): self.objectDict = {} self.dataOut = Voltage() + self.flip = 1 def init(self): @@ -362,6 +363,9 @@ class VoltageProc(ProcessingUnit): self.dataOut.data = buffer self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*self.dataOut.nHeights/window-newdelta,newdelta) + def deFlip(self): + self.dataOut.data *= self.flip + self.flip *= -1. class CohInt(Operation):