Skip to content

Commit

Permalink
Merge pull request #279 from pynapple-org/dev
Browse files Browse the repository at this point in the history
Fixing #273
  • Loading branch information
gviejo authored May 13, 2024
2 parents 4555391 + 731e74f commit bf0c076
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
7 changes: 7 additions & 0 deletions docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
------------------

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.4"
__version__ = "0.6.5"
from .core import (
IntervalSet,
Ts,
Expand Down
10 changes: 9 additions & 1 deletion pynapple/core/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
)
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.4"
version = "0.6.5"
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.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'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit bf0c076

Please sign in to comment.