Skip to content

Commit

Permalink
cubemeasure: mean and sum pros in base classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestoarbitrio committed Mar 4, 2021
1 parent 087b9e6 commit b4c0f01
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/cr/cube/matrix/cubemeasure.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ def factory(cls, cube, dimensions, slice_idx):
dimensions, cube.means[cls._slice_idx_expr(cube, slice_idx)]
)

@lazyproperty
def means(self):
"""2D np.float64 ndarray of cube means."""
raise NotImplementedError( # pragma: no cover
"%s must implement `.means`" % type(self).__name__
)


class _CatXCatCubeMeans(_BaseCubeMeans):
"""Means cube-measure for a slice with no MR dimensions."""
Expand Down Expand Up @@ -182,6 +189,13 @@ def factory(cls, cube, dimensions, slice_idx):
)
return CubeSumsCls(dimensions, cube.sum[cls._slice_idx_expr(cube, slice_idx)])

@lazyproperty
def sum(self):
"""2D np.float64 ndarray of cube sum."""
raise NotImplementedError( # pragma: no cover
"%s must implement `.sum`" % type(self).__name__
)


class _CatXCatCubeSums(_BaseCubeSums):
"""Sum cube-measure for a slice with no MR dimensions."""
Expand Down

0 comments on commit b4c0f01

Please sign in to comment.