This notebook analyzes Local Field Potential (LFP) signals in two frequency bands: HG (High Gamma) and HFO (High-Frequency Oscillation). The main workflow is:
-
Reading MATLAB (.mat) file
- Uses a helper function with
h5pyto read.matfiles in version 7.3 (not supported byscipy.io.loadmat). - Loads variables
lfpHGandlfpHFOand converts them to NumPy arrays.
- Uses a helper function with
-
Data Preparation
- Sets the sampling rate (
srate = 1000 Hz) and calculates time vectors. - Prepares signals for analysis and plotting.
- Sets the sampling rate (
-
Signal Visualization
- Plots both frequency band signals in the interval from 10 to 15 seconds.
- Creates plots with offset and calibration bars for easier interpretation.
-
Spectral Analysis (Welch PSD)
- Uses Welch's method (
scipy.signal.welch) to calculate the Power Spectral Density (PSD) of the signals. - Plots PSDs for each band separately and together for comparison.
- Uses Welch's method (
-
Theta Band Power Calculation (5–10 Hz)
- Calculates the mean power in the theta band for each channel.
-
Theta Power Visualization
- Plots a bar chart comparing theta power between HG and HFO.
-
Scale Comparison in PSD
- Plots the PSD of both channels on a linear scale (0–200 Hz) and a logarithmic scale.
-
Detailed Band Analysis
- PSD of HG in the range 0–15 Hz and HFO in the range 100–150 Hz, using different window sizes (full signal vs 1s window).
- Interpolates results for comparative visualization.
- h5py for reading
.matfiles (version 7.3). - NumPy for data manipulation.
- Matplotlib for signal and spectral visualization.
- SciPy (welch) for spectral analysis.
The notebook is designed for the analysis and visualization of local field potentials in different frequency bands, enabling comparison between bands, identification of spectral patterns, and calculation of power in specific ranges (such as the theta band).