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
Support for multiple Sampling rates for Neuralynx Recordings #1038
Comments
@PeterNSteinmetz @JuliaSprenger : any knwoledge on how neuralynx handle multi sample rate ? |
Hi @manimoh! |
Hi @JuliaSprenger! |
Thanks for your willingness to provide test data files. For a one time contribution you can just send me the files via email, including the attribution of the files to be listed in the readme. |
Of course! And thank you along with all the other creators of this wonderful tool! I also emailed the files to you - let me know if you need something else! |
Firstly, a temporary workaround for this is to use either the single file mode and create a separate rawio for each .Ncs file or the multi-file mode and list a group of files all with the same sampling rate. Secondly, remember that in the RawIO model, all AnalogSignals within a RawIO have the same sampling rate (https://neo.readthedocs.io/en/stable/rawio.html). This latter suggests that the way to attack this issue would be to provide a Neo IO, rather than RawIO, which would handle the construction of multiple RawIO objects, grouping the .Ncs files appropriately for different sampling rates. This would likely be most easily handled by adding a static builder method, not a constructor, to the NeuralynxRawIO class, since all of the code to scan files and determine sampling rates is presently in and used by the RawIO. |
This will have to do with the way that SpikeInterface is calling the Neo NeuralynxRawIO class. A workaround will require calling and using that class directly rather than through SpikeInterface. |
I see! But it still makes sense to implement this feature in neo, right? If not, then I can close the issue! |
This feature could be implemented at the Neo IO core level, which is likely the most appropriate. It could also be implemented by SpikeInterface making different calls onto the RawIO classes. Really a question for @samuelgarcia or @JuliaSprenger. I have worked mostly on the NeuralynxRawIO and getting it to work with the different variety of Neuralynx files. If you need something in the shorter term, suggest writing code to manipulate the current versions of the NeuralynxRawIO classes. |
Thanks for the files. I will have a look into extending the IO. |
Hi @JuliaSprenger , thank you for looking into this. Do you have a draft you're working on or a branch for this? We'd be happy to contribute since this is an immediate priority for us. But not having worked on neo before, I assume any work we do independently might just end up being a slower and worse version of yours :) |
For immediate use, I would suggest modifying your code to make calls directly using the RawIO.NeuralynxRawIO class. You can construct as many of these objects as you need to accommodate the differing sampling rate groups of files. |
@manimoh thanks for the report. I'm trying to figure out how all of these pieces will fit together. Can you explain your use-case a little further? Why do you have files with different sampling rates? For instance, are some of them voltage series from electrodes in the brain and some of them something else? |
Hi @bendichter, you are right! We use different sampling rates to collect data from other sensors and feed in directly into the Neuralynx acquisition system, for instance: running speed from a running wheel encoder. |
OK, well in that case I think the best solution would be to sub-select only the neural channels. It doesn't make sense for SpikeInterface to ingest non-neural data. @JuliaSprenger is it possible to sub-select these channels using the current raw neo reader? Could we set up a mechanism to pass this list in from the SpikeInterface call? |
I had opened an issue sometime back for this: #889 |
@bendichter I would say that both the issues have their merit! #889 serves the Spikeinterfaces pipeline better while this issue is good for Neo being more flexible to handle all kinds of Neuralynx acquisitioned data :) |
Another use case for multiple sampling rates is that there are experiments (including ours) which use real time spectral analysis and sometimes that software that does this doesn't play well with the wideband sampling that is needed for Automatic spike sorting. In this case, we physically copy the required signals on the acquisition box to an unused input channel on the box and this copied signal can then be sampled at a rate which is compatible with the online spectral analysis tool. |
In neo we support the "multi stream" for signals. |
Currently the NeuralynxRawIO.py doesn't support sessions where there are continuously sampled files with multiple sampling rates. Is there a plan to add this feature in the next release?
The text was updated successfully, but these errors were encountered: