Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dask compatibility #376

Open
wants to merge 19 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
formatted
  • Loading branch information
BalzaniEdoardo committed Nov 8, 2024
commit 4ef8b2e2402a05e33f0e4c3261aef8505b26e45b
41 changes: 30 additions & 11 deletions pynapple/core/time_series.py
Original file line number Diff line number Diff line change
@@ -772,12 +772,18 @@ def create_str(array):
if self.shape[0] > max_rows:
n_rows = max_rows // 2
top_rows = (
self.values[0:n_rows].compute() if hasattr(self.values, "compute")
self.values[0:n_rows].compute()
if hasattr(self.values, "compute")
else self.values[:n_rows]
)
bottom_rows = (
self.values[self.values.shape[0] - n_rows : self.values.shape[0]].compute() if hasattr(self.values, "compute")
else self.values[self.values.shape[0] - n_rows : self.values.shape[0]]
self.values[
self.values.shape[0] - n_rows : self.values.shape[0]
].compute()
if hasattr(self.values, "compute")
else self.values[
self.values.shape[0] - n_rows : self.values.shape[0]
]
)
for i, array in zip(self.index[0:n_rows], top_rows):
_str_.append([i, create_str(array)])
@@ -788,7 +794,11 @@ def create_str(array):
):
_str_.append([i, create_str(array)])
else:
rows = self.values.compute() if hasattr(self.values, "compute") else self.values
rows = (
self.values.compute()
if hasattr(self.values, "compute")
else self.values
)
for i, array in zip(self.index, rows):
_str_.append([i, create_str(array)])

@@ -991,11 +1001,13 @@ def __repr__(self):
n_rows = max_rows // 2
ends = np.array([end] * n_rows)
top_rows = (
self.values[0:n_rows, 0:max_cols].compute() if hasattr(self.values, "compute")
self.values[0:n_rows, 0:max_cols].compute()
if hasattr(self.values, "compute")
else self.values[0:n_rows, 0:max_cols]
)
bottom_rows = (
self.values[-n_rows:, 0:max_cols].compute() if hasattr(self.values, "compute")
self.values[-n_rows:, 0:max_cols].compute()
if hasattr(self.values, "compute")
else self.values[-n_rows:, 0:max_cols]
)
table = np.vstack(
@@ -1029,8 +1041,9 @@ def __repr__(self):
else:
ends = np.array([end] * len(self))
rows = (
self.values[:, 0:max_cols].compute() if hasattr(self.values, "compute") else
self.values[:, 0:max_cols]
self.values[:, 0:max_cols].compute()
if hasattr(self.values, "compute")
else self.values[:, 0:max_cols]
)
table = np.hstack(
(
@@ -1349,12 +1362,18 @@ def __repr__(self):
n_rows = max_rows // 2
table = []
top_rows = (
self.values[0:n_rows].compute() if hasattr(self.values, "compute")
self.values[0:n_rows].compute()
if hasattr(self.values, "compute")
else self.values[0:n_rows]
)
bottom_rows = (
self.values[self.values.shape[0] - n_rows : self.values.shape[0]].compute() if hasattr(self.values, "compute")
else self.values[self.values.shape[0] - n_rows : self.values.shape[0]]
self.values[
self.values.shape[0] - n_rows : self.values.shape[0]
].compute()
if hasattr(self.values, "compute")
else self.values[
self.values.shape[0] - n_rows : self.values.shape[0]
]
)
for i, v in zip(self.index[0:n_rows], top_rows):
table.append([i, v])
Loading