neuroinformatics-unit / rsp-vision

Analysis and visualization of calcium imaging data from retrosplenial cortex
BSD 3-Clause "New" or "Revised" License
8 stars 0 forks source link

[BUG] Cannot read some files with h5py #73

Closed lauraporta closed 1 year ago

lauraporta commented 1 year ago

Describe the bug The analysis of some datasets fails for an h5py error when loading the summary data.

To Reproduce Try to analyse the dataset: CX_102_2_hL_RSPd_FOV3_monitor _right

Expected behaviour It should be possible to open this file as all the others because I can open it in matlab.

Log file

ERROR    2023-07-19 15:45:24 PM - ERROR -       app.py:45
                                MainProcess app.py:45 - Unable to open          
                                file (file signature not found)                 
                                Traceback (most recent call last):              
                                  File                                          
                                "/nfs/nhome/live/lporta/source/rsp-vis          
                                ion/rsp_vision/console_application/app          
                                .py", line 42, in inner_function                
                                    func(*args, **kwargs)                       
                                  File                                          
                                "/nfs/nhome/live/lporta/source/rsp-vis          
                                ion/rsp_vision/console_application/app          
                                .py", line 145, in analysis_pipeline            
                                    data, folder_naming =                       
                                load_data(folder_name, config)                  
                                                          ^^^^^^^^^^^^          
                                ^^^^^^^^^^^^^^^^^^                              
                                  File                                          
                                "/nfs/nhome/live/lporta/source/rsp-vis          
                                ion/rsp_vision/load/load_data.py",              
                                line 31, in load_data                           
                                    data_raw =                                  
                                load_data_from_filename(folder_naming,          
                                config)                                         
                                               ^^^^^^^^^^^^^^^^^^^^^^^          
                                ^^^^^^^^^^^^^^^^^^^^^^^                         
                                  File                                          
                                "/nfs/nhome/live/lporta/source/rsp-vis          
                                ion/rsp_vision/load/load_data.py",              
                                line 48, in load_data_from_filename             
                                    with                                        
                                h5py.File(allen_data_files[0].path,             
                                "r") as h5py_file:                              
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^          
                                ^^^^^^^^^^^                                     
                                  File                                          
                                "/nfs/nhome/live/lporta/micromamba/env          
                                s/rsp/lib/python3.11/site-packages/h5p          
                                y/_hl/files.py", line 567, in __init__          
                                    fid = make_fid(name, mode,                  
                                userblock_size, fapl, fcpl, swmr=swmr)          
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^          
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                 
                                  File                                          
                                "/nfs/nhome/live/lporta/micromamba/env          
                                s/rsp/lib/python3.11/site-packages/h5p          
                                y/_hl/files.py", line 231, in make_fid          
                                    fid = h5f.open(name, flags,                 
                                fapl=fapl)                                      
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^          
                                ^^^^                                            
                                  File "h5py/_objects.pyx", line 54,            
                                in h5py._objects.with_phil.wrapper              
                                  File "h5py/_objects.pyx", line 55,            
                                in h5py._objects.with_phil.wrapper              
                                  File "h5py/h5f.pyx", line 106, in             
                                h5py.h5f.open                                   
                                OSError: Unable to open file (file              
                                signature not found)                       

Screenshots

Computer used (please complete the following information):

Additional context Add any other context about the problem here.

lauraporta commented 1 year ago

Solved by resaving the files save(save_name, '-v7.3', '-fromStruct', f_data, 'f', 'stim', 'trig', 'day', 'is_cell');