API Reference¶
This section contains the API documentation for blech_clust modules.
Overview¶
The blech_clust codebase is organized into several key modules:
- Core Pipeline - Main spike sorting pipeline modules
- Utilities - Helper functions and utility classes
- Ephys Data - Electrophysiology data handling and analysis
- EMG Analysis - EMG signal processing and analysis
Module Organization¶
Core Pipeline Modules¶
Located in the repository root, these modules form the main spike sorting pipeline:
blech_exp_info.py- Experiment setup and metadatablech_init.py- Directory initialization and data preparationblech_common_avg_reference.py- Common average referencingblech_process.py- Spike extraction and clusteringblech_post_process.py- Post-processing and unit selectionblech_units_plot.py- Waveform visualizationblech_make_arrays.py- Spike train array generation
Utility Modules¶
Located in utils/, these provide supporting functionality:
blech_utils.py- Core utility functionsclustering/- Clustering algorithmsephys_data/- Electrophysiology data handlingqa_utils/- Quality assurance tools
EMG Modules¶
Located in emg/, these handle EMG signal analysis:
emg_filter.py- EMG signal filteringemg_freq_setup.py- Frequency analysis setupget_gapes_Li.py- Gape detection using QDA
Using the API¶
Importing Modules¶
# Import utility functions
from utils.blech_utils import Tee, path_handler, imp_metadata
# Import ephys data tools
from utils.ephys_data import ephys_data
# Import clustering utilities
from utils.clustering import clustering
Example Usage¶
# Load experimental data
from utils.ephys_data import ephys_data
# Create data handler
data = ephys_data('/path/to/data')
# Access spike trains
spike_trains = data.spikes
# Get unit information
units = data.units
Documentation Format¶
Each module page includes:
- Overview - Module purpose and functionality
- Key Functions/Classes - Main components with descriptions
- Usage Examples - Code examples demonstrating usage
- Parameters - Detailed parameter descriptions
- Returns - Return value descriptions
Contributing¶
To improve the API documentation:
- Update docstrings in the source code following NumPy format
- Submit a pull request with your changes
- Documentation will be automatically rebuilt
See CONTRIBUTING.md for guidelines.