Skip to content

Commit

Permalink
Don't throw exceptions
Browse files Browse the repository at this point in the history
- Return np.nan instead
- As per behavior of whaam
  • Loading branch information
slobodan-ilic committed Jan 15, 2018
1 parent dde12fa commit 0647d56
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/cr/cube/crunch_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,8 @@ def _mr_index(self, axis, weighted):

if self.dimensions[0].type == 'multiple_response':
if axis != 0:
raise ValueError(
'MR x CAT index table only defined for column direction'
)
# MR x CAT index table only defined for column direction.
return np.full(self.as_array().shape, np.nan)
selected = (
table[:, 0, :, 0]
if self.is_double_mr else
Expand All @@ -840,9 +839,9 @@ def _mr_index(self, axis, weighted):

if self.dimensions[1].type == 'multiple_response':
if axis == 0:
raise ValueError(
'CAT x MR index table not defined for column direction'
)
# CAT x MR index table not defined for column direction.
return np.full(self.as_array().shape, np.nan)

selected = table[:, :, 0]
non_selected = table[:, :, 1]
margin = np.sum(selected, 0) / np.sum(selected + non_selected, 0)
Expand Down

0 comments on commit 0647d56

Please sign in to comment.