Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mathleur authored and jameshawkes committed Aug 6, 2024
1 parent da3248d commit de849f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
9 changes: 0 additions & 9 deletions polytope/datacube/tensor_index_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,24 +213,15 @@ 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
return path

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]
19 changes: 3 additions & 16 deletions polytope/engine/hullslicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit de849f7

Please sign in to comment.