MouseLand / suite2p

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

BUG: KeyError: "'ndx-ellipse-eye-tracking' not a namespace" #1024

Closed rcpeene closed 7 months ago

rcpeene commented 11 months ago

Describe the issue:

I am attempting to provide an NWB file as input to Suite2p. The documentation wasn't super clear as to if/how Suite2p could take NWB files as input, but I followed the information presented here

However, running Suite2p fails with the traceback attached below.

These NWB files are packaged with some of the latest versions. I am not 100% sure, but I believe that the older PyNWB is not capable of opening these new ones, unless load_namespaces=True is provided into the call to NWBHDF5IO. I think most NWB files will fail to be opened by suite2P unless this is changed.

Reproduce the code example:

ops = suite2p.default_ops()
ops['threshold_scaling'] = suite2p_threshold_scaling
ops['fs'] = float(sampling_rate) # sampling rate of recording, determines binning for cell detection
ops['tau'] = 0.7 # timescale of gcamp to use for deconvolution
ops['do_registration'] = 0 # data was already registered
ops['save_NWB'] = 1
ops['save_folder'] = results_folder
ops['fast_disk'] = scratch_folder
ops["save_nwb"] = 1
ops["data_path"] = ["./"]
ops["nwb_file"] = "./sub-634402_ses-1209063020-acq-1209359211raw_ophys.nwb"

output_ops = suite2p.run_s2p(ops=ops)

Error message:

{}
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[16], line 15
     11 ops["nwb_file"] = "./sub-634402_ses-1209063020-acq-1209359211raw_ophys.nwb"
     12 # ops["h5py"] = ["./"]
     13 # ops["h5py_key"] = "acquisition/raw_suite2p_motion_corrected/data"
---> 15 output_ops = suite2p.run_s2p(ops=ops)

File c:\Users\carter.peene\AppData\Local\Programs\Python\Python39\lib\site-packages\suite2p\run_s2p.py:407, in run_s2p(ops, db, server)
    397 convert_funs = {
    398     'h5': io.h5py_to_binary,
    399     'nwb': io.nwb_to_binary,
   (...)
    404     'bruker': io.ome_to_binary,
    405 }
    406 if ops['input_format'] in convert_funs:
--> 407     ops0 = convert_funs[ops['input_format']](ops.copy())
    408     if isinstance(ops, list):
    409         ops0 = ops0[0]

File c:\Users\carter.peene\AppData\Local\Programs\Python\Python39\lib\site-packages\suite2p\io\nwb.py:84, in nwb_to_binary(ops)
     81     nwb_driver = ops["nwb_driver"]
     83 with NWBHDF5IO(ops["nwb_file"], "r", driver=nwb_driver) as fio:
---> 84     nwbfile = fio.read()
     86     # get TwoPhotonSeries
...
    327 if spec_ns is None:
--> 328     raise KeyError("'%s' not a namespace" % namespace)
    329 return spec_ns.get_hierarchy(data_type)

KeyError: "'ndx-ellipse-eye-tracking' not a namespace"

Version information:

suite2p v0.12.1

Context for the issue:

No response

chriski777 commented 8 months ago

Hey @rcpeene, sorry for the late reply. Is this still an issue with the latest version of suite2p?

chriski777 commented 7 months ago

Following up on this @rcpeene, does this problem persist?

chriski777 commented 7 months ago

Closing due to inactivity