Ejemplo n.º 1
0
    def update(self):
        """ Updates the buffer and plot if there are new chunks available. """
        # pull all available chunks
        c, t = self.inlet.pull_chunk(timeout=0.0)
        new_c = []
        new_t = []
        while c:
            new_c += c
            new_t += t
            c, t = self.inlet.pull_chunk(timeout=0.0)

        # add samples to buffer
        if any(new_c):
            # add samples
            data_v = [item for sublist in new_c for item in sublist]
            self.gbuffer = np.roll(self.gbuffer, -len(data_v))
            self.gbuffer[-len(data_v) :] = data_v
            # add timestamps
            if new_t:
                self.gtimes = np.roll(self.gtimes, -len(new_t))
                self.gtimes[-len(new_t) :] = new_t

        # update graph handles
        if self.gbuffer.any():
            for k in range(0, self.channel_count):
                self.handles[k].setData(self.gtimes, self.gbuffer[k :: self.channel_count])
Ejemplo n.º 2
0
    def update(self):
        """ Updates the buffer and plot if there are new chunks available. """
        # pull all available chunks
        c, t = self.inlet.pull_chunk(timeout=0.0)
        new_c = []
        new_t = []
        while c:
            new_c += c
            new_t += t
            c, t = self.inlet.pull_chunk(timeout=0.0)

        # add samples to buffer
        if any(new_c):
            # add samples
            data_v = [item for sublist in new_c for item in sublist]
            self.gbuffer = np.roll(self.gbuffer, -len(data_v))
            self.gbuffer[-len(data_v):] = data_v
            # add timestamps
            if new_t:
                self.gtimes = np.roll(self.gtimes, -len(new_t))
                self.gtimes[-len(new_t):] = new_t

        # update graph handles
        if self.gbuffer.any():
            for k in range(0, self.channel_count):
                self.handles[k].setData(self.gtimes,
                                        self.gbuffer[k::self.channel_count])
Ejemplo n.º 3
0
    def fill_buffer(self):
        """ Fill buffer before starting the grapher. """
        num_of_smp = 0
        while num_of_smp < self.buf_size:
            c, t = self.inlet.pull_chunk(timeout=0.0)
            new_c = []
            new_t = []
            while c:
                new_c += c
                new_t += t
                c, t = self.inlet.pull_chunk(timeout=0.0)

            # add samples to buffer
            if any(new_c):
                # add samples
                num_of_smp += len(new_c)
                data_v = [item for sublist in new_c for item in sublist]
                self.gbuffer = np.roll(self.gbuffer, -len(data_v))
                self.gbuffer[-len(data_v) :] = data_v
                # add timestamps
                if new_t:
                    self.gtimes = np.roll(self.gtimes, -len(new_t))
                    self.gtimes[-len(new_t) :] = new_t
Ejemplo n.º 4
0
    def fill_buffer(self):
        """ Fill buffer before starting the grapher. """
        num_of_smp = 0
        while num_of_smp < self.buf_size:
            c, t = self.inlet.pull_chunk(timeout=0.0)
            new_c = []
            new_t = []
            while c:
                new_c += c
                new_t += t
                c, t = self.inlet.pull_chunk(timeout=0.0)

            # add samples to buffer
            if any(new_c):
                # add samples
                num_of_smp += len(new_c)
                data_v = [item for sublist in new_c for item in sublist]
                self.gbuffer = np.roll(self.gbuffer, -len(data_v))
                self.gbuffer[-len(data_v):] = data_v
                # add timestamps
                if new_t:
                    self.gtimes = np.roll(self.gtimes, -len(new_t))
                    self.gtimes[-len(new_t):] = new_t