Skip to content

Commit

Permalink
cleaner repr, pt order
Browse files Browse the repository at this point in the history
  • Loading branch information
natemacfadden committed Aug 8, 2024
1 parent 10889b6 commit 9b3f399
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/cytools/polytope.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ def __repr__(self) -> str:
return (f"A {self.dim()}-dimensional "
f"{('reflexive ' if self.is_reflexive() else '')}"
f"lattice polytope in ZZ^{self.ambient_dim()} "
f"with points {self._inputpts2labels.keys()} "
f"which are labelled {self._inputpts2labels.values()}")
f"with points {list(self._inputpts2labels.keys())} "
f"which are labelled {list(self._inputpts2labels.values())}")

def __str__(self) -> str:
"""
Expand Down Expand Up @@ -767,9 +767,13 @@ def sort_fct(ind):
# save order of labels
self._pts_order = sum(nSat_to_labels[1:][::-1],
nSat_to_labels[0])

self._pts_order = tuple([i.item() if hasattr(i, 'item') else i for i in self._pts_order])

#if hasattr(self._pts_order[0], 'item'):
# # convert numpy types to ordinary ones
# self._pts_order = tuple([i.item() for i in self._pts_order])
#else:
# self._pts_order = tuple([i for i in self._pts_order])
self._pts_order = tuple([i.item() if hasattr(i, 'item') else i\
for i in self._pts_order])

# dictionary from labels to input coordinates
pts_input_all = self._optimal_to_input(self.points(optimal=True))
Expand Down

0 comments on commit 9b3f399

Please sign in to comment.