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

Function main

python_package/examples/tests/ica.py:12–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11
12def main():
13 board_id = BoardIds.SYNTHETIC_BOARD
14 eeg_channels = BoardShim.get_eeg_channels(board_id)
15
16 params = BrainFlowInputParams()
17 board = BoardShim(board_id, params)
18 board.prepare_session()
19 board.start_stream()
20 time.sleep(10)
21 data = board.get_board_data(500)
22 board.stop_stream()
23 board.release_session()
24
25 channel_to_use = eeg_channels[4]
26 data = data[channel_to_use, :]
27 # provide 5 chunks of data for components selection
28 data = data.reshape(5, 100)
29 data = np.ascontiguousarray(data)
30 w, k, a, s = DataFilter.perform_ica(data, 2)
31 fig, axs = plt.subplots(2, 1)
32 axs[0].plot(s[0, :])
33 axs[0].set_title('Unmixed signal 1')
34 axs[1].plot(s[1, :])
35 axs[1].set_title('Unmixed signal 2')
36 plt.savefig('unmixed_signal.png')
37
38
39if __name__ == "__main__":

Callers 1

ica.pyFile · 0.70

Calls 9

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_icaMethod · 0.65

Tested by

no test coverage detected