Skip to content

Commit ddb03ac

Browse files
committed
fix #234 : implemented support for np.__array_ufunc__
1 parent 40c8dd9 commit ddb03ac

File tree

6 files changed

+600
-453
lines changed

6 files changed

+600
-453
lines changed

doc/source/changes/version_0_30.rst.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ Miscellaneous improvements
215215
the overall performance improvement is negligible over most of the real-world models using larray that we tested these
216216
changes on.
217217

218+
* made it possible to pass LArray objects to Numpy ufuncs directly (e.g. np.sqrt(ndtest(3)), closes :issue:`234`).
219+
218220

219221
Fixes
220222
^^^^^

larray/core/array.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from larray.core.constants import nan
5858
from larray.core.metadata import Metadata
5959
from larray.core.expr import ExprNode
60+
from larray.core.ufuncs import SupportsNumpyUfuncs
6061
from larray.core.group import (Group, IGroup, LGroup, remove_nested_groups, _to_key, _to_keys,
6162
_translate_sheet_name, _translate_group_key_hdf)
6263
from larray.core.axis import Axis, AxisReference, AxisCollection, X, _make_axis
@@ -700,7 +701,7 @@ def _handle_meta(meta, title):
700701
return Metadata(meta)
701702

702703

703-
class LArray(ABCLArray):
704+
class LArray(ABCLArray, SupportsNumpyUfuncs):
704705
r"""
705706
A LArray object represents a multidimensional, homogeneous array of fixed-size items with labeled axes.
706707

0 commit comments

Comments
 (0)