Description
Describe the bug
If I use BoardIds.SYNTHETIC_BOARD.value:
When I stop_stream() and start_stream(450000) again, I get get_board_data_count() = 0 and get_current_board_data(450000).shape = (32, 0)
but, if I use BoardIds.BRAINBIT_BOARD.value:
When I stop_stream() and start_stream(450000) again, I get get_board_data_count() = 0 and get_current_board_data(450000).shape = (12, 2362) , where 2362 - only sample. Ring buffer not clean after start new stream.
To Reproduce
from brainflow.board_shim import BoardIds, BoardShim, BrainFlowInputParams
from time import sleep
# BOARD_ID = BoardIds.SYNTHETIC_BOARD.value
BOARD_ID = BoardIds.BRAINBIT_BOARD.value`
BoardShim.enable_dev_board_logger()
params = BrainFlowInputParams()
board = BoardShim(BOARD_ID, params)
board.prepare_session()
board.start_stream(450000)
sleep(10)
num_samples = board.get_board_data_count()
data = board.get_current_board_data(450000)
print(
f"\n\nData shape: {data.shape}, Num of elements in ringbuffer: {num_samples}\n\n"
)
board.stop_stream()
board.start_stream(450000)
num_samples = board.get_board_data_count()
data = board.get_current_board_data(450000)
print(
f"\n\nData shape: {data.shape}, Num of elements in ringbuffer: {num_samples}\n\n"
)
board.stop_stream()
if board.is_prepared():
board.release_session()
Info (please complete the following information):
- BoardIds.BRAINBIT_BOARD.value
- Windows 10
- python 3.9.6
- x64
- In case of Python full output of
pip list
command, for other languages please provide BrainFlow version used
Package Version
--------------- -------
brainflow 4.6.1
cycler 0.10.0
kiwisolver 1.3.2
matplotlib 3.4.3
nptyping 1.4.4
numpy 1.21.2
Pillow 8.3.2
pip 21.1.3
pyparsing 2.4.7
PySide6 6.2.0
python-dateutil 2.8.2
rope 0.20.1
setuptools 56.0.0
shiboken6 6.2.0
six 1.16.0
typish 1.9.3
yapf 0.31.0
Expected behavior
I Expected to ring buffer was clean after stop_stream() and start_stream() again.
Screenshots
For BoardIds.SYNTHETIC_BOARD.value:
[2021-10-10 12:12:06.845] [board_logger] [info] incoming json: {
"file": "",
"ip_address": "",
"ip_port": 0,
"ip_protocol": 0,
"mac_address": "",
"other_info": "",
"serial_number": "",
"serial_port": "",
"timeout": 0
}
[2021-10-10 12:12:06.848] [board_logger] [trace] Board object created -1
[2021-10-10 12:12:06.848] [board_logger] [trace] prepare session
[2021-10-10 12:12:06.849] [board_logger] [debug] use stub streamer
Data shape: (32, 2046), Num of elements in ringbuffer: 2033
[2021-10-10 12:12:16.928] [board_logger] [trace] stop stream
[2021-10-10 12:12:16.934] [board_logger] [debug] use stub streamer
Data shape: (32, 17), Num of elements in ringbuffer: 0
[2021-10-10 12:12:17.026] [board_logger] [trace] stop stream
[2021-10-10 12:12:17.029] [board_logger] [trace] release session
[2021-10-10 12:12:17.029] [board_logger] [trace] stop stream
For BoardIds.BRAINBIT_BOARD.value
[2021-10-10 12:13:52.210] [board_logger] [info] incoming json: {
"file": "",
"ip_address": "",
"ip_port": 0,
"ip_protocol": 0,
"mac_address": "",
"other_info": "",
"serial_number": "",
"serial_port": "",
"timeout": 0
}
[2021-10-10 12:13:52.215] [board_logger] [debug] use dyn lib: C:\BB_python\.venv\lib\site-packages\brainflow\lib\neurosdk-x64.dll
[2021-10-10 12:13:52.215] [board_logger] [trace] Board object created 7
[2021-10-10 12:13:52.237] [board_logger] [info] set timeout for device discovery to 15
[2021-10-10 12:13:52.859] [board_logger] [info] Found device with ID 3300XX
[2021-10-10 12:13:54.712] [board_logger] [debug] use stub streamer
Data shape: (12, 2354), Num of elements in ringbuffer: 2346
[2021-10-10 12:14:04.807] [board_logger] [debug] use stub streamer
Data shape: (12, 2358), Num of elements in ringbuffer: 0
Additional context
Add any other context about the problem here.