MEA-Flow is a comprehensive Python package for analyzing multi-electrode array (MEA) data with a focus on population dynamics, feature analysis, and comparative studies across experimental conditions. The package provides a complete pipeline from data loading to advanced statistical analysis and visualization.
- Activity Metrics: Firing rates, spike counts, burst detection, network burst analysis
- Regularity Metrics: CV-ISI, Local Variation (LV), entropy measures, Fano factors
- Synchrony Metrics: Pairwise correlations, spike train distances, population synchrony measures
- Burst Analysis: Individual electrode and network-level burst detection with adaptive thresholds
- Feature Selection: 11 complementary methods including mutual information, LASSO, Random Forest, XGBoost
- Redundancy Detection: Variance Inflation Factor (VIF) and correlation analysis
- Consensus Ranking: Multi-method feature importance with Borda count aggregation
- Machine Learning: Classification analysis for experimental condition prediction
- Multiple Methods: PCA, MDS, Isomap, LLE, UMAP, t-SNE, Spectral Embedding
- Population Dynamics: State space analysis of neural population geometry
- Embedding Evaluation: Trustworthiness, continuity, and reconstruction error metrics
- Cross-Condition Comparison: Procrustes alignment and geometric analysis
- Axion .spk Files: Native Python loader with 100% MATLAB compatibility
- Multiple Formats: .mat files, CSV, HDF5, pandas DataFrames
- No Dependencies: Eliminates MATLAB requirement with 2-5x faster performance
- Universal Compatibility: Handles all .spk file variants with robust error handling
- Raster Plots: Spike train visualizations with electrode mapping
- Feature Analysis: Importance rankings, consensus plots, method comparisons
- Manifold Visualizations: 2D/3D embeddings with condition coloring
- Statistical Plots: Comprehensive analysis dashboards and comparison plots
β‘οΈ See the complete Notebooks Guide for detailed tutorials and examples.
MEA-Flow includes comprehensive Jupyter notebook tutorials covering the complete analysis pipeline:
- Data Loading & Format Conversion - Native Python .spk loader, MATLAB .mat files, CSV import, and batch processing
- Activity Visualization - Raster plots, electrode heatmaps, well activity analysis, and animated visualizations
- Activity Analysis - 70+ neural metrics including activity, regularity, synchrony, and burst detection
- Feature-Based Analysis - Feature selection, dimensionality reduction, clustering, and machine learning
- Manifold Analysis - Population dynamics, state-space geometry, and cross-condition comparisons
Each notebook includes:
- Step-by-step code examples with detailed explanations
- Publication-quality visualization examples
- Best practices for analysis workflows
- Links to comprehensive method documentation
- Activity Analysis Methods - Complete mathematical descriptions of 70+ neural activity metrics
- Feature Analysis Methods - Detailed algorithms for 11 feature selection methods
- Manifold Methods - Theory and implementation of dimensionality reduction techniques
- Clustering Methods - K-means, GMM, DBSCAN, and hierarchical clustering for neural data
MEA-Flow uses modern Python packaging with uv for fast dependency management.
- Python 3.10 or higher
- uv package manager (recommended)
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and install MEA-Flow
git clone https://github.com/CNNC-Lab/mea-flow.git
cd mea-flow
# Install with all dependencies
uv sync
# Verify installation
uv run python -c "import mea_flow; print('MEA-Flow installed successfully!')"# Clone repository
git clone https://github.com/CNNC-Lab/mea-flow.git
cd mea-flow
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# Install package
pip install -e .- Scientific Computing: numpy, scipy, pandas, scikit-learn
- Machine Learning: xgboost, lightgbm, imbalanced-learn, statsmodels
- Feature Selection: mlxtend, skrebate, boruta
- Visualization: matplotlib, seaborn
- Manifold Learning: umap-learn
- Data I/O: h5py, tqdm, joblib
- PySpike: Advanced spike train distance measures (install with
[full])
For detailed installation instructions, see INSTALLATION_GUIDE.md.
from mea_flow.data import load_data
from mea_flow.analysis import MEAMetrics
from mea_flow.visualization import MEAPlotter
# Load Axion .spk file (native Python, no MATLAB required)
spike_list = load_data('recording.spk')
# Compute comprehensive neural activity metrics
analyzer = MEAMetrics()
metrics = analyzer.compute_all_metrics(spike_list)
# Create publication-ready visualizations
plotter = MEAPlotter()
fig = plotter.plot_raster(spike_list, time_range=(0, 30))# Load and analyze neural activity
from mea_flow.data import load_data
from mea_flow.analysis import MEAMetrics
spike_list = load_data('recording.spk')
analyzer = MEAMetrics()
metrics = analyzer.compute_all_metrics(spike_list)# Multi-condition feature analysis
from mea_flow.analysis import comprehensive_feature_analysis
# Load pre-computed metrics DataFrame
results = comprehensive_feature_analysis(
data=metrics_df,
target_column='condition',
methods=['mutual_info', 'random_forest', 'lasso']
)# Manifold learning for population geometry
from mea_flow.manifold import analyze_feature_space
embedding_results = analyze_feature_space(
data=metrics_df,
methods=['pca', 'umap', 'tsne'],
color_column='condition'
)MEA-Flow is designed for neuroscience researchers working with multi-electrode array recordings. The package addresses key challenges in neural population analysis:
- Data Format Compatibility: Native Python loading of Axion .spk files eliminates MATLAB dependencies
- Comprehensive Metrics: 70+ neural activity measures covering activity, regularity, synchrony, and burst dynamics
- Feature Analysis: Advanced machine learning approaches for identifying discriminative neural features
- Population Dynamics: Manifold learning techniques for understanding high-dimensional neural state spaces
- Statistical Rigor: Multiple validation methods and consensus approaches for robust scientific conclusions
- Cross-condition comparisons (e.g., control vs. treatment)
- Time-course analysis of neural development or plasticity
- Drug screening and pharmacological studies
- Network connectivity and synchronization analysis
- Population-level neural dynamics characterization
If you use MEA-Flow in your research, please cite:
@software{mea_flow_2024,
title={MEA-Flow: Neural Population Dynamics Analysis for Multi-Electrode Arrays},
author={Duarte, Renato},
year={2024},
publisher={Zenodo},
url={https://github.com/CNNC-Lab/mea-flow},
doi={10.5281/zenodo.18101939},
version={0.1.0}
}This project is licensed under the MIT License - see the LICENSE file for details.
MEA-Flow was developed in collaboration with the research groups of Ana LuΓsa Carvalho and Ester Coutinho at:
- CNC-UC - Center for Neuroscience and Cell Biology, University of Coimbra
- CIBB - Centre for Innovative Biomedicine and Biotechnology, University of Coimbra
This work was partially funded by:
- Portuguese Foundation for Science and Technology (FCT) under projects:
- UIDB/04539/2020
- UIDP/04539/2020
- LA/P/0058/2020
- European Union's Horizon 2020 research and innovation programme under grant agreement No. 952422 (DYNABrain)
MEA-Flow builds upon the open-source scientific Python ecosystem. We acknowledge the developers of scikit-learn, matplotlib, scipy, and other foundational libraries. Development was assisted by Claude (Anthropic) via Windsurf IDE for code generation and optimization.
