How to use the pylsl.TimeoutError function in pylsl

To help you get started, we’ve selected a few pylsl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fsxfreak / esys-pbi / src / graph_realtime.py View on Github external
def _graph_lsl(self):
    while self.running:
      # initial run
      self.sample, self.timestamp = self.inlet.pull_sample(timeout=5)
      if self.timeBuffer[0] == 0.0:
        self.timeBuffer = collections.deque([self.timestamp] * self._bufsize, self._bufsize)

      # time correction to sync to local_clock()
      try:
        if self.timestamp is not None and self.sample is not None:
          self.timestamp = self.timestamp + self.inlet.time_correction(timeout=5) 

      except TimeoutError:
        pass

    print('closing graphing utility')
    self.inlet.close_stream()
github fsxfreak / esys-pbi / src / capture_pupil.py View on Github external
def _record_lsl(self):
    while self.running:
      sample, timestamp = self.inlet.pull_sample(timeout=5)

      # time correction to sync to local_clock()
      try:
        if timestamp is not None and sample is not None:
          timestamp = timestamp + self.inlet.time_correction(timeout=5) 

          samples_lock.acquire()
          self.samples.append(('STIM', timestamp, sample))
          samples_lock.release()

      except TimeoutError:
        pass

    print('closing lsl on the pupil side')
    self.inlet.close_stream()
github fsxfreak / esys-pbi / src / capture_bci.py View on Github external
def _record_lsl(self):
    while self.running:
      sample, timestamp = self.inlet.pull_sample(timeout=5)

      # time correction to sync to local_clock()
      try:
        if timestamp is not None and sample is not None:
          timestamp = timestamp + self.inlet.time_correction(timeout=5) 

          samples_lock.acquire()
          self.samples.append(('STIM', timestamp, sample))
          samples_lock.release()

      except TimeoutError:
        pass

    print('closing lsl')
    self.inlet.close_stream()
github fsxfreak / esys-pbi / src / graph_matplotlib.py View on Github external
def _graph_lsl(self):
    while self.running:
      # initial run
      self.sample, self.timestamp = self.inlet.pull_sample(timeout=5)
      #if self.timeBuffer[0] == 0.0:
       # self.timeBuffer = collections.deque([self.timestamp] * self._bufsize, self._bufsize)
    # time correction to sync to local_clock()
      try:
        if self.timestamp is not None and self.sample is not None:
          self.timestamp = self.timestamp + self.inlet.time_correction(timeout=5) 

      except TimeoutError:
        pass
      self.SecondTimes.append(self.timestamp)                         #add time stamps to array 'timeValSeconds'
      #print(abs(self.sample[3])/1000)
      self.ProcessedSig.append(abs(self.sample[3])/1000)                           #add processed signal values to 'processedSig'
      if(abs(self.sample[3]/1000) > self.maximum):
          self.maximum = abs(self.sample[3]/1000)
      if(abs(self.sample[3]/1000) < self.minimum):
          self.minimum = abs(self.sample[3]/1000)

      self.sampleCount = self.sampleCount + 1  
      self.count = self.count + 1
      #plt.show()
      if((self.count % 20 == 0) and (self.count != 0)):   #every 20 samples (ie ~ 0.2 ms) is when plot updates. Change the sample number (ie 20) to modify frequency at which plot updates
      #if(self.count == 20):
        self.count = -1
	self.lineHandle[0].set_ydata(self.ProcessedSig)