Skip to content

Commit

Permalink
Bugfix for util.window_slice() where the window view was not copied t…
Browse files Browse the repository at this point in the history
…o a new array even when copy=True
  • Loading branch information
wx-star committed Mar 14, 2023
1 parent caf5279 commit f3944ec
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions heregoes/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def x4(arr):

@heregoes_njit_noparallel
def window_slice(
arr, center_index, outer_radius, inner_radius=0, copy=True, replace_inner=True
arr, center_index, outer_radius, inner_radius=0, replace_inner=True
):
"""
Returns the square window of array `arr` centered at `center_index` with radius `outer_radius` and diameter `outer_radius` * 2 + 1.
Expand All @@ -88,10 +88,7 @@ def window_slice(
y, x = center_index
window = arr[
y - outer_radius : y + outer_radius + 1, x - outer_radius : x + outer_radius + 1
]

if copy or replace_inner:
window = window.copy()
].copy()

window_center_y = window.shape[0] // 2
window_center_x = window.shape[1] // 2
Expand Down

0 comments on commit f3944ec

Please sign in to comment.