import numpy.random as rand import matplotlib.pyplot as plt p_range = [0, 0.1, 0.2, 0.3, 0.4, 0.5] # rewiring probabilities n_ex_layer=8 N_ex=100 N_in=200 T = 1000 # Simulation time Ib = 15.0 # extra current to be injected window = 50 # mean firing rate averaging window shift = 20 # mean firing rate shift step = 10 # bin size in histogram start_time = 0 # starting time for counting mean firing rate for p in p_range: net = create_izModularNetwork(p) ############# Q1(a) ############# vertical = {} for i in xrange(len(net.layer)): vertical[i] = np.concatenate(net.layer[i].S.values(), axis=1) network_matrix = np.concatenate(vertical.values(), axis=0) plt.matshow(network_matrix, fignum=100, cmap=plt.cm.gray) plt.title('Connection matrix (p=%.1f)' %p) # plt.show() plt.savefig('q1a_%.1f.svg' % p) plt.clf() ############# Q1(b) #############
from IzModularNetwork import create_izModularNetwork import numpy as np import numpy.random as rand import matplotlib.pyplot as plt ############# Q2 ############# T = 1000 * 5 # Simulation time Ib = 15.0 # extra current to be injected p = rand.random() net = create_izModularNetwork(p) ## Initialise layers for lr in xrange(len(net.layer)): net.layer[lr].v = -65 * np.ones(net.layer[lr].N) net.layer[lr].u = net.layer[lr].b * net.layer[lr].v net.layer[lr].firings = np.array([]) ## SIMULATE for t in xrange(T): # Deliver random background current to exhibitory layers for i in xrange(len(net.layer)-1): net.layer[i].I = Ib * rand.poisson(0.01, net.layer[i].N) net.layer[8].I = np.zeros(200)