Skip to content

Commit

Permalink
Apply automatic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user authored and Action black fromatter committed Apr 21, 2022
1 parent 5ebde30 commit b1dbdc3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fimpy/alignment/reg_from_skimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def register_translation(
# Center of output array at dftshift + 1
dftshift = np.fix(upsampled_region_size / 2.0)
upsample_factor = np.array(upsample_factor, dtype=np.float64)
normalization = src_freq.size * upsample_factor ** 2
normalization = src_freq.size * upsample_factor**2
# Matrix multiply DFT around the current shift estimate
sample_region_offset = dftshift - shifts * upsample_factor
cross_correlation = _upsampled_dft(
Expand Down
2 changes: 1 addition & 1 deletion fimpy/roi_extraction/corr_algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def _jit_flood(

i_roi = 0

max_r2 = max_radius ** 2
max_r2 = max_radius**2
voxel_size2 = _tuple3_square(voxel_size)

valid = corr_map.copy()
Expand Down
2 changes: 1 addition & 1 deletion fimpy/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def fast_pearson(x, y):
s_y += y[i]
s_x2 += x[i] ** 2
s_y2 += y[i] ** 2
denominator = math.sqrt((s_x2 - (s_x ** 2) / n) * (s_y2 - (s_y ** 2) / n))
denominator = math.sqrt((s_x2 - (s_x**2) / n) * (s_y2 - (s_y**2) / n))
if denominator == 0:
return 0
return (s_xy - s_x * s_y / n) / denominator
Expand Down
6 changes: 3 additions & 3 deletions tests/test_roi_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_positive_corr():
]
)

np.testing.assert_allclose(cm, expected_result, atol=2 / 2 ** 15)
np.testing.assert_allclose(cm, expected_result, atol=2 / 2**15)


def test_big_vals():
Expand All @@ -55,14 +55,14 @@ def test_big_vals():
[[255, 255, 255], [0, 255, 255], [0, 0, 0]],
]
)
* 2 ** 4
* 2**4
)

cm = correlation_map(video[:, None, :, :], window_size=(1, 3, 3))

result = np.array([[0, 0, 0], [0, 0.375, 0], [0, 0, 0]])[None, :, :]

assert np.all(np.isclose(cm, result, atol=2 / 2 ** 15))
assert np.all(np.isclose(cm, result, atol=2 / 2**15))


def test_simple_flood_case():
Expand Down

0 comments on commit b1dbdc3

Please sign in to comment.