Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to load stim trace in suite2p? #1002

Closed
Yang-xu328 opened this issue Jul 20, 2023 · 2 comments
Closed

How to load stim trace in suite2p? #1002

Yang-xu328 opened this issue Jul 20, 2023 · 2 comments
Assignees

Comments

@Yang-xu328
Copy link

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
Copy link

shclair commented Aug 18, 2023

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
Copy link
Collaborator

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!

tbabola added a commit to tbabola/suite2p that referenced this issue Jun 19, 2024
* add get_nd2_list method

* remove comment

* support pipelining nd2 files

* support pipelining nd2 files

* fix docstring and whitespaces

* bug fix

* final touch

* Modified README to contain updated suite2p installation instructions for mac Ventura OS. Addresses issue MouseLand#897.

* Fixed issue MouseLand#908 regarding badframes for register.py. Detection module was fixed to properly bin movies AFTEr taking into account bad frames.

* Fix blocks issue for nonrigid registration in MouseLand#907

* Update test_and_deploy.yml

* Removed whitespace from display xauthority line in tox.ini.

* Update test_and_deploy.yml

Add apt-get update for linux runner and remove dvc requirement.

* Update test_and_deploy.yml

Added py import to workflow file and added debugging only during job failures

* Update test_and_deploy.yml

* Update tox.ini

* Update test_and_deploy.yml

Remove the up-term step.

* Updated TwophotonSeries initialization for save_nwb in io

* Bump torch from 1.11.0 to 1.13.1

Bumps [torch](https://github.com/pytorch/pytorch) from 1.11.0 to 1.13.1.
- [Release notes](https://github.com/pytorch/pytorch/releases)
- [Changelog](https://github.com/pytorch/pytorch/blob/master/RELEASE.md)
- [Commits](pytorch/pytorch@v1.11.0...v1.13.1)

---
updated-dependencies:
- dependency-name: torch
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update issue templates

* Update installation-issues.yml for issues

* Rename installation-issues.yml to installation-issue.yml

* Update installation issue.yml

* Update bug_report.yml

* Added bug_report.yml issue template

* Update all issue templates

* Update feature_request issue

* Update feature_request.yml

* Fixes issue MouseLand#914 for saving news ops parameters

* Update documentation_issue.yml

* Update documentation_issue.yml

* Fixes multiplane issue MouseLand#905 with save_nwb

* Fixes issue MouseLand#904 for 2 channel manual labeling

* Update .readthedocs.yml

* remove spaces

* conform to function signature and usage pattern a few lines above

* add nd2 in requirements

* minor revision

* new logic

* refactor dim sorting

* revert to previous code

* Fixes the from_stat_dict bug mentioned in MouseLand#935.

* Update run suite2p jupyter notebook to fix issue MouseLand#935

* Addresses MouseLand#930 in which bin_data has trouble dealing with cases in which the current batch has fewer frames than the bin_size

* removed ops assignment

* removed deprecated np.bool

* Update the version of the dependencies for suite2p

* Update np.bool to 'bool' to account for numpy deprecation with latest version

* Add Sparse detection to gui as a setting for running suite2p

* Addresses MouseLand#951 and adds nd2 as an input to gui

* Fix issue with np.asanyarray being changed in numpy 1.24.4

* addressed IndexError

* Update README.md

* Update README.md

* fixing skip torch if version 2.0

* adding pep8 style to repo

* fixing dictionary splitting

* modifying imports

* converting to "" from ''

* converting binaryfile to memmap

* rewriting binarycombined

* removing scanimage-tiff-reader for now

* fixing dragging in gui and linewidth=88

* removing old testing yml

* adding py39, updating readme

* adding option for MouseLand#955

* fixing bug in docstring  (MouseLand#902)

* adding iplane to saved manual ROIs (MouseLand#789)

* fixing MouseLand#747 saving to mat

* making nd2 and scanimage-tiff-reader optional (MouseLand#950)

* removing bruker dependency on scanimage-tiff-reader

* Create codecov.yml

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update BinaryRWFile name usage to BinaryFile

* Add instructions on how to use test_data generation script

* Added instructions on generating new test data

* Add method for writing tiff for binaryFile class

* Update write_tiff for binary.py to crop frames, x, and y too

* fix frame range issue with write_Tiff for binary

* added debugging logs

* removed debugging logs

* removed print statement

* removed unnecessary space

* Fixes MouseLand#943 to address documentation issue with high_pass

* adding copyright to every py file

* Delete .dvc directory

* fixing import error with h5py and paramiko MouseLand#987

* Update README.md

* Add pynwb package to setup.py as tests needs pynwb for one of the io_tests

* Update readme.md to be for python version 3.9

* Addresses MouseLand#944  leading zero issue with tiff filename.

* Addresses MouseLand#944  leading zero issue with tiff filename.

* Update save_path0 to close MouseLand#991.

* Update save_path0 to close MouseLand#991.

* update visualize.py to import rastermap properly

* Re-add connected to GUI options

* Update README.md

Remove note about scanimage-tiff-reader mac incompatibility

* Update README.md

Simplify mac os instructions

* Update setup.py

Update rastermap requirement based on issue ticket suggestions

* Update setup.py

* Updated jupyter notebook to work with new binaryFile class in suite2p.io

* Updated jupyter notebook name

* Update colab 2023 to fully fix MouseLand#1011 and update some comments on notebook

* Updated jupyter notebook to work with new binaryFile class in suite2p.io

* Updated jupyter notebook name

* Update colab 2023 to fully fix MouseLand#1011 and update some comments on notebook

* adding pyqt6 and switching to qtpy

* updating readme and fixing spelling error in copyright

* adding license notice

* adding check in setup.py for installation of a pyqt version

* adding tutorial

* Update tutorial.md with additional comments

* Update suite2p gui to work with QFileDialog.Options() not working with pyqt6

* Update binary.py write_tiff to add all frames to a single series

* Updated tiff.py to use contiguous parameter

* Update README.md

* checking h5py key to open binaries before data_path

* fixing bug in code

* adding new data type

* adding support for binary and mp4/avi files

* enabling ops.json loading in reggui and binary-only processing

* increase tolerance on classification regression test

* add more tolerance

* increasing tolerance again

* increasing tolerance again

* Update README.md

* Add explanation for how to apply classifiers

* CheckState Fix

* Fix conda environment creation for developers

* Update utils.py

* Update README.md to fix MouseLand#1060.

Updates badge links for tests and docs

* Update merge.py of gui subpackage to not use deprecated np.bool

* Update merge.py of gui subpackage to not use deprecated np.bool

* Add import to gui/io.py

* Update gui.rst to have clearer instructions for MouseLand#1002.

* bug in h5py key option

* adding support for multipage bruker ome tiffs

* Update inputs.rst to include multipage bruker instructions

* Update inputs.rst

* Added support for Thorlabs RAW files (io.raw)

* Added xmltodict

* Update raw.py- todo verified

* safe import for xmltodict

* fixing bug with multiplane registration

* allowing reg_file input to compute_zpos

* fixing bug with multi-plane nonrigid ops

* add support for Hamamatsu DCIMG format

* add support for Hamamatsu DCIMG format

* add dcimg_deps to all_deps and restrict cellpose to <3.0

* Addresses MouseLand#1093 with cellpose method having too many arguments

* Addresses MouseLand#1093 with cellpose method having too many arguments

* remove cellpose<3.0 restriction

* Fixes issue MouseLand#1101 with older version of cellpose

* Update zalign.py

Made sure that if a reg_file is given to the zalign function it uses it, rather than the ops reg_file

* Update setup.py

* adding dcimg

* removing dcimg extra

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tdincer <tolgadincer@gmail.com>
Co-authored-by: Chris Ki <chriski777@berkeley.edu>
Co-authored-by: Chris Ki <cski@andrew.cmu.edu>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: carsen-stringer <carsen.stringer@gmail.com>
Co-authored-by: Kabilar Gunalan <kabilar@datajoint.com>
Co-authored-by: itsb <itsb@users.noreply.github.com>
Co-authored-by: Sidharth Hulyalkar <sid.soccer.21@gmail.com>
Co-authored-by: Ahmed Morsi <amorsi@berkeley.edu>
Co-authored-by: Marius Pachitariu <marius10p@gmail.com>
Co-authored-by: Heather Ratigan <hmacomber@uchicago.edu>
Co-authored-by: Ryan Ly <rly@lbl.gov>
Co-authored-by: Arielle Leon <ariellel@alleninstitute.org>
Co-authored-by: Andrew Landau <andrewtylerlandau@gmail.com>
Co-authored-by: arielleleon <54869022+arielleleon@users.noreply.github.com>
Co-authored-by: yaelpri <yael.prilutski@gmail.com>
Co-authored-by: yaelpri <61921608+yaelpri@users.noreply.github.com>
Co-authored-by: Yael Prilutski <61921608+yael-prilutski@users.noreply.github.com>
Co-authored-by: nguyemi5 <nguyemi5@github.com>
Co-authored-by: nguyemi5 <38402644+nguyemi5@users.noreply.github.com>
Co-authored-by: liadJB <48135253+liadJB@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants