Skip to content

chanPerChip is equal to 0 or random number in Trodes 2.8.2 config for Neuropixels 1.0 or 2.0 #1844

@dkassybayeva

Description

@dkassybayeva

When using spikeinterface (version 0.104.3) and neo (version 0.14.4) with recording done in Trodes 2.8.2 I ran into an error at this line in spikegadgetsrawio.py :
if num_ephy_channels % num_chan_per_chip == 0
where error was that I cannot divide by 0
looking into it I saw that in Trodes config file chanPerChip = 0, while in previous Trodes versions this chanPerChip would change from session to session to have values 2 or 6 or 32 (random). The solution previously was to put this in the script of spikegadgetsrawio.py:

# as spikegadgets change we should follow this
        try:
            num_chan_per_chip = int(sconf.attrib["chanPerChip"])
        except KeyError:
            num_chan_per_chip = 32  # default value for Intan chips

However, I don't think Neurpixels 1.0 or 2.0 probes even use Intan chips and there must be a reason why in new Trodes version chanPerChip is consistently 0. num_ephy_channels is taken from 'numChannels' in Trodes configuration file and is 768. Since there are no Intan chips, should the calculation rely on hwChan? As you can see from the code below, code never gets to hwChan because num_chan_per_chip is 0.
```

if num_ephy_channels > 0:
            stream_id = "trodes"
            stream_name = stream_id
            buffer_id = ""
            signal_streams.append((stream_name, stream_id, buffer_id))
            self._mask_channels_bytes[stream_id] = []
        # we can only produce these channels for a subset of spikegadgets setup. If this criteria isn't
        # true then we should just use the raw_channel_ids and let the end user sort everything out
        if num_ephy_channels % num_chan_per_chip == 0:
            all_hw_chans = [int(schan.attrib["hwChan"]) for trode in sconf for schan in trode]
            missing_hw_chans = set(range(num_ephy_channels)) - set(all_hw_chans)
            channel_ids = self._produce_ephys_channel_ids(
                num_ephy_channels_xml, num_chan_per_chip, missing_hw_chans
            )
            raw_channel_ids = False
        else:
            raw_channel_ids = True

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions