MouseLand / suite2p

cell detection in calcium imaging recordings
http://www.suite2p.org
GNU General Public License v3.0
344 stars 240 forks source link

How to load stim trace in suite2p? #1002

Closed Yang-xu328 closed 9 months ago

Yang-xu328 commented 1 year ago

Hi,

I'm currently unable to load a stim trace in suite2p. I write an 1D trace (same length as the recorded file in 2-photon microscope) in matlab and use writeNPY function to convert my trace into npy file. However, when I load stim trace in suite2p, it shows the following error:

Traceback (most recent call last): File "C:\Users\xy\anaconda3\envs\suite2p\lib\site-packages\suite2p\gui\menus.py", line 40, in parent.loadBeh.triggered.connect(lambda: io.load_behavior(parent)) File "C:\Users\xy\anaconda3\envs\suite2p\lib\site-packages\suite2p\gui\io.py", line 372, in load_behavior parent.beh_resampled = resample_frames(parent.beh, parent.beh_time, np.arange(0,parent.Fcell.shape[1])) File "C:\Users\xy\anaconda3\envs\suite2p\lib\site-packages\suite2p\gui\io.py", line 392, in resample_frames y = gaussian_filter1d(y, np.ceil(ts/2), axis=0) NameError: name 'gaussian_filter1d' is not defined

I don't code in python so I have no idea what is wrong about this process. I'm wondering is there any requirement for the format of my stim trace? Cause i just wrote the trace in several pulses with different amplitudes. (for each pulse last for 2 points, figure below) stim-trace

Thanks for your help!

shclair commented 1 year ago

I am having the same issue! my stim trace is just 0s and 1s to show trains of electrical stimulation...

except my first error is this:

numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'divide' output from dtype('float64') to dtype('int32') with casting rule 'same_kind'

I don't know anything about python and we are trying to figure out if Suite2P is right for us!

Would be great if they could have included an example of a stim trace in the documentation...

chriski777 commented 9 months ago

Hi @Yang-xu328, this was an import error and has been addressed in the latest commit of the main branch. An example of how to create a 1D arr to use as a stim trace can be found in this link. Please refer to the section titled "Correlations with 1D var". I'll close this issue for now but feel free to re-open if the issue persists!