From 80eb68e1601e38bd790bb39250656d711bd2697c Mon Sep 17 00:00:00 2001 From: Michael Schneeberger Date: Wed, 17 Aug 2022 17:32:12 +0200 Subject: add function 'get_key_from_offset' --- polymatrix/expressionstate/mixins/expressionstatemixin.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/polymatrix/expressionstate/mixins/expressionstatemixin.py b/polymatrix/expressionstate/mixins/expressionstatemixin.py index 6d2ded3..e08e1eb 100644 --- a/polymatrix/expressionstate/mixins/expressionstatemixin.py +++ b/polymatrix/expressionstate/mixins/expressionstatemixin.py @@ -31,11 +31,9 @@ class ExpressionStateMixin( def auxillary_equations(self) -> dict[int, dict[tuple[int], float]]: ... - def get_variable_from_offset(self, offset: int): + def get_key_from_offset(self, offset: int): for variable, (start, end) in self.offset_dict.items(): - if offset == start: - assert end - start == 1, f'{start=}, {end=}, {variable=}' - + if start <= offset < end: return variable def register( -- cgit v1.2.1