Skip to content

Commit

Permalink
Modify functionality for one case MR, in the style of NUM/DEN
Browse files Browse the repository at this point in the history
  • Loading branch information
slobodan-ilic committed Jan 12, 2018
1 parent 78af41a commit 3c8f522
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/cr/cube/crunch_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,12 @@ def _mr_proportions(self, axis, weighted):
else:
res = table[:, :, 0] / (table[:, :, 0] + table[:, :, 1])
elif self.dimensions[2].type == 'multiple_response':
# This is the case of CA x MR, should work fine, but please check
# slight mismatch between this and whaam
if axis == 1:
res = (table[:, :, :, 0] /
np.sum(table[:, :, :, 0], 1))
else:
res = (table[:, :, :, 0] /
(table[:, :, :, 0] + table[:, :, :, 1]))
margin = (
self.margin(axis=axis)[:, np.newaxis]
if axis == 1 else
self.margin(axis=0)
)
return self.as_array() / margin

return res[np.ix_(*valid_indices)]

Expand Down

0 comments on commit 3c8f522

Please sign in to comment.