plastic_balanced_network.helpers module
Functions to analyze activity of plastic balanced network.
- plastic_balanced_network.helpers.average_cov_corr_over_subpops(C, N, frac_exc=0.8)[source]
Average covariances or correlations over subpopulations.
- Parameters:
C (np.ndarray) – Matrix of covariances or correlations.
N (int) – Total number of neurons.
frac_exc (float) – Fraction of E neurons. Defaults to 0.8.
- Returns:
mC – Mean spike count covariance or correlation matrix.
- Return type:
np.ndarray
- plastic_balanced_network.helpers.compute_firing_rate(s, T, N, frac_exc=0.8, dtRate=10, window_size=10)[source]
Calculate the mean firing rate of E and I populations as a function of time.
- Parameters:
s (np.ndarray) – Spike trains of all neurons.
T (int) – Total simulation time in milliseconds.
N (int) – Total number of neurons.
frac_exc (float) – Fraction of E neurons. Defaults to 0.8.
dtRate (int) – Size of time bin to count spikes over. Defaults to 10 ms.
window_size (int) – Size of window for moving average. Defaults to 10 bins.
- Returns:
eRateT (np.ndarray) – Smoothed time varying firing rate of E neurons.
iRateT (np.ndarray) – Smoothed time varying firing rate of I neurons.
timeVector (np.ndarray) – Discretized time domain.
- plastic_balanced_network.helpers.cov2corr(cov)[source]
convert covariance matrix to correlation matrix
- Parameters:
cov (np.ndarray) – Covariance matrix.
- Returns:
corr – Correlation matrix.
- Return type:
np.ndarray
- plastic_balanced_network.helpers.spike_count_cov(s, N, T1, T2, winsize=250)[source]
Compute NxN spike count covariance matrix. s is a 2x(ns) matrix where ns is the number of spikes s(0,:) lists spike times and s(1,:) lists corresponding neuron indices Neuron indices are assumed to go from 0 to N-1
Spikes are counts starting at time T1 and ending at time T2.
winsize is the window size over which spikes are counted, so winsize is assumed to be much smaller than T2-T1
- Parameters:
s (np.ndarray) – Spike trains of all neurons.
N (int) – Total number of neurons.
T1 (float or int) – Start time to count spikes for covariance calculation.
T2 (float or int) – End time to count spikes for covariance calculation.
winsize (int) – Time window over which spikes are counted. Defaults to 250 ms.
- Returns:
C – Full spike count covariance matrix.
- Return type:
np.ndarray