Suite2P icon indicating copy to clipboard operation
Suite2P copied to clipboard

bug in GetRandFrames() due to reshape()

Open MikaDia opened this issue 5 years ago • 7 comments

Hi guys!

In lines 65 and 109 you reshape the data from a 3-dimensional array into a 4-dimensional array with dimensions: [Ly, Lx, nPlanes, nFrames]. Hence, the code crashes if the length of the 3rd dimension is not divisible by nplanes. For example, say you have a tiff file with 2000 frames and you want to sample from 7 planes.

MikaDia avatar Mar 18 '19 19:03 MikaDia

Do you have target frame non-empty? I can see how that block could error (line 65 if min(ops.NimgFirstRegistration, numFrnplanesnchannels) is the ops.NimgFirstRegistration).

However, in the else statement (line 102), tiffs that don't have enough frames should be skipped. And if it has enough frames then nchannels*nplanes*nfmax should be divisible by nplanes correct? What are the ichanset values that you're getting? are those divisible by nplanes?

carsen-stringer avatar Mar 18 '19 20:03 carsen-stringer

Yes, target frame is non-empty. I get the error in line 65.

Sent from my Samsung Galaxy smartphone.

-------- Original message -------- From: carsen-stringer [email protected] Date: 18/03/2019 20:12 (GMT+00:00) To: cortex-lab/Suite2P [email protected] Cc: "Diamanti, Efthymia" [email protected], Author [email protected] Subject: Re: [cortex-lab/Suite2P] bug in GetRandFrames() due to reshape() (#166)

Do you have target frame non-empty? I can see how that block could error (line 65 if min(ops.NimgFirstRegistration, numFrnplanesnchannels) is the ops.NimgFirstRegistration).

However, in the else statement (line 102), tiffs that don't have enough frames should be skipped. And if it has enough frames then nchannelsnplanesnfmax should be divisible by nplanes correct? What are the ichanset values that you're getting? are those divisible by nplanes?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/cortex-lab/Suite2P/issues/166#issuecomment-474081914, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APMNo1NtqD0I93Xj9J2HW04sqK_ISEPKks5vX_MdgaJpZM4b6oua.

MikaDia avatar Mar 18 '19 20:03 MikaDia

ah okay, is numFr an integer? The line to check and change is 54. numFrnchannelsnplanes should be an integer and also less than the number of frames in your tiff.

carsen-stringer avatar Mar 18 '19 20:03 carsen-stringer

sorry github changed formatting numFr*nchannels*nplanes should be an integer

carsen-stringer avatar Mar 18 '19 20:03 carsen-stringer

Thanks Carsen!

Yes now I understand!

-------- Original message -------- From: carsen-stringer [email protected] Date: 18/03/2019 20:57 (GMT+00:00) To: cortex-lab/Suite2P [email protected] Cc: "Diamanti, Efthymia" [email protected], Author [email protected] Subject: Re: [cortex-lab/Suite2P] bug in GetRandFrames() due to reshape() (#166)

ah okay, is numFr an integer? The line to check and change is 54. numFrnchannelsnplanes should be an integer and also less than the number of frames in your tiff.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/cortex-lab/Suite2P/issues/166#issuecomment-474098042, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APMNo9kOZDdut11dChfYQnhrcHr-PRmsks5vX_3BgaJpZM4b6oua.

MikaDia avatar Mar 18 '19 20:03 MikaDia

also if you figure out a fix can you please test it and then make a pull request with the fix :)

carsen-stringer avatar Mar 18 '19 21:03 carsen-stringer

Sure! I'll get back to it tomorrow.

Sent from my Samsung Galaxy smartphone.

-------- Original message -------- From: carsen-stringer [email protected] Date: 18/03/2019 21:00 (GMT+00:00) To: cortex-lab/Suite2P [email protected] Cc: "Diamanti, Efthymia" [email protected], Author [email protected] Subject: Re: [cortex-lab/Suite2P] bug in GetRandFrames() due to reshape() (#166)

also if you figure out a fix can you please test it and then make a pull request with the fix :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/cortex-lab/Suite2P/issues/166#issuecomment-474099055, or mute the threadhttps://github.com/notifications/unsubscribe-auth/APMNo5OeBEjIpCnzCdu0ZC-deTCtKPNVks5vX_5rgaJpZM4b6oua.

MikaDia avatar Mar 18 '19 21:03 MikaDia