From de849f7e3bcd8810e56d7fe51318d46cade7dded Mon Sep 17 00:00:00 2001 From: mathleur Date: Tue, 6 Aug 2024 10:16:47 +0200 Subject: [PATCH] clean up --- polytope/datacube/tensor_index_tree.py | 9 --------- polytope/engine/hullslicer.py | 19 +++---------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/polytope/datacube/tensor_index_tree.py b/polytope/datacube/tensor_index_tree.py index 15d8c59f..5cb813b9 100644 --- a/polytope/datacube/tensor_index_tree.py +++ b/polytope/datacube/tensor_index_tree.py @@ -213,9 +213,6 @@ def remove_compressed_branch(self, value): def flatten(self): path = DatacubePath() - # print("SELF IN FLATTEN") - # print(self) - # print(self.parent) ancestors = self.get_ancestors() for ancestor in ancestors: path[ancestor.axis.name] = ancestor.values @@ -223,14 +220,8 @@ def flatten(self): def get_ancestors(self): ancestors = [] - # print("SELF IN GET ANCESTORS") - # print(self) - # print(self.axis) current_node = self - # while current_node.axis != TensorIndexTree.root: while current_node.axis.name != "root": ancestors.append(current_node) current_node = current_node.parent - # print(current_node) - # print(current_node.axis.name == "root") return ancestors[::-1] diff --git a/polytope/engine/hullslicer.py b/polytope/engine/hullslicer.py index ad09de93..767f8916 100644 --- a/polytope/engine/hullslicer.py +++ b/polytope/engine/hullslicer.py @@ -73,10 +73,6 @@ def find_values_between(self, polytope, ax, node, datacube, lower, upper): tol = ax.tol lower = ax.from_float(lower - tol) upper = ax.from_float(upper + tol) - # print(node) - # print("WHAT S THE AXIS") - # print(node.axis) - # print(node.flatten()) flattened = node.flatten() method = polytope.method if method == "nearest": @@ -113,13 +109,6 @@ def remap_values(self, ax, value): return remapped_val def _build_sliceable_child(self, polytope, ax, node, datacube, values, next_nodes, slice_axis_idx): - # print(node.children) - # if len(values) == 0 and len(node.children) == 0: - # print(node) - # print(values) - # if len(values) == 0: - # node.remove_branch() - for i, value in enumerate(values): if i == 0: fvalue = ax.to_float(value) @@ -164,12 +153,10 @@ def _build_branch(self, ax, node, datacube, next_nodes): if self.ax_is_unsliceable[ax.name]: self._build_unsliceable_child(polytope, ax, node, datacube, [lower], next_nodes, slice_axis_idx) else: - # print("IN BUILD BRANCH") - # print(node) - # print(node.axis) - # print(node.parent) values = self.find_values_between(polytope, ax, node, datacube, lower, upper) - # TODO: HERE, SOMEHOW NEED TO ONLY remove the branches if the values are empty, but only if there are no other possible children left in the tree that we can append and if somehow this happens before and we need to remove, then what do we do?? + # NOTE: need to only remove the branches if the values are empty, + # but only if there are no other possible children left in the tree that + # we can append and if somehow this happens before and we need to remove, then what do we do?? if i == len(right_unsliced_polytopes) - 1: # we have iterated all polytopes and we can now remove the node if we need to if len(values) == 0 and len(node.children) == 0: