CODE IN PYTHON NAME :- Ankit kumar
import numpy as np
Ne=400 # Excitatory neurons
Ni=200 # Inhibitory neurons
float_type = [Link]
re=[Link](Ne).astype(float_type)
ri=[Link](Ni).astype(float_type)
#The parameter "a" describes the time scale of the recovery variable u
a=[Link]((0.02*[Link](Ne),0.02+0.08*ri)).astype(float_type)
#The parameter "b" describes the sensitivity of the recovery variable
# u to the subthreshold fluctuations of the membrane potential v
b=[Link]((0.2*[Link](Ne),0.25-0.05*ri)).astype(float_type)
#parameter c describes the after-spike reset value of the membrane potential v caused by
the fast high-threshold K+ conductance
c=[Link]((-65+15*re**2,-65*[Link](Ni))).astype(float_type)
#The parameter d describes after-spike reset of the recovery variable u caused by slow h
igh-threshold Na+ and K+ conductances
d=[Link]((8-6*re**2,2*[Link](Ni))).astype(float_type)
# Excitatory and Inhibitory weights
S=[Link]([0.5*[Link](Ne+Ni,Ne),\
-[Link](Ne+Ni,Ni)]).astype(float_type)
# Initial membrane voltage
v=-65*[Link](Ne+Ni, dtype=float_type)
# State variable (recovery)
u=(b*v)
Nsteps = 1000 # simulation of 1000 ms
step = 0.5 # step 0.5 ms
step_3 = step/3.0
firings_ids=[Link]((Nsteps,Ne+Ni),dtype=float_type)
voltages=[Link]((Nsteps,Ne+Ni),dtype=float_type)
voltages_cropped=[Link]((Nsteps,Ne+Ni),dtype=float_type)
I=[Link]((5*[Link](loc=0,scale=1,size=Ne),\
2*[Link](loc=0,scale=1,size=Ni))).astype(float_type) # t
halamic input
C:\Users\ankit\anaconda3\lib\site-packages\ipykernel_launcher.py:5: Deprecation
Warning: `[Link]` is a deprecated alias for the builtin `float`. To silence t
his warning, use `float` by itself. Doing this will not modify any behavior and
is safe. If you specifically wanted the numpy scalar type, use `np.float64` her
e.
Deprecated in NumPy 1.20; for more details and guidance: [Link]
ocs/release/[Link]#deprecations
"""
for t in range(Nsteps):
I=[Link]((5*[Link](loc=0,scale=1,size=Ne),\
2*[Link](loc=0,scale=1,size=Ni))).astype(float_
type) # thalamic noisy input
fired=(v>=30) # finds spiking neurons indices
firings_ids[t,:]=fired
voltages[t,:]=v # I'm saving before the cropping
v[fired]=c[fired]
voltages_cropped[t,:]=v # Here I'm saving after crop
u[fired]=u[fired]+d[fired]
I=I+S[:,fired].sum(axis=1)
# Integration
v+=step*(0.04*v**2+5*v+140-u+I)
u+=step*a*(b*v-u)
ids=[Link](1,Ne+Ni+1)
pfired = []
tfired = []
for t,fired in zip(range(Nsteps),firings_ids):
res=ids[fired==1]
for fi in res:
[Link](fi)
[Link](t)
pfired = [Link](pfired)
tfired = [Link](tfired)
import [Link] as plt
%matplotlib inline
[Link](tfired*step,pfired,'.')
[Link]("t(ms)")
[Link]("neuron index")
[Link]()