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

Function main

python_package/examples/tests/downsampling.py:7–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5
6
7def main():
8 BoardShim.enable_dev_board_logger()
9
10 # use synthetic board for demo
11 params = BrainFlowInputParams()
12 board = BoardShim(BoardIds.SYNTHETIC_BOARD.value, params)
13 board.prepare_session()
14 board.start_stream()
15 BoardShim.log_message(LogLevels.LEVEL_INFO.value, 'start sleeping in the main thread')
16 time.sleep(10)
17 data = board.get_board_data(20)
18 board.stop_stream()
19 board.release_session()
20
21 eeg_channels = BoardShim.get_eeg_channels(BoardIds.SYNTHETIC_BOARD.value)
22 # demo for downsampling, it just aggregates data
23 for count, channel in enumerate(eeg_channels):
24 print('Original data for channel %d:' % channel)
25 print(data[channel])
26 if count == 0:
27 downsampled_data = DataFilter.perform_downsampling(data[channel], 3, AggOperations.MEDIAN.value)
28 elif count == 1:
29 downsampled_data = DataFilter.perform_downsampling(data[channel], 2, AggOperations.MEAN.value)
30 else:
31 downsampled_data = DataFilter.perform_downsampling(data[channel], 2, AggOperations.EACH.value)
32 print('Downsampled data for channel %d:' % channel)
33 print(downsampled_data)
34
35
36if __name__ == "__main__":

Callers 1

downsampling.pyFile · 0.70

Calls 11

prepare_sessionMethod · 0.95
start_streamMethod · 0.95
get_board_dataMethod · 0.95
stop_streamMethod · 0.95
release_sessionMethod · 0.95
BoardShimClass · 0.90
get_eeg_channelsMethod · 0.65
perform_downsamplingMethod · 0.65
log_messageMethod · 0.45

Tested by

no test coverage detected