Skip to content

Commit

Permalink
Fixed annoying tuple outputs on odd and even sublattice indices
Browse files Browse the repository at this point in the history
  • Loading branch information
timbernat committed May 1, 2024
1 parent 8543841 commit 0edb243
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion polymerist/maths/lattices/integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def odd_even_idxs(self) -> tuple[np.ndarray[Shape[M], int], np.ndarray[Shape[M],
parity_vector = np.mod(self.points.sum(axis=1), 2) # remainder of sum of coordinates of each point; corresponds to the condition that a single step along any dimension should invert parity
is_odd = parity_vector.astype(bool) # typecast as booleans to permit indexing (and make intent a bit clearer)

return np.where(is_odd), np.where(~is_odd)
return np.flatnonzero(is_odd), np.flatnonzero(~is_odd) # need to faltten to avoid inconvenient tuple wrapping

@property
def odd_idxs(self) -> np.ndarray[Shape[M], int]:
Expand Down

0 comments on commit 0edb243

Please sign in to comment.