Skip to content

Commit

Permalink
Merge cb4eebc into cb1c8c5
Browse files Browse the repository at this point in the history
  • Loading branch information
slobodan-ilic committed Jul 17, 2018
2 parents cb1c8c5 + cb4eebc commit 2a0d42c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/cr/cube/crunch_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,10 +1063,10 @@ def zscore(self, weighted=True, prune=False, hs_dims=None):

res = []
for slice_ in self.slices:
counts = slice_.as_array(weighted=weighted, prune=prune)
total = slice_.margin(weighted=weighted, prune=prune)
colsum = slice_.margin(axis=0, weighted=weighted, prune=prune)
rowsum = slice_.margin(axis=1, weighted=weighted, prune=prune)
counts = slice_.as_array(weighted=weighted)
total = slice_.margin(weighted=weighted)
colsum = slice_.margin(axis=0, weighted=weighted)
rowsum = slice_.margin(axis=1, weighted=weighted)
std_res = self._calculate_std_res(counts, total, colsum, rowsum, slice_)
res.append(std_res)

Expand All @@ -1077,11 +1077,17 @@ def zscore(self, weighted=True, prune=False, hs_dims=None):

if hs_dims:
res = self._intersperse_hs_in_std_res(hs_dims, res)
arr = self.as_array(include_transforms_for_dims=hs_dims)
if isinstance(arr, np.ma.core.MaskedArray):
res = np.ma.masked_array(res, mask=arr.mask)

if prune:
arr = self.as_array(
prune=prune, include_transforms_for_dims=hs_dims,
prune=prune,
include_transforms_for_dims=hs_dims,
)
if isinstance(arr, np.ma.core.MaskedArray):
res = np.ma.masked_array(res, mask=arr.mask)
res = np.ma.masked_array(res, arr.mask)

return res

Expand Down

0 comments on commit 2a0d42c

Please sign in to comment.