Commit d1621bfd authored by Joanna Duda's avatar Joanna Duda

API Analysis

refs #30371
parent e631606c
......@@ -2,19 +2,19 @@
# -*- coding: utf-8 -*-
import collections
import numpy
from obci.configs.variables_pb2 import Blink as BlinkProto
from obci.core.messages.message_helper import Blink
from obci.signal_processing.buffers import ring_buffer as rbn
Sample = numpy.zeros
class Blink(object):
def __init__(self, blink: BlinkProto, blink_count: int, blink_pos: int) -> None:
class BlinkEntry(object):
def __init__(self, blink: Blink, blink_count: int, blink_pos: int) -> None:
"""
BlinkProtobuf variable as a representation of the stimulus.
Blink variable as a representation of the stimulus.
:param blink: protobuf variable Blink (object with one field named timestamp)
:param blink: variable Blink (object with one field named timestamp)
:param blink_count: index of the stimulus
:param blink_pos: position of the stimulus in relation to the indexes of the samples in the buffer.
"""
......@@ -26,8 +26,9 @@ class Blink(object):
class AutoBlinkBuffer(object):
def __init__(self, from_blink, samples_count, num_of_channels, sampling, ret_func, copy_on_ret):
"""
After occurrence of the blink and getting a sufficient number of samples calls ret_func(blink, d),
where blink is a protobuf Blink variable and d is a corresponding numpy array with
After occurrence of the blink and getting a sufficient number of samples calls ret_func(blink, d).
Blink is a Blink variable and d is a corresponding numpy array with
<samples_count> samples from <num_of_channels> channels.
:param from_blink: blink from which start collecting samples
......@@ -71,11 +72,11 @@ class AutoBlinkBuffer(object):
self.blinks_count = 0
self.blinks.clear()
def handle_blink(self, blink: BlinkProto) -> None:
def handle_blink(self, blink: Blink) -> None:
"""
Assignes index and position to the Blink and queues this Blink.
Assignees index and position to the Blink and queues this Blink.
:param blink: protobuf variable Blink (object with one field named timestamp)
:param blink: Blink (object with one field named timestamp)
:return:
"""
if not self.is_full:
......@@ -100,7 +101,7 @@ class AutoBlinkBuffer(object):
if not len(self.blinks) == 0:
blink_count -= self.blinks_count # last.count #get_last_blink()
b = Blink(blink, blink_count, blink_pos)
b = BlinkEntry(blink, blink_count, blink_pos)
self.blinks.append(b)
self.blinks_count += blink_count
# [10, 15, 18, 22]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment