Ejemplo n.º 1
0
import scipy as sp
from scipy import signal
import seaborn as sns
import pickle

prefs.codegen.target = "numpy"
print('modules loaded')

#%% Simulation details

# import parameters_sim.py file
import parameters_sim

print('Parameters file imported')

parameters_sim.neuron_num(
)  # neuron number specific to configuration and layer

simtime = 5000 * ms  # sim. time
#%% Spike count per layer

#### requires all input frequencies and gvariables for a configuration ####

count_g = 0
gvariable = linspace(0, 10, 21)
input_r = linspace(0, 70, 8)

output_spikemon_L4 = zeros(
    ((len(input_r)), len(gvariable)))  # define empty matrices to store data
output_spikemon_L23 = zeros(((len(input_r)), len(gvariable)))

for g in gvariable:
Ejemplo n.º 2
0
#%% define Coefficient of Variation


def CV(spikes):
    '''
    Coefficient of variation
    '''
    if spikes == []:
        return 0
    ISI = diff(spikes)  # Interspike intervals
    return std(ISI) / mean(ISI)  # standard deviation ISI/mean ISI


#%% Analysis (over input frequencies 10-70Hz ; all synaptic ratios)

parameters_sim.neuron_num()

gvariable = linspace(0, 10, 21)
input_r = linspace(10, 70, 7)

# Initialize trains to 0
train_4_e = 0
train_4_i = 0
train_23_e = 0
train_23_i = 0

# Define empty matrices to store data
mean_cv_4_e = full(((len(input_r)), len(gvariable)), nan)
mean_cv_4_i = full(((len(input_r)), len(gvariable)), nan)

mean_cv_23_e = full(((len(input_r)), len(gvariable)), nan)
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import scipy as sp
from scipy import signal
import seaborn as sns
import pickle

prefs.codegen.target = "numpy" # avoid error message
print('Libraries loaded')

#%% Simulation details

# import parameters.py file
import parameters_sim
print('Parameters file imported')

parameters_sim.neuron_num() # input neuron numbers

simtime             = 5000*ms   # simulation time
dt_value = 0.1

#%% Coefficient of correlation Matrix  
#### Calculated per configuration --- at a particular input frequency --- at a particular synaptic ratio ####
count_g = 0
gvariable = linspace(0,10,21)

for g in gvariable:
    g = g
    count_g = count_g + 1
    
    print('Analysing data for g = ' + str(g))
   
import matplotlib
import matplotlib.ticker
import numpy as np
import scipy as sp
from scipy import signal
import pickle
from brian2 import *
from brian2.core.network import TextReport

prefs.codegen.target = "numpy"  # avoid error message during code compilation

#%% Parameters

import parameters_sim

parameters_sim.neuron_num()  # neuron numbers from README.md
parameters_sim.prob_vals()  # network upscaling probablilty values

# projection widths
sigmaffwd_4, sigmaRe_4, sigmaRi_4 = .1 * mmeter, .05 * mmeter, .03 * mmeter  # L4
sigmaffwd_23, sigmaRe_23, sigmaRi_23 = .05 * mmeter, .15 * mmeter, .03 * mmeter  # L2/3

# LIF model characterisitics
# excitatory neurons
taumem_e = 15 * ms  # membrane time constant
vT_e = -50 * mV  # threshold voltage
El_e = -60 * mV  # membrane potential
vre_e = -65 * mV  # reset voltage
tref_e = 1.5 * ms  # refractory period

# inhibitory neurons
from random import sample
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
from IPython.core.debugger import Pdb
ipdb = Pdb()
import scipy
import scipy as sp
from scipy import signal

#%% Sim. details

import parameters_sim  # import parameter file

parameters_sim.neuron_num()  # load neuron numbers

# Simtime
simtime = 5000 * ms
dt_value = 0.1

#%% Gaussian spikes function


def gaussian(spiketrain, truncate=3, sigma=500):
    # spiketrain =  binary spiketrain

    # Width of function
    window_size = 2 * int(truncate * sigma + 0.5) + 1

    # Gaussian function