From 506c7593f610d5ebfe9087c64fb79e5c438a3875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Ren=C3=A9?= Date: Sat, 31 Aug 2019 11:12:01 +0200 Subject: [PATCH] [hist, bugfix] --- sinn/histories.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sinn/histories.py b/sinn/histories.py index 146f158..23818b8 100644 --- a/sinn/histories.py +++ b/sinn/histories.py @@ -2426,7 +2426,7 @@ def _is_batch_computable(self, up_to='end'): def plot(self, tslc=None, idx=None, ax=None, **plot_kwargs): """ - tslc: time slice. Can use `np.slc[t0:tn]` + tslc: time slice. Can use `np.s_[t0:tn]` idx: Indices of components to plot. Can be tuple to allow dims > 1. Specified as either integer or slice. ax: matplotlib axes. If not specified, use current axes. @@ -2446,13 +2446,13 @@ def plot(self, tslc=None, idx=None, ax=None, **plot_kwargs): if step is not None: step = self.index_interval(step) time = self.timeaxis.stops[start:stop:step] if idx is None: - idx = (np.s_[:],) * self.ndim + idx = (np.s_[:],) * int(self.ndim) # self.ndim is 0d array: need plain int elif not isinstance(idx, tuple): - idx = (idx,) * self.ndim + idx = (idx,) * int(self.ndim) # FIXME: Make an indexing interface to Spiketrain, so that this works data = self._data[(np.s_[start:stop:step],) + idx] - ax.plot(time, data, **plot_kwargs) + return ax class PopulationHistory(PopulationHistoryBase, History): @@ -4387,7 +4387,6 @@ def get_time(self, *args): def get_t_idx(self, *args): return self.hist.get_t_idx(*args) - sinn.common.register_datatype(History) sinn.common.register_datatype(PopulationHistory) sinn.common.register_datatype(Spiketrain)