| Crates.io | finalspark-rs |
| lib.rs | finalspark-rs |
| version | 0.1.5 |
| created_at | 2025-03-07 21:25:04.001329+00 |
| updated_at | 2025-03-13 19:54:50.74702+00 |
| description | A Rust library for live data recording from MEA devices. |
| homepage | https://maidenlabs.ai |
| repository | https://github.com/maidenlabs/finalspark-rs |
| max_upload_size | |
| id | 1583664 |
| size | 56,229 |
FinalSpark-RS is a Rust library for live data recording from MEA (Microelectrode Array) devices. It enables real-time data acquisition and processing from MEA devices over a network connection.
tokio for asynchronous networkingAdd finalspark-rs to your Cargo.toml:
[dependencies]
finalspark-rs = { git = "https://github.com/maidenlabs/finalspark-rs.git" }
tokio = { version = "1.0", features = ["full"] }
use finalspark_rs::LiveMEA;
#[tokio::main]
async fn main() {
let live_mea = LiveMEA::new();
// Record a single sample
match live_mea.record_sample(1).await {
Ok(data) => {
println!("Recorded sample with timestamp: {}", data.timestamp);
println!("Number of electrodes: {}", data.data.len());
println!("Samples per electrode: {}", data.data[0].len());
},
Err(e) => eprintln!("Error recording sample: {}", e),
}
}
use finalspark_rs::LiveMEA;
#[tokio::main]
async fn main() {
let live_mea = LiveMEA::new();
match live_mea.record_n_samples(1, 5).await {
Ok(samples) => {
println!("Successfully recorded {} samples", samples.len());
for (i, sample) in samples.iter().enumerate() {
println!("Sample {} timestamp: {}", i + 1, sample.timestamp);
}
},
Err(e) => eprintln!("Error recording samples: {}", e),
}
}
The LiveData struct contains:
timestamp: String in RFC3339 format representing when the sample was recordeddata: 2D vector containing electrode readings where:
tokio - Async runtime and networkingserde & serde_json - Data serializationchrono - Timestamp handlingtokio-tungstenite - WebSocket communicationurl - URL parsing and handlingThis project is licensed under the MIT License. See LICENSE for details.
Contributions are welcome! Please submit an issue or pull request on GitHub.