cortex-lab / Suite2P

Tools for processing 2P recordings
Other
120 stars 65 forks source link

bug in GetRandFrames() due to reshape() #166

Open MikaDia opened 5 years ago

MikaDia commented 5 years ago

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.

carsen-stringer commented 5 years ago

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?

MikaDia commented 5 years ago

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

Sent from my Samsung Galaxy smartphone.

-------- Original message -------- From: carsen-stringer notifications@github.com Date: 18/03/2019 20:12 (GMT+00:00) To: cortex-lab/Suite2P Suite2P@noreply.github.com Cc: "Diamanti, Efthymia" efthymia.diamanti.11@ucl.ac.uk, Author author@noreply.github.com 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.

carsen-stringer commented 5 years ago

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 commented 5 years ago

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

MikaDia commented 5 years ago

Thanks Carsen!

Yes now I understand!

-------- Original message -------- From: carsen-stringer notifications@github.com Date: 18/03/2019 20:57 (GMT+00:00) To: cortex-lab/Suite2P Suite2P@noreply.github.com Cc: "Diamanti, Efthymia" efthymia.diamanti.11@ucl.ac.uk, Author author@noreply.github.com 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.

carsen-stringer commented 5 years ago

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

MikaDia commented 5 years ago

Sure! I'll get back to it tomorrow.

Sent from my Samsung Galaxy smartphone.

-------- Original message -------- From: carsen-stringer notifications@github.com Date: 18/03/2019 21:00 (GMT+00:00) To: cortex-lab/Suite2P Suite2P@noreply.github.com Cc: "Diamanti, Efthymia" efthymia.diamanti.11@ucl.ac.uk, Author author@noreply.github.com 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.