diff --git a/docs/HISTORY.md b/docs/HISTORY.md index 43724274..313a922d 100644 --- a/docs/HISTORY.md +++ b/docs/HISTORY.md @@ -9,6 +9,13 @@ 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.5 (Soon) +------------------ + +- Full `pynajax` backend compatibility +- `get` method can update time support + + 0.6.4 (2024-04-18) ------------------ diff --git a/pynapple/__init__.py b/pynapple/__init__.py index 9657fbe3..1a77219e 100644 --- a/pynapple/__init__.py +++ b/pynapple/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.6.4" +__version__ = "0.6.5" from .core import ( IntervalSet, Ts, diff --git a/pynapple/core/time_series.py b/pynapple/core/time_series.py index 4ff91aa2..9e116547 100644 --- a/pynapple/core/time_series.py +++ b/pynapple/core/time_series.py @@ -955,10 +955,13 @@ def __getitem__(self, key, *args, **kwargs): ): return self.loc[key] else: - # return super().__getitem__(key, *args, **kwargs) output = self.values.__getitem__(key) + columns = self.columns + if isinstance(key, tuple): index = self.index.__getitem__(key[0]) + if len(key) == 2: + columns = self.columns.__getitem__(key[1]) else: index = self.index.__getitem__(key) @@ -967,6 +970,11 @@ def __getitem__(self, key, *args, **kwargs): if all(is_array_like(a) for a in [index, output]): if output.shape[0] == index.shape[0]: + + if isinstance(columns, pd.Index): + if not columns.is_integer(): + kwargs["columns"] = columns + return _get_class(output)( t=index, d=output, time_support=self.time_support, **kwargs ) diff --git a/pyproject.toml b/pyproject.toml index 8a2db4fc..ad0d99f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pynapple" -version = "0.6.4" +version = "0.6.5" description = "PYthon Neural Analysis Package Pour Laboratoires d’Excellence" readme = "README.md" authors = [{ name = "Guillaume Viejo", email = "guillaume.viejo@gmail.com" }] diff --git a/setup.py b/setup.py index ef3bb829..b9fde105 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,7 @@ test_suite='tests', tests_require=test_requirements, url='https://github.com/pynapple-org/pynapple', - version='v0.6.4', + version='v0.6.5', 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' diff --git a/tests/test_time_series.py b/tests/test_time_series.py index 8b8e40b9..0d48c727 100755 --- a/tests/test_time_series.py +++ b/tests/test_time_series.py @@ -7,7 +7,7 @@ # tsd1 = nap.Tsd(t=np.arange(100), d=np.random.rand(100), time_units="s") -# tsd2 = nap.TsdFrame(t=np.arange(100), d=np.random.rand(100, 10), time_units="s") +# tsd2 = nap.TsdFrame(t=np.arange(100), d=np.random.rand(100, 3), columns = ['a', 'b', 'c']) # tsd3 = nap.TsdTensor(t=np.arange(100), d=np.random.rand(100, 5, 4), time_units="s") # tsd4 = nap.Ts(t=np.arange(100), time_units="s")