Repository navigation
Proposal for new neo.rawio API. - #355
Conversation
…into raw_io_api # Conflicts: # neo/io/axonio.py # neo/test/iotest/test_axonio.py
|
neo 0.5.2 have been release to gather many PR and bug fixes. The place for improvement will be directly in the master so. Any remark before this ? |
|
I tested the new BlackRockIO and compared the output to the old implementation, based on how @JuliaSprenger tested the NeuraLynxIO. I used the test files that are used for the UnitTests. The following is a list of the differences I found, sorted by objects. The points marked by "!" are the ones I think are most important.
Some of those differences are quite similar to what @JuliaSprenger reported for the NeuraLynxIO. |
|
Thank you for feed back. The short answer is that the behavior of the old BlackrockIO will not be exactly similar that the new one. So choices we made specifically to the IO. In the new branch the same behavior should work for all IOs.
This can be done at rawio API. For io API it is easy to add channel_indexes key. channel_ids is more ambiguous for some cases.
You can do
At the moment reading raw data is only available at raw level but since the class is made by compisition. You can do
Oups, this is a bug in BaseFromRaw.
At the io level, yes, but you can get timestamp (original format) at the rawio level with
Oups. I will fix.
This is due to
OK. I was not aware of that. We can clip the channel exploration to 128. Is it the case for all blackrock system ?
I will add this.
I don't get this. X is the channel_index (0 based) can't be sparse. Y is the channel_id (1 base in the case of Blackrock) can be sparse. What is the expected descr ?
I need to check.
This cannot be done here at the moment because the BaseFromRaw is generic.
I need to check.
This behavior can be fixed with
This is something general at rawio level. All channel have an id.
I need to check. Is it a problem ?
This is my choice. I thin this more explicit to have both channel and unit id. No ?
Same answer.
I can add this but not in name or id. Maybe another key ?
Yes but with other key.
Yes they are! I will fix most of theses soon when it is easy. Then I propose to merge this branch in the master. It is now more clear were to put changes : in the RawIO directly when it is specific or in BaseFromRaw when we want a global behavior for all IO. |
|
@samuelgarcia thanks for the quick relpy. We are currently looking into your comments and will come back to you soon. However, before merging this branch, we would like to test the new BlackrockIO not only on a single test data set (as done above) but also confirm that the new IO is working for real datasets containing more data and also recordings using different versions of Blackrock files. This might take a couple of days, but we will keep you informed. |
|
@JuliaSprenger. Yes of course we can wait a before this merge. Merging soon is nevertheless important because any incoming PR could lead to conflict with rawio. I propose:
In any case the release of 0.6.0 will be in a long time. Is it OK for you ? |
This is strange, because the link is already done. Do you have my latest latest raw_io_api branch ?
Could you be more specific ?
unit_id still is unit_id but I have added unit_tag for this = 'unclassified', 'noise' or str(unit_id)
name = "ch{}#{}".format(channel_id, unit_id)
_id = "Unit {}".format(1000 * channel_id + unit_id)if you prefer we can swap name<-> _id. I have push a new commit that fix some annotations problems. |
|
@samuelgarcia: I agree to your proposed plan. Keeping both versions of the IO would help a lot. Maybe we can do the same for the NeuralynxIO for some time? |
|
OldNeuralynxIO is now in neo.io.neuralynxio_v1 The __init__ look like this from neo.io.neuralynxio import NeuralynxIO #the new based on rawio
from neo.io.neuralynxio_v1 import NeuralynxIO as OldNeuralynxIO #the old one with all annotations
...
from neo.io.blackrockio import BlackrockIO
from neo.io.blackrockio_v4 import BlackrockIO as OldBlackrockIOIf there is another IO you want to keep in double version teel me. |
|
I worked through your comments and will write a detailed answer to them soon. In addition, I just investigated whether it is possible to load different real Blackrock datasets. I noticed that it seems that some version checks are missing. blackrockrawio.py fails for file version 2.1 in _parse_header at line 244, because 'NEUEVFLT' cannot always be read as a key from the header (i.e., this Block is not existent in version 2.1). In the old IO 'NEUEVFLT' is only referenced in a function that would be run for file versions 2.2 and 2.3, whereas _parse_header in the new IO is called in any case. As a somewhat related issue, could you please explain a bit more in detail how to load only specific channels in your new IO? I don't quite understand what you meant and don't want to crash everything by loading a complete ns5 dataset. |
|
Thank you Björn for this investigation across the code. I have done a fast patch for NEUEVFLT changed NEUEVWAV. Could you test it ? For channel you have several possibilities for selecting (only at rawio level for the moment): reader = BlackrockRawIO(filename='FileSpec2.3001')
reader.parse_hedaer()
#read all signals channels
raw_sigs = reader.get_analogsignal_chunk(channel_indexes=None)
#select by channel_indexes
raw_sigs = reader.get_analogsignal_chunk(channel_indexes=[0, 2, 4])
#select by channel_ids (note tha in Blackrock id is one based and this is specific to blackrock and some other
raw_sigs = reader.get_analogsignal_chunk(channel_ids=[1, 3, 5])
#select by channel_names
raw_sigs = reader.get_analogsignal_chunk(channel_names=['chan1', 'chan3', 'chan5'])The file for testing is 2.3. If you have the small dataset <10Mo for 2.1 and 2.2, we could put them at gnode portal and use them in the test suite. Since the neo.io Blackrock is done by inheritance with BlackrockRawIO Have you seen the doc doc/source/rawio.rst ? I will add in doc the channel selection stuff. |
|
I guess it is time to merge this rawio. |
This PR is for discussion around a new neo.rawio API see issue #354.