From bcf6dc5c479107be74a61b6992688a797d5a5b09 Mon Sep 17 00:00:00 2001 From: Matthias Bisping Date: Mon, 11 Apr 2022 13:03:02 +0200 Subject: [PATCH] generalized split mapper --- image_prediction/stitching/split_mapper.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/image_prediction/stitching/split_mapper.py b/image_prediction/stitching/split_mapper.py index da93871..2863fa8 100644 --- a/image_prediction/stitching/split_mapper.py +++ b/image_prediction/stitching/split_mapper.py @@ -7,23 +7,22 @@ from image_prediction.info import Info @dataclass class SplitMapper: - """Manages access into a coordinate encoding mapping by abstracting over x1, x2 and y1, y2 as c1, c2; as well as - over width and height as 'dim'.""" - __keymap: dict + """Manages access into a mapping M by indirection through a specified access mapping to achieve a common + interface between various M_i. + """ + + __access_mapping: dict wrapped: dict __wrapped: dict = field(init=False) - dim: float = field(init=False) - c1: float = field(init=False) - c2: float = field(init=False) def __post_init__(self): - for k, v in self.__keymap.items(): + for k, v in self.__access_mapping.items(): setattr(self, k, self.__wrapped[v]) @property def wrapped(self): ret = deepcopy(self.__wrapped) - ret.update(dict(zip(self.__keymap.values(), attrgetter(*self.__keymap.keys())(self)))) + ret.update(dict(zip(self.__access_mapping.values(), attrgetter(*self.__access_mapping.keys())(self)))) return ret @wrapped.setter