Skip to content

Commit 650570d

Browse files
committed
Update variable names to not conflict with fixture names.
1 parent b92d2c2 commit 650570d

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

openpiv/test/gpu/test_process.py

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,18 @@ def _window_size_parameterization(ws_iters, min_window_size):
161161

162162

163163
# UNIT TESTS
164-
def test_correlation_gpu_signal_to_noise(correlation_gpu, piv_field_gpu):
165-
assert isinstance(correlation_gpu.s2n_ratio, gpuarray.GPUArray)
164+
def test_correlation_gpu_signal_to_noise(s2n_ratio):
165+
assert isinstance(s2n_ratio, gpuarray.GPUArray)
166166

167167

168-
def test_correlation_gpu_init_fft_shape(correlation_gpu, piv_field_gpu):
168+
def test_correlation_gpu_init_fft_shape(correlation_gpu):
169169
fft_shape = correlation_gpu.fft_shape
170170

171171
assert round(log2(fft_shape[0])) == log2(fft_shape[0])
172172
assert round(log2(fft_shape[1])) == log2(fft_shape[1])
173173

174174

175-
def test_correlation_gpu_correlate_windows(correlation_gpu, piv_field_gpu):
175+
def test_correlation_gpu_correlate_windows(correlation_gpu):
176176
shape = (32, 32)
177177
fft_shape = correlation_gpu.fft_shape[0]
178178
a = 1
@@ -249,9 +249,9 @@ def test_correlation_gpu_free_gpu_data(correlation_gpu):
249249

250250

251251
def test_piv_field_gpu_get_mask(piv_field_gpu):
252-
mask = piv_field_gpu.get_gpu_mask(return_array=True)
252+
mask_ = piv_field_gpu.get_gpu_mask(return_array=True)
253253

254-
assert isinstance(mask, gpuarray.GPUArray)
254+
assert isinstance(mask_, gpuarray.GPUArray)
255255

256256

257257
@pytest.mark.parametrize("search_size", [16, 32])
@@ -320,15 +320,14 @@ def test_piv_coords(piv_gpu):
320320

321321

322322
def test_piv_field_mask(piv_gpu):
323-
mask = piv_gpu.field_mask
323+
mask_ = piv_gpu.field_mask
324324

325-
assert isinstance(mask, np.ndarray)
325+
assert isinstance(mask_, np.ndarray)
326326

327327

328-
def test_piv_s2n(piv_gpu):
329-
s2n = piv_gpu.s2n_ratio
328+
def test_piv_s2n(s2n_ratio):
330329

331-
assert isinstance(s2n, gpuarray.GPUArray)
330+
assert isinstance(s2n_ratio, gpuarray.GPUArray)
332331

333332

334333
def test_piv_free_gpu_data(piv_gpu):
@@ -361,9 +360,9 @@ def test_piv_frame_mask(piv_gpu, boolean_np_array):
361360

362361
piv_gpu.mask = boolean_np_array(shape)
363362
piv_gpu._frame_mask_ = None
364-
frame_mask = piv_gpu._frame_mask
363+
frame_mask_ = piv_gpu._frame_mask
365364

366-
assert isinstance(frame_mask, gpuarray.GPUArray)
365+
assert isinstance(frame_mask_, gpuarray.GPUArray)
367366

368367

369368
def test_piv_piv_field_k(piv_gpu):
@@ -388,9 +387,9 @@ def test_piv_get_predictions(piv_gpu, gpu_array, boolean_gpu_array):
388387
shape = (22, 30)
389388

390389
u = v = gpu_array(shape, center=0.0, half_width=1.0)
391-
mask = boolean_gpu_array(shape, seed=1)
390+
mask_ = boolean_gpu_array(shape, seed=1)
392391
piv_gpu._k = 1
393-
piv_gpu._piv_field_k._mask = mask
392+
piv_gpu._piv_field_k._mask = mask_
394393
dp_u, dp_v = piv_gpu._get_predictions(u, v)
395394

396395
assert isinstance(dp_u, gpuarray.GPUArray)
@@ -420,8 +419,8 @@ def test_piv_get_window_deformation(piv_gpu, gpu_array, boolean_gpu_array):
420419
shape = (16, 16)
421420

422421
dp_u = gpu_array(shape, center=0.0, half_width=1.0)
423-
mask = boolean_gpu_array(shape, seed=1)
424-
piv_gpu._piv_field_k._mask_d = mask
422+
mask_ = boolean_gpu_array(shape, seed=1)
423+
piv_gpu._piv_field_k._mask_d = mask_
425424
shift_, strain = piv_gpu._get_window_deformation(dp_u, dp_u)
426425

427426
assert isinstance(shift_, gpuarray.GPUArray)
@@ -435,9 +434,9 @@ def test_piv_update_velocity(
435434
i_peak, j_peak = peaks_reshape
436435

437436
dp_u = gpu_array(i_peak.shape, center=0.0, half_width=1.0) if dp_u else None
438-
mask = boolean_gpu_array(i_peak.shape, seed=2)
437+
mask_ = boolean_gpu_array(i_peak.shape, seed=2)
439438
piv_gpu._k = 0
440-
piv_gpu._piv_field_k._mask_d = mask
439+
piv_gpu._piv_field_k._mask_d = mask_
441440
u, v = piv_gpu._update_velocity(dp_u, dp_u, i_peak, i_peak)
442441

443442
assert isinstance(u, gpuarray.GPUArray)
@@ -577,9 +576,9 @@ def test_field_mask():
577576

578577
x0, y0 = np.meshgrid(np.arange(ht), np.arange(wd))
579578
x1, y1 = np.meshgrid(np.arange(0, ht, 2), np.arange(0, wd, 2))
580-
frame_mask = np.round((1 + np.cos(x0 * w) * np.cos(y0 * w)) / 2).astype(int)
579+
frame_mask_ = np.round((1 + np.cos(x0 * w) * np.cos(y0 * w)) / 2).astype(int)
581580
field_mask0 = np.round((1 + np.cos(x1 * w) * np.cos(y1 * w)) / 2).astype(int)
582-
field_mask1 = process._field_mask(x1, y1, frame_mask)
581+
field_mask1 = process._field_mask(x1, y1, frame_mask_)
583582

584583
assert np.array_equal(field_mask1, field_mask0)
585584

@@ -743,9 +742,9 @@ def test_cross_correlate(shape: tuple, array_pair):
743742
)[m - 1 :, n - 1 :]
744743
correlation_np = correlation
745744
correlation_d = process._gpu_cross_correlate(win_a_d, win_b_d)
746-
correlation_gpu = correlation_d.get()
745+
correlation_gpu_ = correlation_d.get()
747746

748-
assert np.allclose(correlation_gpu, correlation_np, atol=1e-5)
747+
assert np.allclose(correlation_gpu_, correlation_np, atol=1e-5)
749748

750749

751750
def test_gpu_window_index_f(array_pair):
@@ -972,9 +971,9 @@ def test_gpu_update_field(array_pair, boolean_array_pair):
972971

973972
dp, dp_d = array_pair(shape, center=0.0, half_width=1.0)
974973
peak, peak_d = array_pair(shape, center=0.0, half_width=1.0, seed=1)
975-
mask, mask_d = boolean_array_pair(shape, seed=2)
974+
mask_, mask_d = boolean_array_pair(shape, seed=2)
976975

977-
f_np = (dp + peak) * (mask == 0)
976+
f_np = (dp + peak) * (mask_ == 0)
978977
f_gpu = process._gpu_update_field(dp_d, peak_d, mask_d).get()
979978

980979
assert np.array_equal(f_np, f_gpu)

0 commit comments

Comments
 (0)