Skip to content

Instantly share code, notes, and snippets.

@btel
Last active August 29, 2015 13:59
Show Gist options
  • Select an option

  • Save btel/10480251 to your computer and use it in GitHub Desktop.

Select an option

Save btel/10480251 to your computer and use it in GitHub Desktop.
numba implementation of LIF
@jit(double[:,:2](double[:], double[:], double, double, double))
def lif_model(ge, gi, dt=dt, vreset=0, vthresh=-40*mV):
v = vreset
mem_pot = np.zeros((len(ge), 2))
Ee, Ei = 0, -100
El = -60
gl = 1/60
C = 250
for i in range(len(ge)):
dv = (-gl*(v-El) - ge[i]*(v-Ee) - gi[i]*(v-Ei))*dt/C
v = v + dv
if (v>vthresh):
v = vreset
mem_pot[i, 1]=1
mem_pot[i, 0] = v
return mem_pot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment