def get_vmem(self, **kwargs):
i = kwargs[str("monitor_index")]
if "v_mem" in self.probe_idx_map.keys():
idx = self.probe_idx_map["v_mem"]
// Need to skip input layer because the toolbox does not expect it
// to record the membrane potentials.
if i == 0:
plot_probe(self.probes[i][idx],
self.config.get("paths", "log_dir_of_current_run"),
"v_input.png")
else:
return self.probes[i][idx].data[:, -self._num_timesteps:]
def set_spiketrain_stats_input(self):
AbstractSNN.set_spiketrain_stats_input(self)
After Change
return spiketrains_b_l_t / layer.vTh / 2 ** 6
def get_vmem(self, **kwargs):
if self.voltage_probes is None:
return
i = kwargs[str("monitor_index")]
name = self.snn.layers[i].nameprobes = self.stack_layer_probes(self.voltage_probes[name])
// Plot instead of returning input layer probes because the toolbox
// does not expect input to record the membrane potentials.
if i == 0:
plot_probe(probes,
self.config.get("paths", "log_dir_of_current_run"),
"v_input.png")
else:
return probes
def stack_layer_probes(self, probes):
return np.stack([p.data[-self._num_timesteps:] for p in probes])