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

Exception has occurred: KeyError x 'data' #41

Open
dervinism opened this issue Oct 3, 2022 · 4 comments
Open

Exception has occurred: KeyError x 'data' #41

dervinism opened this issue Oct 3, 2022 · 4 comments

Comments

@dervinism
Copy link

I get this error by executing this line:

derivedData = mat73.loadmat('some_mat_file.mat')
@skjerns
Copy link
Owner

skjerns commented Oct 3, 2022

I cannot reproduce this error, for me it works fine.

  1. Could you upload the file in question and send a link?
  2. Additionally, could you please post the full traceback so I know where the error appears?

@dervinism
Copy link
Author

Hi,

The file can be downloaded via the link: https://drive.google.com/file/d/19937d9LRN6YU-WWxzvIEhsPZIYnhLGEc/view?usp=sharing

That pretty much was the full traceback. The actual traceback is this:

Exception has occurred: KeyError
'data'
  File "/mnt/c/Users/44079/code_repositories/convert2nwbPyNnx/localFunctions.py", line 239, in getSpikes
    derivedData = mat73.loadmat(animalDerivedDataFile)
  File "/mnt/c/Users/44079/code_repositories/convert2nwbPyNnx/convert2nwb.py", line 101, in <module>
    (spikes, metadata, derivedData) = getSpikes(derivedData, animalID, sessionID[iSess], tbl)

@skjerns
Copy link
Owner

skjerns commented Oct 4, 2022

Thanks for providing the file!

It seems like there is some problem with loading the sparse matrices in /dataStruct/seriesData_positive/M190114_A_MD_s201901221911037/shankData/shank1/sp

this seems to be a sparse matrix format that I did not encounter yet

I'll see if I find time to fix it.

in the meantime as a workaround, you can try to catch the exception in line 147 in core.py by adding

                    except KeyError as e:
                        unpacked = None

@skjerns
Copy link
Owner

skjerns commented Mar 23, 2024

@dervinism does the newest fix at #53 and the newest release fix the problem?

related: #52 #51

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

2 participants