MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / get_board_data

Method get_board_data

python_package/brainflow/board_shim.py:1435–1459  ·  view source on GitHub ↗

Get board data and remove data from ringbuffer :param num_samples: number of packages to get :type num_samples: int :param preset: preset :type preset: int :return: all data from a board if num_samples is None, num_samples packages or less if not None

(self, num_samples=None, preset: int = BrainFlowPresets.DEFAULT_PRESET)

Source from the content-addressed store, hash-verified

1433 return bool(prepared[0])
1434
1435 def get_board_data(self, num_samples=None, preset: int = BrainFlowPresets.DEFAULT_PRESET):
1436 """Get board data and remove data from ringbuffer
1437
1438 :param num_samples: number of packages to get
1439 :type num_samples: int
1440 :param preset: preset
1441 :type preset: int
1442 :return: all data from a board if num_samples is None, num_samples packages or less if not None
1443 :rtype: NDArray[Shape["*, *"], Float64]
1444 """
1445
1446 data_size = self.get_board_data_count(preset)
1447 if num_samples is not None:
1448 if num_samples < 1:
1449 raise BrainFlowError('invalid num_samples', BrainFlowExitCodes.INVALID_ARGUMENTS_ERROR.value)
1450 else:
1451 data_size = min(data_size, num_samples)
1452 package_length = BoardShim.get_num_rows(self._master_board_id, preset)
1453 data_arr = numpy.zeros(data_size * package_length).astype(numpy.float64)
1454
1455 res = BoardControllerDLL.get_instance().get_board_data(data_size, preset, data_arr, self.board_id, self.input_json)
1456 if res != BrainFlowExitCodes.STATUS_OK.value:
1457 raise BrainFlowError('unable to get board data', res)
1458
1459 return data_arr.reshape(package_length, data_size)
1460
1461 def config_board(self, config) -> str:
1462 """Use this method carefully and only if you understand what you are doing, do NOT use it to start or stop streaming

Callers 15

mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95

Calls 5

get_board_data_countMethod · 0.95
BrainFlowErrorClass · 0.90
get_num_rowsMethod · 0.65
get_board_dataMethod · 0.65
get_instanceMethod · 0.45

Tested by 3

mainFunction · 0.76
mainFunction · 0.76
mainFunction · 0.76