Skip to content

potential error in retrieving data from circular buffer #7

Description

@vstadnytskyi
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/femto-13/All-Projects-on-femto/LaserLab/Software/libraries/icarus-nmr/icarus_nmr/event_handler.py", line 514, in run
    self.run_once()
  File "/Users/femto-13/All-Projects-on-femto/LaserLab/Software/libraries/icarus-nmr/icarus_nmr/event_handler.py", line 538, in run_once
    self.evaluate_events()
  File "/Users/femto-13/All-Projects-on-femto/LaserLab/Software/libraries/icarus-nmr/icarus_nmr/event_handler.py", line 1243, in evaluate_events
    self.push_target_pressure()
  File "/Users/femto-13/All-Projects-on-femto/LaserLab/Software/libraries/icarus-nmr/icarus_nmr/event_handler.py", line 1371, in push_target_pressure
    target_pressure = scipy.stats.mode(data[:,0])[0][0]
IndexError: index 0 is out of bounds for axis 0 with size 0

The function that fails is this:

  def get_ring_buffer_N(self,N,pointer):
       #print('input: N= %r ; pointer = %r )' % (N, pointer))
       if pointer > (self.packet_buffer_size+1)*self.packet_length:
           pointer = int(pointer - ((self.packet_buffer_size+1)*self.packet_length)-1)
       # try:
           #print(' try: N= %r ; pointer = %r' % (N, pointer))
       res = self.circular_buffer.get_N(N, pointer)
       # except:
       #     res = nan
       return res

N = 400, pointer = unknown.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions