def update(self, _t, _dt): in_interval = bm.logical_and(pre_stimulus_period < _t, _t < pre_stimulus_period + stimulus_period) prev_freq = bm.where(in_interval, self.freq[0], 0.) in_interval = bm.logical_and(in_interval, (_t - self.freq_t_last_change[0]) >= self.t_interval) self.freq[:] = bm.where(in_interval, self.rng.normal(self.freq_mean, self.freq_var), prev_freq) self.freq_t_last_change[:] = bm.where(in_interval, _t, self.freq_t_last_change[0]) self.spike.value = self.rng.random(self.num) < self.freq[0] * self.dt
def update(self, _t, _dt): V, self.W.value = self.integral(self.V, self.W, _t, self.input, dt=_dt) spike = bm.logical_and(self.V < self.V_th, V >= self.V_th) self.t_last_spike.value = bm.where(spike, _t, self.t_last_spike) self.V.value = V self.spike.value = spike self.input[:] = 0.
def update(self, _t, _dt): V, w = self.integral(self.V, self.w, _t, self.input, dt=_dt) self.spike.value = bm.logical_and(V >= self.Vth, self.V < self.Vth) self.t_last_spike.value = bm.where(self.spike, _t, self.t_last_spike) self.V.value = V self.w.value = w self.input[:] = 0.
def update(self, _t, _dt): V, y, z = self.integral(self.V, self.y, self.z, _t, self.input, dt=_dt) self.spike.value = bm.logical_and(V >= self.V_th, self.V < self.V_th) self.t_last_spike.value = bm.where(self.spike, _t, self.t_last_spike) self.V.value = V self.y.value = y self.z.value = z self.input[:] = 0.
def update(self, _t, _dt): h = self.int_h(self.h, _t, self.V, dt=_dt) n = self.int_n(self.n, _t, self.V, dt=_dt) V = self.int_V(self.V, _t, self.h, self.n, self.input, dt=_dt) self.spike.value = bm.logical_and(self.V < self.V_th, V >= self.V_th) self.V.value = V self.h.value = h self.n.value = n self.input[:] = 0.
def update(self, _t, _dt): # update variables in channels for ch in self.ion_channels.values(): ch.update(_t, _dt) # update neuron variables V = self.integral(self.V.value, _t, self.input.value, dt=_dt) self.spike[:] = bm.logical_and(V >= self.V_th, self.V < self.V_th) self.input[:] = 0. self.V[:] = V
def update(self, _t, _dt): V, m, h, n = self.integral(self.V, self.m, self.h, self.n, _t, Isyn=self.input, dt=_dt) self.spike.value = bm.logical_and(self.V < V_th, V >= V_th) self.m.value = m self.h.value = h self.n.value = n self.V.value = V self.input[:] = 0.
def update(self, _t, _dt): if isinstance(self.int_V, bp.ode.ExpEulerAuto): V = self.int_V(self.V, _t, self.y, self.z, self.input, dt=_dt) self.y.value = self.int_y(self.y, _t, self.V, dt=_dt) self.z.value = self.int_z(self.z, _t, self.V, dt=_dt) else: V, self.y.value, self.z.value = self.integral(self.V, self.y, self.z, _t, self.input, dt=_dt) self.spike.value = bm.logical_and((self.V < self.Vth), (V >= self.Vth)) self.V.value = V self.input[:] = 0.
def update(self, _t, _dt): V, m, h, n = self.integral(self.V, self.m, self.h, self.n, _t, self.input, dt=_dt) self.spike.value = bm.logical_and(self.V < self.V_th, V >= self.V_th) self.t_last_spike.value = bm.where(self.spike, _t, self.t_last_spike) self.V.value = V self.m.value = m self.h.value = h self.n.value = n self.input[:] = 0.
def update(self, _t, _dt): I1, I2, V_th, V = self.integral(self.I1, self.I2, self.V_th, self.V, _t, self.input, dt=_dt) spike = self.V_th <= V V = bm.where(spike, self.V_reset, V) I1 = bm.where(spike, self.R1 * I1 + self.A1, I1) I2 = bm.where(spike, self.R2 * I2 + self.A2, I2) reset_th = bm.logical_and(V_th < self.V_th_reset, spike) V_th = bm.where(reset_th, self.V_th_reset, V_th) self.spike.value = spike self.I1.value = I1 self.I2.value = I2 self.V_th.value = V_th self.V.value = V self.input[:] = 0.
def cond_fun(t): return bm.logical_and(self.i[0] < self.num_times, t >= self.times[self.i[0]])