Skip to content

Commit

Permalink
Merge pull request #270 from pynapple-org/fix_iset_repr
Browse files Browse the repository at this point in the history
Fixing repr of iset
  • Loading branch information
gviejo authored Apr 18, 2024
2 parents ce38e52 + 6246811 commit eab8f5e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
6 changes: 6 additions & 0 deletions docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ In 2018, Francesco started neuroseries, a Python package built on Pandas. It was
In 2021, Guillaume and other trainees in Adrien's lab decided to fork from neuroseries and started *pynapple*. The core of pynapple is largely built upon neuroseries. Some of the original changes to TSToolbox made by Luke were included in this package, especially the *time_support* property of all ts/tsd objects.


0.6.4 (2024-04-18)
------------------

- Fixing IntervalSet `__repr__`. Tabulate conflict with numpy 1.26.


0.6.3 (2024-04-17)
------------------

Expand Down
2 changes: 1 addition & 1 deletion pynapple/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.6.3"
__version__ = "0.6.4"
from .core import IntervalSet, Ts, Tsd, TsdFrame, TsdTensor, TsGroup, TsIndex, config
from .io import *
from .process import *
24 changes: 17 additions & 7 deletions pynapple/core/interval_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def __init__(self, start, end=None, time_units="s", **kwargs):
self.nap_class = self.__class__.__name__

def __repr__(self):
headers = ["start", "end"]
headers = [" " * 6, "start", "end"]
bottom = "shape: {}, time unit: sec.".format(self.shape)

rows = _get_terminal_size()[1]
Expand All @@ -182,17 +182,27 @@ def __repr__(self):
warnings.simplefilter("ignore")
return (
tabulate(
self.values[0:n_rows],
np.hstack(
(self.index[0:n_rows][:, None], self.values[0:n_rows])
),
headers=headers,
showindex=self.index[0:n_rows],
tablefmt="plain",
colalign=("left", "center", "center"),
)
+ "\n\n...\n"
+ "\n"
+ " " * 10
+ "..."
+ tabulate(
self.values[-n_rows:],
headers=[" " * 5, " " * 3], # To align properly the columns
showindex=self.index[-n_rows:],
np.hstack(
(self.index[-n_rows:][:, None], self.values[-n_rows:])
),
headers=[
" " * 6,
" " * 5,
" " * 3,
], # To align properly the columns
tablefmt="plain",
colalign=("left", "center", "center"),
)
+ "\n"
+ bottom
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pynapple"
version = "0.6.3"
version = "0.6.4"
description = "PYthon Neural Analysis Package Pour Laboratoires d’Excellence"
readme = "README.md"
authors = [{ name = "Guillaume Viejo", email = "[email protected]" }]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/pynapple-org/pynapple',
version='v0.6.3',
version='v0.6.4',
zip_safe=False,
long_description_content_type='text/markdown',
download_url='https://github.com/pynapple-org/pynapple/archive/refs/tags/v0.6.0.tar.gz'
Expand Down

0 comments on commit eab8f5e

Please sign in to comment.