@@ -161,18 +161,18 @@ def _window_size_parameterization(ws_iters, min_window_size):
161
161
162
162
163
163
# 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 )
166
166
167
167
168
- def test_correlation_gpu_init_fft_shape (correlation_gpu , piv_field_gpu ):
168
+ def test_correlation_gpu_init_fft_shape (correlation_gpu ):
169
169
fft_shape = correlation_gpu .fft_shape
170
170
171
171
assert round (log2 (fft_shape [0 ])) == log2 (fft_shape [0 ])
172
172
assert round (log2 (fft_shape [1 ])) == log2 (fft_shape [1 ])
173
173
174
174
175
- def test_correlation_gpu_correlate_windows (correlation_gpu , piv_field_gpu ):
175
+ def test_correlation_gpu_correlate_windows (correlation_gpu ):
176
176
shape = (32 , 32 )
177
177
fft_shape = correlation_gpu .fft_shape [0 ]
178
178
a = 1
@@ -249,9 +249,9 @@ def test_correlation_gpu_free_gpu_data(correlation_gpu):
249
249
250
250
251
251
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 )
253
253
254
- assert isinstance (mask , gpuarray .GPUArray )
254
+ assert isinstance (mask_ , gpuarray .GPUArray )
255
255
256
256
257
257
@pytest .mark .parametrize ("search_size" , [16 , 32 ])
@@ -320,15 +320,14 @@ def test_piv_coords(piv_gpu):
320
320
321
321
322
322
def test_piv_field_mask (piv_gpu ):
323
- mask = piv_gpu .field_mask
323
+ mask_ = piv_gpu .field_mask
324
324
325
- assert isinstance (mask , np .ndarray )
325
+ assert isinstance (mask_ , np .ndarray )
326
326
327
327
328
- def test_piv_s2n (piv_gpu ):
329
- s2n = piv_gpu .s2n_ratio
328
+ def test_piv_s2n (s2n_ratio ):
330
329
331
- assert isinstance (s2n , gpuarray .GPUArray )
330
+ assert isinstance (s2n_ratio , gpuarray .GPUArray )
332
331
333
332
334
333
def test_piv_free_gpu_data (piv_gpu ):
@@ -361,9 +360,9 @@ def test_piv_frame_mask(piv_gpu, boolean_np_array):
361
360
362
361
piv_gpu .mask = boolean_np_array (shape )
363
362
piv_gpu ._frame_mask_ = None
364
- frame_mask = piv_gpu ._frame_mask
363
+ frame_mask_ = piv_gpu ._frame_mask
365
364
366
- assert isinstance (frame_mask , gpuarray .GPUArray )
365
+ assert isinstance (frame_mask_ , gpuarray .GPUArray )
367
366
368
367
369
368
def test_piv_piv_field_k (piv_gpu ):
@@ -388,9 +387,9 @@ def test_piv_get_predictions(piv_gpu, gpu_array, boolean_gpu_array):
388
387
shape = (22 , 30 )
389
388
390
389
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 )
392
391
piv_gpu ._k = 1
393
- piv_gpu ._piv_field_k ._mask = mask
392
+ piv_gpu ._piv_field_k ._mask = mask_
394
393
dp_u , dp_v = piv_gpu ._get_predictions (u , v )
395
394
396
395
assert isinstance (dp_u , gpuarray .GPUArray )
@@ -420,8 +419,8 @@ def test_piv_get_window_deformation(piv_gpu, gpu_array, boolean_gpu_array):
420
419
shape = (16 , 16 )
421
420
422
421
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_
425
424
shift_ , strain = piv_gpu ._get_window_deformation (dp_u , dp_u )
426
425
427
426
assert isinstance (shift_ , gpuarray .GPUArray )
@@ -435,9 +434,9 @@ def test_piv_update_velocity(
435
434
i_peak , j_peak = peaks_reshape
436
435
437
436
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 )
439
438
piv_gpu ._k = 0
440
- piv_gpu ._piv_field_k ._mask_d = mask
439
+ piv_gpu ._piv_field_k ._mask_d = mask_
441
440
u , v = piv_gpu ._update_velocity (dp_u , dp_u , i_peak , i_peak )
442
441
443
442
assert isinstance (u , gpuarray .GPUArray )
@@ -577,9 +576,9 @@ def test_field_mask():
577
576
578
577
x0 , y0 = np .meshgrid (np .arange (ht ), np .arange (wd ))
579
578
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 )
581
580
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_ )
583
582
584
583
assert np .array_equal (field_mask1 , field_mask0 )
585
584
@@ -743,9 +742,9 @@ def test_cross_correlate(shape: tuple, array_pair):
743
742
)[m - 1 :, n - 1 :]
744
743
correlation_np = correlation
745
744
correlation_d = process ._gpu_cross_correlate (win_a_d , win_b_d )
746
- correlation_gpu = correlation_d .get ()
745
+ correlation_gpu_ = correlation_d .get ()
747
746
748
- assert np .allclose (correlation_gpu , correlation_np , atol = 1e-5 )
747
+ assert np .allclose (correlation_gpu_ , correlation_np , atol = 1e-5 )
749
748
750
749
751
750
def test_gpu_window_index_f (array_pair ):
@@ -972,9 +971,9 @@ def test_gpu_update_field(array_pair, boolean_array_pair):
972
971
973
972
dp , dp_d = array_pair (shape , center = 0.0 , half_width = 1.0 )
974
973
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 )
976
975
977
- f_np = (dp + peak ) * (mask == 0 )
976
+ f_np = (dp + peak ) * (mask_ == 0 )
978
977
f_gpu = process ._gpu_update_field (dp_d , peak_d , mask_d ).get ()
979
978
980
979
assert np .array_equal (f_np , f_gpu )
0 commit comments