Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion neo/core/epoch.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,14 @@ def __repr__(self):
return '<Epoch: %s>' % ', '.join(objs)

def _repr_pretty_(self, pp, cycle):
super()._repr_pretty_(pp, cycle)
labels = ""
if self._labels is not None:
labels = " with labels"
pp.text(f"{self.__class__.__name__} containing {self.size} epochs{labels}; "
f"time units {self.units.dimensionality.string}; datatype {self.dtype} ")
if self._has_repr_pretty_attrs_():
pp.breakable()
self._repr_pretty_attrs_(pp, cycle)

def rescale(self, units):
'''
Expand Down
9 changes: 8 additions & 1 deletion neo/core/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,14 @@ def __repr__(self):
return '<Event: %s>' % ', '.join(objs)

def _repr_pretty_(self, pp, cycle):
super()._repr_pretty_(pp, cycle)
labels = ""
if self._labels is not None:
labels = " with labels"
pp.text(f"{self.__class__.__name__} containing {self.size} events{labels}; "
f"time units {self.units.dimensionality.string}; datatype {self.dtype} ")
if self._has_repr_pretty_attrs_():
pp.breakable()
self._repr_pretty_attrs_(pp, cycle)

def rescale(self, units):
'''
Expand Down
16 changes: 15 additions & 1 deletion neo/core/spiketrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,21 @@ def __init__(self, times, t_stop, units=None, dtype=None, copy=True,
array_annotations=array_annotations, **annotations)

def _repr_pretty_(self, pp, cycle):
super()._repr_pretty_(pp, cycle)
waveforms = ""
if self.waveforms:
waveforms = "with waveforms"
pp.text(f"{self.__class__.__name__} containing {self.size} spikes{waveforms}; "
f"units {self.units.dimensionality.string}; datatype {self.dtype} ")
if self._has_repr_pretty_attrs_():
pp.breakable()
self._repr_pretty_attrs_(pp, cycle)

def _pp(line):
pp.breakable()
with pp.group(indent=1):
pp.text(line)

_pp(f"time: {self.t_start} to {self.t_stop}")

def rescale(self, units):
'''
Expand Down