Skip to content

Commit 6ee7940

Browse files
authored
Move non-standardized functions (nan functions, pad, map_overlap) to separate package (#690)
1 parent 056e6ea commit 6ee7940

File tree

8 files changed

+9
-5
lines changed

8 files changed

+9
-5
lines changed

cubed/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
defaults=[{"spec": {"allowed_mem": "2GB", "reserved_mem": "100MB"}}],
1414
)
1515

16+
from .array.nan_functions import nanmean, nansum
17+
from .array.overlap import map_overlap
18+
from .array.pad import pad
1619
from .core.array import compute, measure_reserved_mem, visualize
1720
from .core.gufunc import apply_gufunc
1821
from .core.ops import from_array, from_zarr, map_blocks, rechunk, store, to_zarr
19-
from .nan_functions import nanmean, nansum
20-
from .overlap import map_overlap
21-
from .pad import pad
2222
from .runtime.types import Callback, TaskEndEvent
2323
from .spec import Spec
2424

cubed/array/__init__.py

Whitespace-only changes.

cubed/nan_functions.py renamed to cubed/array/nan_functions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@ def _nannumel(x, **kwargs):
5050
return nxp.sum(~(nxp.isnan(x)), **kwargs)
5151

5252

53-
def nansum(x, /, *, axis=None, dtype=None, keepdims=False, split_every=None, device=None):
53+
def nansum(
54+
x, /, *, axis=None, dtype=None, keepdims=False, split_every=None, device=None
55+
):
5456
"""Return the sum of array elements over a given axis treating NaNs as zero."""
55-
dtype = _upcast_integral_dtypes(x, dtype, allowed_dtypes=("numeric",), fname="nansum", device=device)
57+
dtype = _upcast_integral_dtypes(
58+
x, dtype, allowed_dtypes=("numeric",), fname="nansum", device=device
59+
)
5660
return reduction(
5761
x,
5862
nxp.nansum,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)