Hi everyone,
Hi @xchoo,
I am trying to understand how the membrane voltage update is implemented in Nengo. I find the step function in Class LIF and read the source code. I am quite confused about a few lines in the source code.
In the beginning, nengo updates the refractory_time and calculates the delta_t
658 # reduce all refractory times by dt
659 refractory_time -= dt
660 # compute effective dt for each neuron, based on remaining time.
661 # note that refractory times that have completed midway into this
662 # timestep will be given a partial timestep, and moreover these will
663 # be subtracted to zero at the next timestep (or reset by a spike)
664 delta_t = clip((dt - refractory_time), 0, dt)
My first question is why we need to subtract dt from refractory_time.
I know that if a neuron stays in its refractory_time, and it won’t react to any inputs. So, the time period where the neuron can take the input should somehow like “dt - refractory_time”.
Here is my second question. Considering that we do not know when dt starts and also refractory_time starts, why we can calculate the delta_t by dt - refractory_time.
The third question is about spike time
676 # set v(0) = 1 and solve for t to compute the spike time
677 t_spike = dt + tau_rc * np.log1p(
678 -(voltage[spiked_mask] - 1) / (J[spiked_mask] - 1)
679 )
I know that tau_rc * np.log1p( -(voltage[spiked_mask] - 1) / (J[spiked_mask] - 1)) is derived from v(t) = v(0) + (J - v(0))*(1 - exp(-t/tau)) and it is equal to -t. My question is that why we calculate t_spike using dt - t and what is the meaning?
The last question is about the update of refractory_time.
685 refractory_time[spiked_mask] = self.tau_ref + t_spike
I do not understand why nengo updates refractory_time in this way.
Above, are my questions. Looking forward to your feedback~