Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug in correlation image calculation #1304

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions caiman/summary_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def local_correlations(Y, eight_neighbours: bool = True, swap_dim: bool = True,
Returns:
rho: d1 x d2 [x d3] matrix, cross-correlation with adjacent pixels
"""

print("Testing corr func")
if swap_dim:
Y = np.transpose(Y, tuple(np.hstack((Y.ndim - 1, list(range(Y.ndim))[:-1]))))

Expand Down Expand Up @@ -248,14 +248,14 @@ def local_correlations(Y, eight_neighbours: bool = True, swap_dim: bool = True,
rho_d1 = rho_d1
rho_d2 = rho_d2
rho[:-1, :-1] = rho[:-1, :-1] * rho_d2
rho[1:, 1:] = rho[1:, 1:] * rho_d1
rho[1:, 1:] = rho[1:, 1:] * rho_d2
rho[1:, :-1] = rho[1:, :-1] * rho_d1
rho[:-1, 1:] = rho[:-1, 1:] * rho_d2
rho[:-1, 1:] = rho[:-1, 1:] * rho_d1
else:
rho[:-1, :-1] = rho[:-1, :-1] + rho_d2**(order_mean)
rho[1:, 1:] = rho[1:, 1:] + rho_d1**(order_mean)
rho[1:, 1:] = rho[1:, 1:] + rho_d2**(order_mean)
rho[1:, :-1] = rho[1:, :-1] + rho_d1**(order_mean)
rho[:-1, 1:] = rho[:-1, 1:] + rho_d2**(order_mean)
rho[:-1, 1:] = rho[:-1, 1:] + rho_d1**(order_mean)

neighbors = 8 * np.ones(np.shape(Y)[1:3])
neighbors[0, :] = neighbors[0, :] - 3
Expand Down
Loading