Closed KatharineShapcott closed 1 year ago
@pantaray Can I just remove this check or will it break things down the line?
Hi @KatharineShapcott ! Hm, that's an interesting question. As far as I see, removing the check won't break anything obvious, however, this line might be a problem: https://github.com/esi-neuroscience/oephys2nwb/blob/b4880d596fec6790c2aafe483feb9cf9d440782f/oephys2nwb/export2nwb.py#L695 The order of the channels for the NWB file is implicitly inferred from the XML channel ordering. Do you want to change this and use the JSON file as reference instead?
Hmmm I looked into it some more, it seems the information is in the XML file. But you would need to use the information about whether the RecordNode came before or after the ChannelMapping Editor to know which values to take. It seems the JSON file contains the information about where the channels in that recording come from.
I'll do a test later today with a single recording with two record nodes, one before and one after the channel mapping. That should allow us to write something future proof. I suspect the information in the JSON file will be more useful for that.
Here's what the XML information looks like:
<EVENTCHANNEL name="0" number="0"/>
<EDITOR isCollapsed="0" displayName="Channel Map" Type="ChannelMappingEditor">
<SETTING Type="visibleChannels" Value="72"/>
<CHANNEL Number="0" Mapping="16" Reference="-1" Enabled="1"/>
<CHANNEL Number="1" Mapping="20" Reference="-1" Enabled="1"/>
<CHANNEL Number="2" Mapping="19" Reference="-1" Enabled="1"/>
<CHANNEL Number="3" Mapping="24" Reference="-1" Enabled="1"/>
<CHANNEL Number="4" Mapping="21" Reference="-1" Enabled="1"/>
<CHANNEL Number="5" Mapping="26" Reference="-1" Enabled="1"/>
<CHANNEL Number="6" Mapping="29" Reference="-1" Enabled="1"/>
It looks like we can get the information more easily from the JSON file. Otherwise in the XML file we need to use the "pluginIndex" to see whether the channels were mapped or not.
My idea would be instead of making an error to set the channel name and number at this point to be the ones from the JSON file and to print that we're doing this. I'll make a pull request, see what you think.
Seems that this error is overkill, maybe we need to rethink this? With a channel remapping it is expected behaviour that they don't match.
Here's how a channel mapped file looks in our version of the GUI (renamed from .oebin to .txt for upload):
structure.txt