MouseLand / suite2p

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

New s2p version cannot handle lists of h5 files #1149

Open oterocoronel opened 2 days ago

oterocoronel commented 2 days ago

Describe the issue:

If "h5py" in ops is a list, then the function find_files_open_binaries turns it into a list of lists when doing:

fs = [fs]

This causes the following error:

Traceback (most recent call last):

  Cell In[1], line 258
    ops_out = suite2p.run_s2p(ops=ops_folder)

  File ~\miniforge3\envs\suite2p\lib\site-packages\suite2p\run_s2p.py:501 in run_s2p
    ops0 = convert_funs[ops["input_format"]](ops.copy())

  File ~\miniforge3\envs\suite2p\lib\site-packages\suite2p\io\h5.py:54 in h5py_to_binary
    with h5py.File(h5, "r") as f:

  File ~\miniforge3\envs\suite2p\lib\site-packages\h5py\_hl\files.py:536 in __init__
    name = filename_encode(name)

  File ~\miniforge3\envs\suite2p\lib\site-packages\h5py\_hl\compat.py:19 in filename_encode
    filename = fspath(filename)

TypeError: expected str, bytes or os.PathLike object, not list

The issue can be solved by replacing:

fs = [fs]

with:

if not isinstance(fs, list):
                fs = [fs]

I had not experienced this issue in the previous suite2p version

Reproduce the code example:

ops_out = suite2p.run_s2p(ops=ops_folder)

Error message:

No response

Version information:

v0.14.4

Context for the issue:

No response