CaImAn icon indicating copy to clipboard operation
CaImAn copied to clipboard

evaluate_components crashes when using non-integer gSig

Open oterocoronel opened this issue 1 year ago • 6 comments

I don't know if there is a strong reason to use integers for the values of gSig, but I tried using [2.5, 2.5] and CNMF ran just fine. However, when trying to evaluate the components, the line 332 in evaluate_components.py crashed:

crop_imgs = [
        mm.toarray().reshape(dims, order='F')[com[0] - half_crop[0]:com[0] + half_crop[0], com[1] -
                                              half_crop[1]:com[1] + half_crop[1]] for mm, com in zip(A.tocsc().T, coms)
    ]

The issue was that half_crop was a float and not an integer. I was able to fix this by adding some int() and round() in line 327 so it now reads like this:

half_crop = np.minimum(int(round(gSig[0] * 4 + 1)), patch_size), np.minimum(int(round(gSig[1] * 4 + 1)), patch_size)

oterocoronel avatar Apr 26 '23 07:04 oterocoronel