w_inh = w_i / n r1_matrix = np.ones((n, n)) patterns = np.identity(n) patterns = [patterns[:, i] for i in range(n)] mystim = stimulus(patterns, lagStim, delta, period, times) mystim.inten = amp # integrator npts = int(np.floor(delay / dt) + 1) # points delay tmax = times * (lagStim + n * (period + delta)) + 40 # initial conditions x0 = 0.01 * np.ones((npts, n)) W0 = [(wmax / n) * np.ones((n, n)) for i in range(npts)] theintegrator = myintegrator(delay, dt, n, tmax) theintegrator.fast = False rowsum, u, Wdiag, Woffdiag, connectivity, W01, t = theintegrator.DDE_Norm_additive(field, x0, W0) # new instance of the model # with no stimulation # and using W int as the matrix after learning # to see is sequences arise tmax = 200.0 mystim.inten = 0.0 x0 = np.zeros(n) x0[0] = 9.5 x0 = np.array([x0 for i in range(npts)]) W0 = [W01 for i in range(npts)]
#integrator npts = int(np.floor(delay / dt) + 1) # points delay tmax = times * (lagStim + n * (period + delta)) + 100. + mystim.delay_begin thetmax = tmax + 40000 #t = np.linspace(0,thetmax,100000) u, uI, connectivity, WEI, t = pickle.load(open('dyn_stimulation_SA.p', 'rb')) #----------------------------------------------------------------------------------------- #-------------------------------- Dynamics----------------------------------------------- #---------------------------------------------------------------------------------------- #initial conditions tmaxdyn = 500 mystim.inten = 0. theintegrator = myintegrator(delay, dt, n, tmaxdyn) theintegrator.fast = False #integration u_ret, uI_ret, connectivity_ret, WEI_ret, t_ret = pickle.load( open('dyn_retrieval_SA.p', 'rb')) u_ret_PA, uI_ret_PA, connectivity_ret_PA, WEI_ret_PA, t_ret_PA = pickle.load( open('dyn_retrieval_PA.p', 'rb')) #------------------------------------------------------------------- #-----------------Stimulation of Populations------------------------ #------------------------------------------------------------------- rc = { 'axes.labelsize': 32, 'font.size': 30,
mystim.inten=amp #integrator npts=int(np.floor(delay/dt)+1) # points delay tmax=times*(lagStim+n*(period+delta))+100.+mystim.delay_begin thetmax=tmax+15.5*tau_H #initial conditions a0=np.zeros((npts,n)) x0=0.1*np.ones((npts,n)) W0=[0.1*np.ones((n,n)) for i in range(npts)] H0=[np.array([0.1 for i in range(n)]) for i in range(npts)] #H0=[np.array([19.52158144,13.31267976,13.35448593,13.35612847,13.35535822,13.35451532,13.35366458,13.35281449,13.35258073,13.35252602]) for i in range(npts)] #H0=[0.5*np.ones(n) for i in range(npts)] theintegrator=myintegrator(delay,dt,n,thetmax) theintegrator.fast=False adapt,u,connectivity,W01,myH,t=theintegrator.DDE_Norm_Miller(field,a0,x0,W0,H0) W0=[0.1*np.ones((n,n)) for i in range(npts)] H0=[0.1*np.ones(n) for i in range(npts)] adaptQ,uQ,connectivityQ,W01Q,myHQ,tQ=theintegrator.DDE_Norm_Miller(fieldQuadratic,a0,x0,W0,H0) print 'Linear' print myH[-1] print connectivity[-1] print 'Quadratic' print myHQ[-1] print connectivityQ[-1] #----------------------------------------------------------------------
allRecurrentTheo=[] allFFTheo=[] # storing rate dynamics mydyn=[] for param in delta_T: net.w_i=wi # setting up the inhibition level elT=param[0] eldelta=param[1] net.tau_learning=400. net.setStim(net.amp,eldelta,elT,net.times) # setting up the stimulus valueRecurrent=[net.w0] valueFF=[net.w0] #integrator tmax=net.times*(net.lagStim+net.n*(elT+eldelta))+net.mystim.delay_begin+5000. thetmax=tmax theintegrator=myintegrator(net.delay,net.dt,net.n,thetmax) theintegrator.fast=False u,connectivity,W01,myH,t=theintegrator.DDE_Norm_Miller(net.field,x0,W0,H0,net.mystim.stim) for k in range(net.times): eltiempo=int((net.mystim.delay_begin+k*net.n*(elT+eldelta)+net.lagStim*(k-1)+net.lagStim/2.)/net.dt) valueRecurrent.append(connectivity[eltiempo,5,5]) valueFF.append(connectivity[eltiempo,6,5]) a0_1=np.zeros((net.npts,net.n)) x0_1=np.zeros((net.npts,net.n)) x0_1[:,0]=np.ones(net.npts) W0_1=[connectivity[-1,:,:] for i in range(net.npts)] H0_1=[np.ones(net.n) for i in range(net.npts)] net.setStim(0,net.delta,net.T,net.times) net.tau_learning=3e60