Exemplo n.º 1
0
    def __init__(self,
                 comport,
                 baudrate=9600,
                 window_width=1000,
                 buffer_width=1000):

        self.window_width = window_width
        self.ptr = -window_width
        self.buffer_width = buffer_width

        self.string_stream = ''
        self.ser = serial.Serial(comport, baudrate)

        self.app = qt.QApplication([])
        self.win = pg.GraphicsWindow(title="Pyscilloscope")
        p = self.win.addPlot(title="Time vs. Voltage")

        self.packet = self.read_new_packet()
        self.width = len(self.packet)
        self.curves = []
        self.data_history = numpy.zeros((self.window_width, self.width))
        self.l = p.addLegend()
        for ii in range(self.width - 2):
            curve = p.plot(pen=pens[ii % len(pens)], symbol=None)
            self.l.addItem(curve, 'V' + str(ii))
            self.curves.append(curve)

        self.Xm = numpy.linspace(0, 0, window_width)
        self.buffer_width = buffer_width
    def __init__(self,
                 url,
                 window_width=300,
                 data_width=500,
                 connect_history=False):

        self.app = qt.QApplication([])

        self.url = url
        self.window_width = window_width
        self.data_width = data_width

        self.win = pg.GraphicsWindow(title="Pyscilloscope")

        self.messages = SSEClient(self.url)

        # self.packet = self.read_new_packet()

        self.plot_init = False

        self.connect_history = connect_history