Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
Merge branch 'fix-array-func'
Browse files Browse the repository at this point in the history
  • Loading branch information
tmontaigu committed Oct 23, 2020
2 parents 9bf7496 + f772a64 commit 3a7d46a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pylas/point/dims.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,19 @@ def __array__(self):
return self.scaled_array()

def __array_function__(self, func, types, args, kwargs):
args = tuple(
arg.array if isinstance(arg, ScaledArrayView) else arg for arg in args
)
converted_args = []
for arg in args:
if isinstance(arg, (tuple, list)):
top_level_args = []
converted_args.append(top_level_args)
else:
top_level_args = converted_args
arg = [arg]
top_level_args.extend(
a.array if isinstance(a, ScaledArrayView) else a for a in arg
)

args = converted_args
ret = func(*args, **kwargs)
if ret is not None:
if isinstance(ret, np.ndarray) and ret.dtype != np.bool:
Expand Down

0 comments on commit 3a7d46a

Please sign in to comment.