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

Support for Neuronexus (.XDAT) files

Open dana-o opened this issue 2 years ago • 16 comments

Hi. I am new to analyzing ephys data, and our lab currently uses allego neuronexus files (.xdat). In wanting to use spike interface, we reached out to see if there was support on their end for .xdat files.

I wanted to reach out to see if there was developed support for those files or if it could be done.

According to spikeinterface people, when they reached out to Neuronexus they did not seem interested in collaboration. I know that there are features that allow one to include their own file format. If that could be done by me, I can try; however, if the spikeinterface developers are unable to support .xdat file, I definitely don't think I will be able to make that happen.

dana-o avatar Jun 14 '23 20:06 dana-o

Hi spikeinterface people and neo people overlap a bit :)

Do you have file specification ? And a very small data file to have a look at ?

samuelgarcia avatar Jun 15 '23 06:06 samuelgarcia

Specification looks like *_data.xdat is float32 and *_timestamp.xdat is int64 plus there's a .json metadata file. Seems like the last 6 chans are reserved for aux, digital ins, outs. We could provide a sample file once the system is up. Attached code is from: https://www.neuronexus.com/radiens-allego-download-page/ allego_file_reader.py.txt allegoXDatFileReaderR2019b.m.txt

smenp avatar Jan 25 '24 19:01 smenp

More specifically to read the .xdat they are just doing read binary

with open(Path(fname_timestamps), 'rb') as fid:
            fid.seek(tstamp_offset * 8, os.SEEK_SET)  
            timestamps = np.fromfile(fid, dtype=np.int64, count=num_samples)

And the license is pretty open

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software file and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

I think the API is for using their own software for analysis and curation. Maybe this has been a recent change?

I'm happy to play around with this, but I would need some data first (unless @samuelgarcia has a burning desire to work on this).

zm711 avatar Jan 29 '24 22:01 zm711

@smenp, any sample files for us to work on?

zm711 avatar Feb 23 '24 22:02 zm711

@dana-o , @smenp

Just wanted to bump this again. Anything we can test against?

zm711 avatar Jun 28 '24 17:06 zm711

Sorry, we never got usable data and returned the system. At FENS now but can upload some not so nice data next week, or wait (month++?) for our replacement. .xdat is just flat float32 (chans, samples) + a metadata .json.

smenp avatar Jun 28 '24 22:06 smenp

We accept junk data. We just like having a file that we can work off of for generating the reader.

zm711 avatar Jun 28 '24 22:06 zm711

Enjoy FENS.

zm711 avatar Jun 28 '24 22:06 zm711

Here's a sample XDAT recording (2 probes with 64 channels each): xdat-sample1-20240701.zip

I had started working on XDAT support for Neo myself, but I didn't get very far. I couldn't figure out how certain NeuroNexus/XDAT concepts should be mapped to the Neo object model. And now I don't have much time to work on it.

dhmjhu avatar Jul 01 '24 22:07 dhmjhu

Thanks. We will work on this soon!

zm711 avatar Jul 08 '24 12:07 zm711

@dhmjhu could you zip the folder instead. I don't have capabilities to interact .7z.

zm711 avatar Jul 10 '24 14:07 zm711

@zm711

No problem. xdat-sample1-20240701.zip

dhmjhu avatar Jul 10 '24 14:07 dhmjhu

Thanks :)

zm711 avatar Jul 10 '24 17:07 zm711

Hey @dhmjhu,

Two quick questions:

First are you okay with me uploading this data to our testing suite so we can run our tests against it (if so what attribution do you want to use--ie do you want your name/github handle associated with the data?) Second, do you want to test my draft PR to see if this fits with how you think the data should be? It's mostly working so the next phase for me is to get this onto our testing suite and then clean up the code.

If you're willing to check it out you'll need to install from this PR: #1509.

zm711 avatar Jul 19 '24 19:07 zm711

@zm711

Yes, that's fine. I guess something like "dhmjhu (Lee Lab)" would work.

I would like to test it but don't have time at the moment. I may be able to get to it next week.

Is this the repo you're talking about? GIN looks very interesting!

dhmjhu avatar Jul 22 '24 16:07 dhmjhu

Perfect thanks @dhmjhu!

Yes that's the repo where we keep small test files to run through the CI. You're more than welcome to set up an account if using those test files helps with any of your work. I'll upload the files you shared with me and then our CI tests should pass on the PR.

No rush to test. Sometimes we start back-engineering on one dataset and then a user lets us know that something that we thought was hardcoded is not. So it can be beneficial to have it pass CI and the "real-user" test. But no rush :) Thanks for all your help so far!

zm711 avatar Jul 22 '24 16:07 zm711