Comprehensive EEG analysis pipeline with graph-based connectivity analysis, trigger detection, frequency-domain processing, and spectral parameterization (FOOOF/SpecParam)
Project description
EEG Analysis Pipeline
A comprehensive Python package for EEG signal processing, trigger detection, and frequency-domain analysis.
Overview
This package provides a complete pipeline for analyzing EEG data stored in European Data Format (EDF) files. It includes tools for signal loading, trigger detection, inter-trigger window analysis, and multi-band frequency-domain processing.
Features
- EDF File Loading: Load and inspect EEG signals with flexible duration and channel selection
- Trigger Detection: Automated detection of trigger events with customizable thresholds
- Window Analysis: Generate and analyze inter-trigger intervals with multiple aggregation methods
- Frequency-Domain Analysis: Multi-band EEG analysis (Delta, Theta, Alpha, Beta, Gamma)
- Spectral Parameterization: Separate aperiodic (1/f) and periodic (oscillatory) components using SpecParam/FOOOF
- Visualization: Comprehensive plotting and video generation capabilities
- ML Integration: Optional machine learning-based window quality filtering
Installation
pip install yousif-raiyan-pip-package
Quick Start
from yousif_raiyan_pip_package import EDFLoader, TriggerDetector, Analyzer, EEGGraphProcessor, FOOOFAnalyzer
# Load EEG data
loader = EDFLoader("data", "subject_name")
loader.load_and_plot_signals(signal_indices=[15, 25], duration=1200.0) # T6, T2
# Option 1: Spectral analysis
detector = TriggerDetector(loader, 'T2')
detector.detect_triggers()
analyzer = Analyzer(loader, detector)
analyzer.extract_signals()
# Option 2: Spectral parameterization (SpecParam/FOOOF)
fooof_analyzer = FOOOFAnalyzer(loader)
fooof_analyzer.analyze_signals()
# Option 3: Graph-based connectivity analysis
processor = EEGGraphProcessor(edf_loader=loader)
# Compute time-varying correlation
processor.compute_correlation(start_time=0, stop_time=300, interval_seconds=10)
# Compute coherence across frequency bands
processor.compute_coherence_bands(start_time=0, stop_time=300, interval_seconds=10)
# Generate full graph representations for machine learning
processor.generate_graphs_from_edf()
Data Structure Requirements
Input Data Format
Your EDF files should be organized as follows:
data/
└── subject_name/
└── subject_name.edf
Example:
data/
└── Sebastian/
└── Sebastian.edf
EDF File Requirements
- Format: European Data Format (.edf)
- Channels: Standard EEG channel names (Fp1, F3, F4, C3, C4, P3, P4, O1, O2, F7, F8, T3, T4, T5, T6, Fz)
- Sample Rate: Typically 500 Hz (automatically detected)
- Duration: Minimum 10 minutes recommended for trigger detection
Classes and Methods
EDFLoader
Handles loading and inspection of EDF files.
Initialization
loader = EDFLoader(folder_path, name)
Parameters:
folder_path(str): Base directory containing subject foldersname(str): Subject name (must match folder and file name)
Methods
inspect_data()
Displays comprehensive file information including:
- File header details
- Number of signals and their properties
- Sample rates and signal ranges
- First 10 samples of each channel
loader.inspect_data()
load_and_plot_signals(signal_indices=None, duration=None, save_plots=False, save_path=None)
Loads and visualizes EEG signals with flexible options.
Parameters:
signal_indices(list, optional): Specific channel indices to load (default: all channels)duration(float, optional): Duration in seconds to load (default: entire file)save_plots(bool): Save plots instead of displaying (default: False)save_path(str, optional): Custom save directory (default:plots/{subject_name})
Examples:
# Load T6 and T2 channels for 20 minutes
loader.load_and_plot_signals(signal_indices=[15, 25], duration=1200.0)
# Load all channels and save plots
loader.load_and_plot_signals(save_plots=True)
# Load specific duration with custom save path
loader.load_and_plot_signals(duration=1200.0, save_plots=True, save_path="custom_plots")
Output:
- Time-series plots with time axis in seconds
- Saved to
plots/{subject_name}/signals_plot.png(if save_plots=True)
TriggerDetector
Detects triggers and analyzes inter-trigger windows.
Initialization
detector = TriggerDetector(edf_loader, signal_choice)
Parameters:
edf_loader(EDFLoader): Initialized EDFLoader instancesignal_choice(str): Channel name for trigger detection (e.g., 'T2', 'O1')
Methods
detect_triggers()
Detects trigger events using amplitude thresholding.
Algorithm:
- Rectifies and filters the signal (Butterworth low-pass, 30 Hz cutoff)
- Applies amplitude threshold (60 µV)
- Filters events by duration (52-65 seconds)
detector.detect_triggers()
print(f"Found {len(detector.df_triggers)} triggers")
Output:
df_triggersDataFrame with columns:start_index,end_index: Sample indicesstart_time (s),end_time (s): Time in secondsduration_time (s): Trigger duration
plot_triggers()
Visualizes detected triggers overlaid on the filtered signal.
detector.plot_triggers()
save_triggers()
Saves trigger information to CSV file.
detector.save_triggers()
Output: {subject_folder}/triggers.csv
plot_windows()
Generates individual plots for each inter-trigger window.
detector.plot_windows()
Output: {subject_folder}/window plots/plot_{i}.png
convert_to_video()
Creates MP4 video from window plots for rapid review.
detector.convert_to_video()
Output: {subject_folder}/trigger.mp4
filter_bad_windows(clf_path=None, classes_path=None)
ML-based filtering of poor-quality windows using ResNet-50 + logistic regression.
# Use built-in models (recommended)
detector.filter_bad_windows()
# Or use custom models
detector.filter_bad_windows(
clf_path="path/to/custom_classifier.pkl",
classes_path="path/to/custom_classes.npy"
)
Parameters:
clf_path(str, optional): Path to custom classifier (.pkl file). Uses built-in model if None.classes_path(str, optional): Path to custom class labels (.npy file). Uses built-in model if None.
Analyzer
Performs frequency-domain analysis of inter-trigger windows.
Initialization
analyzer = Analyzer(loader, trigger_detector, target_length=50)
Parameters:
loader(EDFLoader): Initialized EDFLoader instancetrigger_detector(TriggerDetector): Initialized TriggerDetector instancetarget_length(int): Resampled points per segment for aggregation
Methods
plot_signal_window(window_index, lead)
Plots raw signal for a specific inter-trigger window.
analyzer.plot_signal_window(window_index=0, lead='T2')
plot_average_window(channel, start_window=None, end_window=None, target_length=500, aggregation_method='mean', trim_ratio=0.1)
Aggregates and plots multiple windows using various statistical methods.
Parameters:
channel(str): Channel name to analyzestart_window,end_window(int, optional): Window rangetarget_length(int): Resampling lengthaggregation_method(str): 'mean', 'median', or 'trimmed'trim_ratio(float): Trimming ratio for 'trimmed' method
Examples:
# Mean aggregation
analyzer.plot_average_window('T6', aggregation_method='mean')
# Robust median aggregation
analyzer.plot_average_window('T6', aggregation_method='median')
# Trimmed mean (removes 10% outliers)
analyzer.plot_average_window('T6', aggregation_method='trimmed', trim_ratio=0.1)
extract_signals(channels_to_extract=None)
Comprehensive frequency-domain analysis across all EEG bands.
Parameters:
channels_to_extract(list, optional): Specific channels to process (default: all loaded)
Processing Pipeline:
-
Band-pass filtering for each EEG band:
- Delta (0.5-4 Hz)
- Theta (4-8 Hz)
- Alpha (8-12 Hz)
- Beta (12-30 Hz)
- Gamma (30-80 Hz)
-
Signal rectification (absolute value for power estimation)
-
Moving-average smoothing with multiple window sizes:
- 100 ms, 250 ms, 500 ms
-
Median aggregation across all windows for robustness
Examples:
# Process all loaded channels
analyzer.extract_signals()
# Process specific channels only
analyzer.extract_signals(['T2', 'T6', 'O1'])
FOOOFAnalyzer
Performs spectral parameterization using SpecParam (formerly FOOOF - Fitting Oscillations & One Over F) to separate neural power spectra into aperiodic (1/f background) and periodic (oscillatory peaks) components. This provides insights into the underlying neural dynamics beyond traditional frequency band analysis. The analyzer automatically uses the modern SpecParam library with FOOOF fallback for compatibility.
Initialization
fooof_analyzer = FOOOFAnalyzer(edf_loader)
Parameters:
edf_loader(EDFLoader): Initialized EDFLoader instance with loaded signals
Methods
set_frequency_range(freq_range)
Set the frequency range for FOOOF analysis.
fooof_analyzer.set_frequency_range((1, 50)) # Analyze 1-50 Hz
set_fooof_settings(**kwargs)
Customize FOOOF model parameters.
fooof_analyzer.set_fooof_settings(
max_n_peaks=8, # Maximum number of peaks to fit
peak_threshold=1.5, # Peak detection threshold
aperiodic_mode='knee', # 'fixed' or 'knee' for aperiodic fit
peak_width_limits=(1, 12) # Peak width constraints
)
analyze_signals(channels_to_analyze=None)
Run FOOOF analysis on specified channels and save comprehensive results.
Parameters:
channels_to_analyze(list, optional): Specific channels to process (default: all loaded)
Processing Pipeline:
- Signal preprocessing: Detrending, bandpass filtering, notch filtering
- Power spectral density: Welch's method with configurable parameters
- FOOOF fitting: Separates aperiodic and periodic components
- Band power calculation: Traditional frequency band powers
- Comprehensive output: Individual and summary results
# Analyze all loaded channels
fooof_analyzer.analyze_signals()
# Analyze specific channels
fooof_analyzer.analyze_signals(['T2', 'T6', 'O1'])
Output Structure:
data/subject_name/
└── fooof_analysis/
├── fooof_summary.csv # Summary across all channels
├── band_powers_summary.csv # Band powers across all channels
├── aperiodic_exponent_summary.png # Aperiodic exponent comparison
├── n_peaks_summary.png # Peak count comparison
├── band_powers_heatmap.png # Band power heatmap
└── T2/ # Per-channel results
├── T2_fooof_fit.png # Spectral parameterization model fit
├── T2_psd.png # Power spectral density
├── T2_fooof_params.csv # Spectral parameterization parameters
├── T2_band_powers.csv # Traditional band powers
└── T2_fooof_settings.json # Analysis settings
plot_channel_comparison(channels=None, metric='aperiodic_exponent')
Compare FOOOF metrics across channels.
Parameters:
channels(list, optional): Channels to compare (default: all analyzed)metric(str): Metric to compare - 'aperiodic_exponent', 'aperiodic_offset', 'n_peaks', 'r_squared', 'error'
# Compare aperiodic exponents (1/f slope)
fooof_analyzer.plot_channel_comparison(metric='aperiodic_exponent')
# Compare number of detected peaks
fooof_analyzer.plot_channel_comparison(metric='n_peaks')
# Compare model fit quality
fooof_analyzer.plot_channel_comparison(metric='r_squared')
Spectral Parameterization Analysis Workflow
from yousif_raiyan_pip_package import EDFLoader, FOOOFAnalyzer
# Load EEG data
loader = EDFLoader("data", "subject_name")
loader.load_and_plot_signals(duration=1200.0)
# Initialize spectral parameterization analyzer
fooof_analyzer = FOOOFAnalyzer(loader)
# Optional: Customize analysis parameters
fooof_analyzer.set_frequency_range((1, 50))
fooof_analyzer.set_fooof_settings(
max_n_peaks=8,
peak_threshold=1.5,
aperiodic_mode='knee'
)
# Run analysis
fooof_analyzer.analyze_signals()
# View comparisons
fooof_analyzer.plot_channel_comparison(metric='aperiodic_exponent')
fooof_analyzer.plot_channel_comparison(metric='n_peaks')
# Access results programmatically
for channel, result in fooof_analyzer.results.items():
print(f"Channel {channel}:")
print(f" Aperiodic exponent: {result['aperiodic_params'][1]:.3f}")
print(f" Number of peaks: {len(result['peak_params'])}")
if len(result['peak_params']) > 0:
dominant_peak = result['peak_params'][np.argmax(result['peak_params'][:, 1])]
print(f" Dominant peak: {dominant_peak[0]:.1f} Hz")
Spectral Parameterization Results Interpretation
Aperiodic Parameters:
- Offset: Overall power level (y-intercept of 1/f fit)
- Exponent: 1/f slope (higher = steeper decay, more "pink" noise)
Peak Parameters (per detected peak):
- Center Frequency: Peak frequency in Hz
- Power: Peak height above aperiodic background
- Bandwidth: Full-width at half-maximum of the peak
Quality Metrics:
- R-squared: Proportion of variance explained by the model
- Error: Mean absolute error between model and data
Clinical Relevance:
- Aperiodic exponent: Reflects E/I balance, aging, cognitive state
- Peak parameters: Identify dominant rhythms (alpha, beta, etc.)
- Band powers: Traditional frequency analysis for comparison
EEGGraphProcessor
Converts EEG data to graph representations for network analysis and computes time-varying connectivity measures. By default, all outputs are saved in the subject directory (same location as the EDF file) in an organized structure.
Initialization
processor = EEGGraphProcessor(
edf_loader=loader,
output_dir=None, # Optional: custom output directory (defaults to subject directory)
window_size=1000, # Optional: analysis window size in samples
adj_window_size=20000, # Optional: adjacency matrix window size
window_step_ratio=0.125 # Optional: window overlap ratio
)
Default Output Structure:
data/subject_name/
├── subject_name.edf
└── graph_representation/ # Created automatically
├── graphs/ # Full graph representations
├── correlation/ # Correlation matrices
│ └── plots/ # Correlation visualizations
└── coherence/
├── average/ # Average coherence matrices
│ └── plots/ # Average coherence visualizations
└── bands/ # Frequency-band coherence matrices
└── plots/ # Band-specific visualizations
Methods
generate_graphs_from_edf()
Creates comprehensive graph representations with adjacency matrices and node/edge features.
Features Generated:
- Adjacency matrices: Correlation, coherence, phase relationships
- Node features: Energy, band-specific energy across frequency bands
- Edge features: Connectivity measures across frequency bands
- Memory efficient: Streams directly from EDF files
processor.generate_graphs_from_edf()
# Output: {filename}.pickle with graph representations
compute_correlation(start_time, stop_time, interval_seconds, overlap_ratio=0.0)
Computes time-varying correlation matrices over specified time segments.
Parameters:
start_time(float): Start time in secondsstop_time(float): End time in secondsinterval_seconds(float): Window duration for each correlation matrixoverlap_ratio(float): Overlap between windows (0.0 = no overlap, 0.5 = 50% overlap)
# Compute correlation every 5 seconds from 10-60s with 50% overlap
path = processor.compute_correlation(
start_time=10.0,
stop_time=60.0,
interval_seconds=5.0,
overlap_ratio=0.5
)
Output: correlation/{filename}_{start}s-{stop}s_correlation.pickle containing:
{
"starts": [10.0, 12.5, 15.0, ...], # Window start times
"corr_matrices": [matrix1, matrix2, ...] # Correlation matrices
}
compute_coherence_average(start_time, stop_time, interval_seconds, overlap_ratio=0.0)
Computes time-varying coherence matrices averaged across all frequency bands.
# Simple averaged coherence analysis
path = processor.compute_coherence_average(
start_time=10.0,
stop_time=60.0,
interval_seconds=5.0
)
Output: coherence/average/{filename}_{start}s-{stop}s_coherence_avg.pickle containing:
{
"starts": [10.0, 15.0, 20.0, ...],
"coherence_matrices": [matrix1, matrix2, ...] # Averaged coherence
}
compute_coherence_bands(start_time, stop_time, interval_seconds, overlap_ratio=0.0)
Computes detailed frequency-specific coherence analysis across EEG bands.
# Detailed frequency-band coherence analysis
path = processor.compute_coherence_bands(
start_time=10.0,
stop_time=60.0,
interval_seconds=5.0,
overlap_ratio=0.25
)
Output: coherence/bands/{filename}_{start}s-{stop}s_coherence_bands.pickle containing:
{
"starts": [10.0, 15.0, 20.0, ...],
"coherence_by_band": {
"delta": [matrix1, matrix2, ...], # 1-4 Hz
"theta": [matrix1, matrix2, ...], # 4-8 Hz
"alpha": [matrix1, matrix2, ...], # 8-13 Hz
"beta": [matrix1, matrix2, ...], # 13-30 Hz
"gamma": [matrix1, matrix2, ...], # 30-70 Hz
"gammaHi": [matrix1, matrix2, ...], # 70-100 Hz
# Additional bands based on sampling frequency
},
"frequency_bands": {
"delta": (1, 4), "theta": (4, 8), "alpha": (8, 13), ...
}
}
plot_connectivity_matrices(plot_types=None, time_range=None, output_subdir="plots", save_individual=True, save_summary=True, dpi=150, figsize=(10, 8))
Generates comprehensive visualizations of connectivity matrices with full EEG channel names on axes.
Parameters:
plot_types(list): Types to plot -["correlation", "coherence_avg", "coherence_bands"](default: all available)time_range(tuple):(start_time, stop_time)to filter plots (default: all time windows)output_subdir(str): Subdirectory name for plots (default: "plots")save_individual(bool): Save individual matrix plots (default: True)save_summary(bool): Save summary/comparison plots (default: True)dpi(int): Plot resolution (default: 150)figsize(tuple): Figure size as (width, height) (default: (10, 8))
Features:
- Full channel names: All EEG channel names (Fp1, F3, C3, etc.) displayed on both axes
- Organized output: Plots saved alongside data in intuitive directory structure
- Multiple plot types: Individual matrices, time series summaries, frequency band comparisons
- Flexible filtering: Plot specific time ranges or connectivity types
- High-quality output: Publication-ready plots with proper labeling
# Plot all available connectivity data
results = processor.plot_connectivity_matrices()
# Plot only correlation matrices
results = processor.plot_connectivity_matrices(plot_types=["correlation"])
# Plot coherence with time filtering
results = processor.plot_connectivity_matrices(
plot_types=["coherence_avg", "coherence_bands"],
time_range=(100, 200), # Only plot 100-200 second window
save_individual=True,
save_summary=True
)
# Custom plot settings
results = processor.plot_connectivity_matrices(
dpi=300, # High resolution
figsize=(12, 10), # Larger plots
output_subdir="publication_plots"
)
Output Structure:
graph_representation/
├── correlation/
│ ├── data.pickle
│ └── plots/
│ ├── individual/
│ │ ├── correlation_t010.0s.png
│ │ ├── correlation_t020.0s.png
│ │ └── ...
│ └── correlation_summary.png
├── coherence/
│ ├── average/
│ │ ├── data.pickle
│ │ └── plots/
│ │ ├── individual/
│ │ │ ├── coherence_avg_t010.0s.png
│ │ │ └── ...
│ │ └── coherence_avg_summary.png
│ └── bands/
│ ├── data.pickle
│ └── plots/
│ ├── individual/
│ │ ├── delta/
│ │ │ ├── delta_coherence_t010.0s.png
│ │ │ └── ...
│ │ ├── theta/
│ │ ├── alpha/
│ │ ├── beta/
│ │ └── gamma/
│ └── band_coherence_summary.png
Graph Analysis Workflow
from yousif_raiyan_pip_package import EDFLoader, EEGGraphProcessor
# Load EEG data
loader = EDFLoader("data", "subject_name")
loader.load_and_plot_signals(duration=1200.0)
# Initialize graph processor
processor = EEGGraphProcessor(edf_loader=loader)
# Option 1: Full graph representation (for GNN analysis)
processor.generate_graphs_from_edf()
# Option 2: Time-varying connectivity analysis
# Simple correlation over time
corr_path = processor.compute_correlation(
start_time=0, stop_time=300, interval_seconds=10
)
# Average coherence analysis
coh_avg_path = processor.compute_coherence_average(
start_time=0, stop_time=300, interval_seconds=10
)
# Detailed frequency-band coherence
coh_bands_path = processor.compute_coherence_bands(
start_time=0, stop_time=300, interval_seconds=10, overlap_ratio=0.5
)
# Generate comprehensive visualizations
plot_results = processor.plot_connectivity_matrices()
print("Plots saved to:", plot_results)
# Or plot specific types with time filtering
processor.plot_connectivity_matrices(
plot_types=["coherence_bands"],
time_range=(50, 250), # Focus on specific time window
save_summary=True
)
# Load and analyze results programmatically
import pickle
with open(coh_bands_path, 'rb') as f:
coherence_data = pickle.load(f)
# Access specific frequency band
alpha_coherence = coherence_data['coherence_by_band']['alpha']
time_points = coherence_data['starts']
Output Structure
The package creates organized output directories with all outputs defaulting to the subject directory:
data/
└── subject_name/
├── subject_name.edf # Input EDF file
├── triggers.csv # Detected triggers
├── window plots/ # Inter-trigger window plots
│ ├── plot_0.png
│ ├── plot_1.png
│ └── ...
├── trigger.mp4 # Video compilation
├── fooof_analysis/ # Spectral parameterization outputs
│ ├── fooof_summary.csv # Summary across all channels
│ ├── band_powers_summary.csv # Band powers across all channels
│ ├── aperiodic_exponent_summary.png # Aperiodic exponent comparison
│ ├── n_peaks_summary.png # Peak count comparison
│ ├── band_powers_heatmap.png # Band power heatmap
│ └── T2/ # Per-channel results
│ ├── T2_fooof_fit.png # Spectral parameterization model fit
│ ├── T2_psd.png # Power spectral density
│ ├── T2_fooof_params.csv # Spectral parameterization parameters
│ ├── T2_band_powers.csv # Traditional band powers
│ └── T2_fooof_settings.json # Analysis settings
├── graph_representation/ # EEGGraphProcessor outputs
│ ├── graphs/
│ │ └── subject_name.pickle # Full graph representations
│ ├── correlation/
│ │ ├── subject_name_0s-300s_correlation.pickle
│ │ └── plots/
│ │ ├── individual/ # Individual matrix plots
│ │ └── correlation_summary.png
│ └── coherence/
│ ├── average/
│ │ ├── subject_name_0s-300s_coherence_avg.pickle
│ │ └── plots/
│ │ ├── individual/
│ │ └── coherence_avg_summary.png
│ └── bands/
│ ├── subject_name_0s-300s_coherence_bands.pickle
│ └── plots/
│ ├── individual/
│ │ ├── delta/ # Per-band matrix plots
│ │ ├── theta/
│ │ ├── alpha/
│ │ ├── beta/
│ │ └── gamma/
│ └── band_coherence_summary.png
├── Delta/ # Frequency band results (Analyzer)
│ ├── csv/
│ │ ├── T2_Delta_ma100ms_median.csv
│ │ └── ...
│ └── plots/
│ ├── T2_Delta_ma_plot.png
│ └── ...
├── Theta/
├── Alpha/
├── Beta/
└── Gamma/
Complete Workflow Example
from yousif_raiyan_pip_package import EDFLoader, TriggerDetector, Analyzer, FOOOFAnalyzer
# Step 1: Load EEG data
loader = EDFLoader("data", "Sebastian")
loader.inspect_data() # Review file structure
# Load temporal channels for analysis
loader.load_and_plot_signals(
signal_indices=[15, 25], # T6, T2 channels
duration=1200.0, # 20 minutes
save_plots=True
)
# Step 2: Detect triggers
detector = TriggerDetector(loader, 'T2')
detector.detect_triggers()
print(f"Found {len(detector.df_triggers)} triggers")
# Visualize and save results
detector.plot_triggers()
detector.save_triggers()
detector.plot_windows()
detector.convert_to_video()
# Step 3: Frequency-domain analysis
analyzer = Analyzer(loader, detector, target_length=50)
# Test different aggregation methods
analyzer.plot_average_window('T2', aggregation_method='mean')
analyzer.plot_average_window('T2', aggregation_method='median')
analyzer.plot_average_window('T2', aggregation_method='trimmed', trim_ratio=0.1)
# Full multi-band analysis
analyzer.extract_signals(['T6', 'T2']) # Process specific channels
# Step 4: Spectral parameterization
fooof_analyzer = FOOOFAnalyzer(loader)
# Optional: Customize settings
fooof_analyzer.set_frequency_range((1, 50))
fooof_analyzer.set_fooof_settings(max_n_peaks=8, aperiodic_mode='knee')
# Run spectral parameterization analysis
fooof_analyzer.analyze_signals(['T6', 'T2'])
# Compare results across channels
fooof_analyzer.plot_channel_comparison(metric='aperiodic_exponent')
fooof_analyzer.plot_channel_comparison(metric='n_peaks')
Advanced Usage
Custom Trigger Detection Parameters
The trigger detection uses hardcoded parameters optimized for trigger detection:
- Threshold: 60 µV
- Duration range: 52-65 seconds
- Filter: 30 Hz low-pass Butterworth
Memory Management
For large EDF files:
- Use
durationparameter to limit data loading - Use
signal_indicesto select specific channels - Enable
save_plots=Trueto avoid memory issues with display
ML-Based Quality Control
For automated window quality assessment:
- Train a ResNet-50 + logistic regression model on labeled window images
- Save the classifier and class labels
- Use
filter_bad_windows()to automatically remove poor-quality segments
Dependencies
- numpy
- scipy
- mne
- pyedflib
- matplotlib
- pandas
- opencv-python
- torch
- torchvision
- joblib
- scikit-learn
- Pillow
- specparam (with fooof fallback)
Requirements
- Python ≥ 3.7
- Sufficient RAM for EEG data (recommend 8GB+ for large files)
- GPU optional (for ML-based filtering)
Citation
If you use this package in your research, please cite:
[Your citation information here]
License
MIT License
Support
For questions or issues, please contact the package maintainer.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yousif_raiyan_pip_package-1.6.23.tar.gz.
File metadata
- Download URL: yousif_raiyan_pip_package-1.6.23.tar.gz
- Upload date:
- Size: 72.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9285f2cf73f99d4efc49689632e71904cfa1ab3f60b0b0e8c5c1328fd99f0902
|
|
| MD5 |
a3b8538e1f6e7be00eea024898fdad40
|
|
| BLAKE2b-256 |
1ded0982bec0eafd0089c314f4a13e2cd883f11e8e598f18e812ebea789b813b
|
File details
Details for the file yousif_raiyan_pip_package-1.6.23-py3-none-any.whl.
File metadata
- Download URL: yousif_raiyan_pip_package-1.6.23-py3-none-any.whl
- Upload date:
- Size: 57.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb9791a57daaddbf53b1739cb3632a570a76ee89126d40157c17982d88bbbb03
|
|
| MD5 |
1934115c51124fbfbc9ae13490cba1fe
|
|
| BLAKE2b-256 |
c3c4f4d55b8a405b8796e5845472a4282b84e6cc0b22e3befc82eff595b3f663
|