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

Function runExample

nodejs_package/tests/bandpower.ts:8–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6}
7
8async function runExample (): Promise<void>
9{
10 const boardId = BoardIds.SYNTHETIC_BOARD;
11 const board = new BoardShim (boardId, {});
12 board.prepareSession();
13 board.startStream();
14 await sleep (5000);
15 board.stopStream();
16 const data = board.getCurrentBoardData(128);
17 board.releaseSession();
18 const eegChannels = BoardShim.getEegChannels(boardId);
19 const samplingRate = BoardShim.getSamplingRate(boardId);
20 const oldData = data[eegChannels[1]];
21 const psd = DataFilter.getPsdWelch(oldData, 64, 0.5, samplingRate, WindowOperations.HAMMING);
22 const alpha = DataFilter.getBandPower(psd, 7.0, 13.0);
23 const beta = DataFilter.getBandPower(psd, 14.0, 30.0);
24 console.info(alpha / beta);
25}
26
27runExample ();

Callers 1

bandpower.tsFile · 0.70

Calls 10

prepareSessionMethod · 0.95
startStreamMethod · 0.95
stopStreamMethod · 0.95
getCurrentBoardDataMethod · 0.95
releaseSessionMethod · 0.95
getEegChannelsMethod · 0.80
getSamplingRateMethod · 0.80
getPsdWelchMethod · 0.80
getBandPowerMethod · 0.80
sleepFunction · 0.70

Tested by

no test coverage detected