Skip to content

Commit

Permalink
Add H&S when calculating y_offset
Browse files Browse the repository at this point in the history
  • Loading branch information
slobodan-ilic committed Feb 1, 2018
1 parent 6a3fd78 commit d325213
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/cr/cube/crunch_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ def pvals(self, axis, include_transforms_for_dims=None):

return p_values

def y_offset(self, expand=False):
def y_offset(self, expand=False, include_transforms_for_dims=None):
'''Gets y offset for sheet manipulation.
Args:
Expand All @@ -1022,15 +1022,19 @@ def y_offset(self, expand=False):
if not self.dimensions:
return 4

first_dim_length = self.as_array().shape[0]
first_dim_length = self.as_array(
include_transforms_for_dims=include_transforms_for_dims
).shape[0]

# Special case of CA as a 0-ind cube
if expand and self.dimensions[0].type == 'categorical_array':
return first_dim_length * (len(self.dimensions[1].elements()) + 4)

if len(self.dimensions) <= 2 and self.dimensions[0].type:
return first_dim_length + 4
return first_dim_length * (self.as_array().shape[1] + 4)
return first_dim_length * (self.as_array(
include_transforms_for_dims=include_transforms_for_dims
).shape[1] + 4)

def count(self, weighted=True):
'''Get cube's count with automatic weighted/unweighted selection.'''
Expand Down

0 comments on commit d325213

Please sign in to comment.