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: Error finding H5 files (correction included) #1080

Open scottcanoe opened 5 months ago

scottcanoe commented 5 months ago

Describe the issue:

I just updated suite2p, and I got a new error when using h5 files as segmentation input. In 'run_s2p.py', line 458 always sets ops["data_path"] to the root directory ("/"). It's indexing too deeply. See my correction below.

Reproduce the code example:

Here's the relevant section in 'run_s2p.py', starting at line 452.

if len(ops["h5py"]):
        ops["input_format"] = "h5"
        if not HAS_H5PY:
            raise ImportError("h5py not found; pip install h5py")
        # Overwrite data_path with path provided by h5py.
        # Use the directory containing the first h5 file
        # ops["data_path"] = [os.path.split(ops["h5py"][0])[0]]  # this breaks
        ops["data_path"] = [os.path.split(ops['h5py'])[0]]       # do this instead

Error message:

No response

Version information:

suite2p: 0.14.3 Ubuntu 22.04

Context for the issue:

Here are the ops. {'suite2p_version': '0.14.3', 'look_one_level_down': False, 'fast_disk': '/home/scott/ca_analysis_data/temp', 'delete_bin': True, 'mesoscan': False, 'bruker': False, 'bruker_bidirectional': False, 'h5py': '/home/scott/ca_analysis_data/sessions/61107-1/2023-01-27/1/mov.h5', 'h5py_key': 'data', 'nwb_file': '', 'nwb_driver': '', 'nwb_series': '', 'save_path0': '/home/scott/ca_analysis_data/sessions/61107-1/2023-01-27/1', 'save_folder': 'suite2p', 'subfolders': [], 'move_bin': False, 'nplanes': 1, 'nchannels': 1, 'functional_chan': 1, 'tau': 1.0, 'fs': 30.043, 'force_sktiff': False, 'frames_include': -1, 'multiplane_parallel': False, 'ignore_flyback': [], 'preclassify': 0.0, 'save_mat': False, 'save_NWB': False, 'combined': True, 'aspect': 1.0, 'do_bidiphase': True, 'bidiphase': 0, 'bidi_corrected': False, 'do_registration': False, 'two_step_registration': False, 'keep_movie_raw': False, 'nimg_init': 300, 'batch_size': 500, 'maxregshift': 0.1, 'align_by_chan': 1, 'reg_tif': False, 'reg_tif_chan2': False, 'subpixel': 10, 'smooth_sigma_time': 0, 'smooth_sigma': 1.15, 'th_badframes': 1.0, 'norm_frames': True, 'force_refImg': False, 'pad_fft': False, 'nonrigid': True, 'block_size': [128, 128], 'snr_thresh': 1.2, 'maxregshiftNR': 5, '1Preg': False, 'spatial_hp_reg': 42, 'pre_smooth': 0, 'spatial_taper': 40, 'roidetect': True, 'spikedetect': True, 'sparse_mode': True, 'spatial_scale': 0, 'connected': True, 'nbinned': 5000, 'max_iterations': 20, 'threshold_scaling': 1.0, 'max_overlap': 0.75, 'high_pass': 100, 'spatial_hp_detect': 25, 'denoise': False, 'anatomical_only': 0, 'diameter': 16, 'cellprob_threshold': 0.0, 'flow_threshold': 1.5, 'spatial_hp_cp': 0, 'pretrained_model': 'cyto', 'soma_crop': True, 'neuropil_extract': True, 'inner_neuropil_radius': 2, 'min_neuropil_pixels': 350, 'lam_percentile': 50.0, 'allow_overlap': False, 'use_builtin_classifier': False, 'classifier_path': '', 'chan2_thres': 0.65, 'baseline': 'maximin', 'win_baseline': 60.0, 'sig_baseline': 10.0, 'prctile_baseline': 8.0, 'neucoeff': 0.7, 'data_path': ['/home/scott/ca_analysis_data/sessions/61107-1/2023-01-27/1']}