python-neo icon indicating copy to clipboard operation
python-neo copied to clipboard

An OSError about header when importing neuralynx data

Open redagavin opened this issue 2 years ago • 21 comments

Describe the bug I was trying to import neuralynx data into python using neo. But, I got an OSError. This is a screenshot of the error. Screen Shot 2022-11-27 at 5 07 43 PM

Also, I noticed that there is a small bug in the line that raise the OSError. I think .format(an, av) is supposed to fill the first {} with an and the second {} with av. However, only the second string after the + calls .format(an, av) in the source code, which is why the error message is weird. Screen Shot 2022-11-27 at 5 19 11 PM

To Reproduce In order to reproduce, just use the two lines of code in the screenshot. The error occurs when reading a file that I can't share publicly. Please get in touch with me and I will share the file privately.

Environment:

  • OS: Linux
  • Python version: 3.8.13
  • Neo version: 0.11.1

redagavin avatar Nov 28 '22 17:11 redagavin

@samuelgarcia @JuliaSprenger @apdavison Could you please take a look at this? Thanks!

redagavin avatar Jan 06 '23 23:01 redagavin

Hi, thanks for the report. Could you send us a file to debug this ?

@JuliaSprenger @PeterNSteinmetz: would you have time to handle this, you are our best neuralynx expert!

samuelgarcia avatar Jan 09 '23 10:01 samuelgarcia

Hi, thanks for the report. Could you send us a file to debug this ?

@JuliaSprenger @PeterNSteinmetz: would you have time to handle this, you are our best neuralynx expert!

@samuelgarcia @JuliaSprenger @PeterNSteinmetz Yes, I can send you a file to debug this. Please provide me with a link so that I can share the file privately.

redagavin avatar Jan 09 '23 23:01 redagavin

Gavin, I can take a look at that. Can you send via email to [email protected] ? Alternatively, do you use Google Drive? If so you could share with me there - username is PeterNSteinmetz

PeterNSteinmetz avatar Jan 10 '23 00:01 PeterNSteinmetz

Gavin, I can take a look at that. Can you send via email to [email protected] ? Alternatively, do you use Google Drive? If so you could share with me there - username is PeterNSteinmetz

@PeterNSteinmetz I sent the files to you through email and google drive. Please take a look. Thanks!

redagavin avatar Jan 10 '23 20:01 redagavin

Thank you Peter!

samuelgarcia avatar Jan 11 '23 07:01 samuelgarcia

I now have a fix for this issue. New undocumented header strings for Cheetah v 5.6.0 caused this. I want to add the test data to ephy_testing_data.

So @redagavin, can you please provide permission and desired credit/attribution for including one shortened .ncs file (26.8 kB) and one shortened .ntt file (22.4 kB) from what you sent me to the repository at https://gin.g-node.org/NeuralEnsemble/ephy_testing_data

PeterNSteinmetz avatar Jan 16 '23 23:01 PeterNSteinmetz

@samuelgarcia @JuliaSprenger Also will need some help here again placing the data in the ephy_testing_data repository. (Sorry but this whole gin thing is not very clear to me because I usually think in git terms).

I have my own clone of this project and have that checked out and synced and have a master branch on the web site. What do I need to do to make sure that my master is up to date with the project master? I don't see any sort of sync button.

Then I need to create a branch, unlock the Neuralynx folder, add a new sub-folder with two files, lock it and then commit and push to my branch on my repository. Then open a pull request on the project master?

Is there somewhere where this sort of adding things to an already existing clone is laid out?

PeterNSteinmetz avatar Jan 17 '23 00:01 PeterNSteinmetz

@samuelgarcia @JuliaSprenger We have no word yet on the use of the sample files for testing. How do you want to proceed?

I could just create a code branch for Neo with the fixes but without any tests.

Alternately, I could hack the headers on these a bit to anonymize them and either remove all the data records or replace the data with random samples. The test files would then be completely synthetic, but not as realistic.

PeterNSteinmetz avatar Jan 23 '23 17:01 PeterNSteinmetz

@samuelgarcia @JuliaSprenger Bumping this as I was just going to add something to NeuralynxRawIO and want to be up to date with the main branch.

PeterNSteinmetz avatar Mar 13 '23 16:03 PeterNSteinmetz

I have my own clone of this project and have that checked out and synced and have a master branch on the web site. What do I need to do to make sure that my master is up to date with the project master? I don't see any sort of sync button.

If you are using the gin-cli simply gin download will update your local copy of the branch you have currently checked out.

Then I need to create a branch, unlock the Neuralynx folder, add a new sub-folder with two files, lock it and then commit and push to my branch on my repository. Then open a pull request on the project master?

For adding new files you don't need to unlock existing files (folders can not be in a locked state, only files can). Also note that since git annexed files are not shared between forks, you should push your feature branch directly to the Neuralensemble/ephy_testing_data repo and not your fork. You should have permission to do so as you are already listed as a collaborator. To be sure the gin-cli runs smoothly ensure that you are using a git-annex<9 and not the latest version, since we noticed some issues with that version (see also this issue)

Tell me if you have further question following the contribution guideline

JuliaSprenger avatar Mar 13 '23 16:03 JuliaSprenger

@JuliaSprenger Actually there is the issue noted here in the Jan 23 comment. We don't have permission to use the test files which were given.

PeterNSteinmetz avatar Mar 13 '23 17:03 PeterNSteinmetz

@redagavin Could you comment on this?

So @redagavin, can you please provide permission and desired credit/attribution for including one shortened .ncs file (26.8 kB) and one shortened .ntt file (22.4 kB) from what you sent me to the repository at https://gin.g-node.org/NeuralEnsemble/ephy_testing_data

JuliaSprenger avatar Mar 13 '23 17:03 JuliaSprenger

Well see if that produces anything. I have been in touch with him via email to get the files and wrote and received nothing.

PeterNSteinmetz avatar Mar 13 '23 17:03 PeterNSteinmetz

Hi, I solved a similar bug in my fork. The issue was that neo didn't recognize the "RawDataFile" option in the headerstring. This is set when ".ncs" files are created by offline replay of raw data ".nrd" files. You'll find the fork here https://github.com/GeezleCode/python-neo. The branch containing the few changes is called "NeuralynxIORawDataSystem". I haven't created a pull request yet.

GeezleCode avatar Mar 16 '23 11:03 GeezleCode

Hi @GeezleCode Thanks for fixing another issue of the NeuralynxIO. If you want your fix to be included in neo, could you open a PR?

JuliaSprenger avatar Mar 16 '23 12:03 JuliaSprenger

@JuliaSprenger Done! #1234

GeezleCode avatar Mar 16 '23 12:03 GeezleCode

@redagavin Is this resolved for you? Could you comment on https://github.com/NeuralEnsemble/python-neo/issues/1202#issuecomment-1466565212 ?

JuliaSprenger avatar Apr 03 '23 13:04 JuliaSprenger

@JuliaSprenger I have the code which fixes this issue but the test data has not been added as we don't have permission. I can add it without test data if you prefer.

From my look at #1234, I think that will not resolve this issue as this issue has to do with date formatting being version sensitive.

PeterNSteinmetz avatar Apr 03 '23 15:04 PeterNSteinmetz

@PeterNSteinmetz If it's just a small change we could add it anyway. Without test files we can just not guarantee that it will not reoccur at some point in the future...

JuliaSprenger avatar Apr 03 '23 15:04 JuliaSprenger

Pull request 1257 should handle this case now.

PeterNSteinmetz avatar Apr 13 '23 22:04 PeterNSteinmetz