Skip to content

Commit

Permalink
move generate indices and grid to public method
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-langfield committed May 10, 2024
1 parent 9eedfe3 commit 2dafe02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/hexfft/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from hexfft.grids import heshgrid, skew_heshgrid


def _generate_indices(shape, pattern):
def generate_indices(shape, pattern):
N1, N2 = shape
n1, n2 = np.meshgrid(np.arange(N1), np.arange(N2))

Expand All @@ -14,7 +14,7 @@ def _generate_indices(shape, pattern):
return n1, n2


def _generate_grid(shape, pattern):
def generate_grid(shape, pattern):
if pattern == "oblique":
return skew_heshgrid(shape)
elif pattern == "offset":
Expand Down Expand Up @@ -53,8 +53,8 @@ def __new__(cls, arr, pattern="offset"):
)

obj.pattern = pattern
obj.indices = _generate_indices(arr.shape[-2:], pattern)
obj.grid = _generate_grid(arr.shape[-2:], pattern)
obj.indices = generate_indices(arr.shape[-2:], pattern)
obj.grid = generate_grid(arr.shape[-2:], pattern)

return obj

Expand Down
4 changes: 2 additions & 2 deletions src/hexfft/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
from hexfft.array import HexArray, _generate_indices
from hexfft.array import HexArray, generate_indices
from hexfft.grids import heshgrid, skew_heshgrid


Expand All @@ -14,7 +14,7 @@ def hsupport(N, pattern="oblique"):
:param h: a HexArray
"""
# assert N1 % 2 == 0, "Side length must be even."
n1, n2 = _generate_indices((N, N), pattern)
n1, n2 = generate_indices((N, N), pattern)
M = N // 2
if pattern == "offset":
n2 = n2 - N // 4
Expand Down

0 comments on commit 2dafe02

Please sign in to comment.