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

Function main

rust_package/brainflow/examples/downsampling.rs:9–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7use ndarray::s;
8
9fn main() {
10 brainflow::board_shim::enable_dev_board_logger().unwrap();
11 let board_id = BoardIds::SyntheticBoard;
12 let eeg_channels = board_shim::get_eeg_channels(board_id, BrainFlowPresets::DefaultPreset).unwrap();
13
14 let params = BrainFlowInputParamsBuilder::default().build();
15 let board = board_shim::BoardShim::new(board_id, params).unwrap();
16
17 board.prepare_session().unwrap();
18 board.start_stream(45000, "").unwrap();
19 thread::sleep(Duration::from_secs(5));
20 board.stop_stream().unwrap();
21 let mut data = board.get_board_data(Some(128), BrainFlowPresets::DefaultPreset).unwrap();
22 board.release_session().unwrap();
23
24 println!("{:?}", data.slice(s![eeg_channels[0], ..]));
25 let downsampled = data_filter::perform_downsampling(
26 data.slice_mut(s![eeg_channels[0], ..])
27 .as_slice_mut()
28 .unwrap(),
29 3,
30 AggOperations::Each,
31 )
32 .unwrap();
33 println!("{:?}", &downsampled);
34}

Callers

nothing calls this directly

Calls 10

enable_dev_board_loggerFunction · 0.85
prepare_sessionMethod · 0.65
start_streamMethod · 0.65
stop_streamMethod · 0.65
get_board_dataMethod · 0.65
release_sessionMethod · 0.65
get_eeg_channelsFunction · 0.50
sleepFunction · 0.50
perform_downsamplingFunction · 0.50
buildMethod · 0.45

Tested by

no test coverage detected