brainbox.lfp
Created on Fri Mar 13 14:57:53 2020
Functions to analyse LFP signals
@author: Guido Meijer
Functions
Calculate the coherence between two LFP signals 

Calculate the power spectrum of an LFP signal 
 power_spectrum(signal, fs=2500, segment_length=0.5, segment_overlap=0.5, scaling='density')[source]
Calculate the power spectrum of an LFP signal
 Parameters
signal (2D array) – LFP signal from different channels in V with dimensions (channels X samples)
fs (int) – Sampling frequency
segment_length (float) – Length of the segments for which the spectral density is calcualted in seconds
segment_overlap (float) – Fraction of overlap between the segments represented as a float number between 0 (no overlap) and 1 (complete overlap)
 Returns
freqs (1D array) – Frequencies for which the spectral density is calculated
psd (2D array) – Power spectrum in V^2 with dimensions (channels X frequencies)
 coherence(signal_a, signal_b, fs=2500, segment_length=1, segment_overlap=0.5)[source]
Calculate the coherence between two LFP signals
 Parameters
signal_a (1D array) – LFP signal from different channels with dimensions (channels X samples)
fs (int) – Sampling frequency
segment_length (float) – Length of the segments for which the spectral density is calcualted in seconds
segment_overlap (float) – Fraction of overlap between the segments represented as a float number between 0 (no overlap) and 1 (complete overlap)
 Returns
freqs (1D array) – Frequencies for which the coherence is calculated
coherence (1D array) – Coherence takes a value between 0 and 1, with 0 or 1 representing no or perfect coherence, respectively
phase_lag (1D array) – Estimate of phase lag in radian between the input time series for each frequency