Skip to content

AntoineBellemare/biotuner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

446 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

biotuner_logo

Biotuner

Python toolbox that incorporates tools from biological signal processing and musical theory to extract harmonic structures from biosignals.

Tests Codecov PyPI Biotuner Docs License GitHub stars Python Versions

โœจ Features

  • ๐ŸŽต Harmonic Analysis: Extract harmonic structures from biosignals using music theory principles
  • ๐Ÿ“Š Multiple Peak Detection Methods: FOOOF, EMD, fixed-frequency, and harmonic-recurrence based methods
  • ๐Ÿงฎ Harmonicity Metrics: Compute consonance, dissonance, harmonic similarity, Tenney height, and more
  • ๐ŸŽน Musical Applications: Generate musical scales, tuning systems, and MIDI output from biosignals
  • ๐Ÿ”ฌ Group Analysis (BETA): Batch processing for multiple time series with automatic aggregation
  • ๐Ÿ“ˆ Rich Visualizations: Publication-ready plots for spectral analysis and harmonic relationships
  • ๐Ÿง  Multi-modal Support: Compatible with EEG, ECG, EMG, plant signals, and other biosignals
  • ๐ŸŽจ Interactive GUI: Graphical interface for easy exploration

Installation

1. Install using PyPI (Recommended)

To install the latest stable version of Biotuner from PyPI, run:

pip install biotuner

2. Install from the GitHub Repository (Development Version)

If you want the latest development version or contribute to the code, follow these steps:

2.1. Automatically Setup the Environment (Recommended)

The easiest way to set up a development environment is by using invoke, which will:

โœ… Create a Conda environment
โœ… Install dependencies
โœ… Install Biotuner in editable mode

# Clone the repository
git clone https://github.com/AntoineBellemare/biotuner.git
cd biotuner

# Install Invoke (if not already installed)
pip install invoke

# Automatically create a Conda environment and install Biotuner
invoke setup

๐Ÿ‘‰ This will create a Conda environment named biotuner_env and install all dependencies.

To activate the Conda environment manually:

conda activate biotuner_env

2.2. Manual Setup (Alternative)

If you prefer to set up the environment manually, follow these steps:

1๏ธโƒฃ Create a Conda environment

conda create --name biotuner_env python=3.11 -y
conda activate biotuner_env

2๏ธโƒฃ Install dependencies

pip install -r requirements.txt
pip install -e .

3. Verify Installation by Running Tests

To confirm that Biotuner is installed correctly, run the test suite:

invoke test

or manually using:

pytest tests/

If all tests pass โœ…, your installation is complete!


๐ŸŽฏ Summary

  • For general users: Install via pip install biotuner
  • For development: Clone the repo and run invoke setup
  • To verify installation: Run invoke test

Simple use case

Single Time Series Analysis

from biotuner import compute_biotuner

# Initialize the object
biotuning = compute_biotuner(sf=1000)

# Extract spectral peaks
biotuning.peaks_extraction(data, peaks_function='FOOOF')

# Get consonance metrics for spectral peaks
biotuning.compute_peaks_metrics()

Group Analysis (๐Ÿงช BETA)

Analyze multiple time series simultaneously with automatic aggregation and group comparisons:

from biotuner import BiotunerGroup
import numpy as np

# Multiple trials or electrodes: shape (n_series, n_samples)
data = np.random.randn(10, 5000)

# Create group object
btg = BiotunerGroup(data, sf=1000, axis_labels=['trials'])

# Run analysis pipeline
btg.compute_peaks(peaks_function='FOOOF', min_freq=1, max_freq=50)
btg.compute_metrics(n_harm=10)

# Get summary statistics
summary = btg.summary()

Note: The BiotunerGroup module is currently in beta. The API may change in future releases.


๐ŸŒ Biotuner Engine - Web Interface

Explore Biotuner's capabilities through our interactive web interface:

biotuner-engine.kairos-hive.org

The Biotuner Engine provides a user-friendly web application to analyze biosignals, visualize harmonic structures, and explore musical applications directly in your browserโ€”no installation required!


Multimodal Harmonic Analysis

biotuner_multimodal_02

The figure above illustrates Biotuner's ability to extract harmonic structures across different biological and physical systems. It showcases harmonic ratios detected in biosignals from the brain, heart, and plants, as well as their correspondence with audio signals. By analyzing the fundamental frequency relationships in these diverse modalities, Biotuner enables a cross-domain exploration of resonance and tuning in biological and artificial systems.

Biotuner_pipeline (6)-page-001

Peaks extraction methods

biotuner_peaks_extraction


๐Ÿ“š Documentation & Resources

๐Ÿค Contributing

We welcome contributions! Whether it's:

  • ๐Ÿ› Bug reports
  • ๐Ÿ’ก Feature requests
  • ๐Ÿ“ Documentation improvements
  • ๐Ÿ”ง Code contributions

Please feel free to open an issue or submit a pull request on GitHub.

๐Ÿ“„ License

Biotuner is licensed under the MIT License.

๐Ÿ“– Citation

If you use Biotuner in your research, please cite our work. See the citation guide for more information.

๐Ÿ’ฌ Support


Made with โค๏ธ by the Biotuner development team

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors