Skip to content

Commit

Permalink
[#157314298]: Check slice dimensions instead of cube dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
slobodan-ilic committed Jun 19, 2018
1 parent aee368d commit 69f7f1d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/cr/cube/crunch_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,11 @@ def index(self, weighted=True, prune=False):
'''Get cube index measurement.'''
return Index(self, weighted, prune).data

def _calculate_std_res(self, counts, total, colsum, rowsum):
if self.has_mr or self.ca_dim_ind is not None:
def _calculate_std_res(self, counts, total, colsum, rowsum, slice_):
dim_types = slice_.dim_types
has_mr_or_ca = 'categorical_array' in dim_types or 'multiple_response' in dim_types
# if self.has_mr or self.ca_dim_ind is not None:
if has_mr_or_ca:
if not self.is_double_mr and (self.mr_dim_ind == 0 or self.mr_dim_ind == 1 and self.ndim == 3):
total = total[:, np.newaxis]
rowsum = rowsum[:, np.newaxis]
Expand Down Expand Up @@ -1161,7 +1164,7 @@ def zscore(self, weighted=True, prune=False, hs_dims=None):
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)
std_res = self._calculate_std_res(counts, total, colsum, rowsum)
std_res = self._calculate_std_res(counts, total, colsum, rowsum, slice_)
res.append(std_res)

if len(res) == 1:
Expand Down

0 comments on commit 69f7f1d

Please sign in to comment.