Skip to content

Commit

Permalink
[hist, bugfix]
Browse files Browse the repository at this point in the history
  • Loading branch information
alcrene committed Aug 31, 2019
1 parent f154c08 commit 506c759
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sinn/histories.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 506c759

Please sign in to comment.