Skip to content

Seeking Clarification on Calculation Details in local_correlations #1190

Answered by j-friedrich
rcalfredson asked this question in Q&A
Discussion options

You must be logged in to vote

@rcalfredson you are correct, $\rho_{d1}$ and $\rho_{d2}$ need to be swapped in lines 257 and 259. Thanks for the heads up. I personally use a PyTorch version of this function (it's ~10x faster on GPU than either of the CaImAn implementations) but haven't yet noticed the bug. If you run the corrected local_correlations and local_correlations_fft you'll see that the results now agree within numerical precision. (Someone with time on their hands could add this as a unit test)

Here the corrected code:

def local_correlations(
    mov: np.ndarray,
    eight_neighbours: bool = True,
    device: str = "cuda" if torch.cuda.is_available() else "cpu",
) -> np.ndarray:
    """Computes the correlatio…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rcalfredson
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants