summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--polymatrix/expression/mixins/filterexprmixin.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/polymatrix/expression/mixins/filterexprmixin.py b/polymatrix/expression/mixins/filterexprmixin.py
index ff2d333..5083073 100644
--- a/polymatrix/expression/mixins/filterexprmixin.py
+++ b/polymatrix/expression/mixins/filterexprmixin.py
@@ -48,9 +48,19 @@ class FilterExprMixin(ExpressionBaseMixin):
if underlying_terms is None:
continue
- predicator_value = predicator.get_poly(row, 0)[tuple()]
+ predicator_poly = predicator.get_poly(row, 0)
- assert isinstance(predicator_value, int)
+ if predicator_poly is None:
+ predicator_value = 0
+
+ else:
+ key = tuple()
+
+ if key in predicator_poly:
+ predicator_value = round(predicator_poly[key])
+
+ else:
+ predicator_value = 0
if (predicator_value != 0) is not self.inverse:
terms[row_index, 0] = underlying_terms