open-ephys-plugins / neuropixels-pxi

Open Ephys GUI plugin for interfacing with PXIe-based Neuropixels hardware
GNU General Public License v3.0
14 stars 20 forks source link

Channel selection broken for (at least) NP 1.0 probes #20

Closed pbotros closed 3 years ago

pbotros commented 3 years ago

Hi, it seems like the latest versions of the neuropixels-pxi does not actually select channels properly for (at least) NP 1.0 probes, despite the OpenEphys GUI indicating that it was successful and no indicative error messages in the console. Methodology:

I hooked the NP up to a signal generator as mentioned in the Neuropixel User Manual for testing signal, dipped the bottom ~1/3 of the probe into PBS, and performed multiple recordings across all possible recording sites. Surprisingly, despite selecting different channels both via IMRO upload and via manual selection in the GUI, all combinations yielded signal reflective of the signal generator (i.e. a ~1.8 kHz sine wave). This reproduced on all tagged GitHub releases from 0.2.0 to the most recent (0.3.1). Critically, I then reverted back to version 0.1.0 and repeated the same test (without touching the probe or experimental setup), and the signal looked as was expected: only about ~1/3 of the channels showed signal from the signal generator, with the rest closer to zero.

I repeated this with a different pair of probe and headstage, and the same problem reproduced on the later versions of this plugin, and was cured with the older 0.1.0 version of the plugin.

If someone else can confirm this independently to make sure I'm not doing anything dumb, that would be great, as otherwise I would imagine this bug would be fairly detrimental to any recordings done in the past ~6 months / might warrant some form of broadcast to participating labs.

Thanks!

jsiegle commented 3 years ago

Which version of the basestation firmware are you using? This is listed on the right side of the probe settings interface, underneath the API version.

pbotros commented 3 years ago

Looks like 1.0.151 .

jsiegle commented 3 years ago

Ok, that makes sense. Version 1.0.X is the only version that would have been compatible with plugin 0.1.0.

First of all, thanks for doing these tests! It sounds like you've carried out all the right steps to verify the problem.

My guess is that the issue could be due to one of two things:

  1. In plugin 0.1.0, we were disconnecting every channel before selecting the active channels (code available here). In 0.2.0+, only the active channels are being selected (code available here). It's possible this function is not able to override channels that are already selected (although this would be undocumented behavior).
  2. There is an uncaught indexing issue that's causing the selectedBank on this line to always default to 0.

@medengineer, can you add some debug output to check (2), and then generate a version of the plugin that re-instates the channel disconnections described in (1)?

pbotros commented 3 years ago

@medengineer any luck with reproducing this bug? We were "lucky" in the sense that we caught this bug only after doing a ~couple weeks of behavior with a test rat, but I can imagine other labs over the past ~6 months might not be so lucky and could inadvertently be using misleading data. We could also use the IMRO save/load function that's present in recent branches, so fixing it upstream would be preferable to having to backport that functionality to 0.1.0.

Thanks!

jsiegle commented 3 years ago

We were able to replicate this with saline tests. It looks like it's only an issue for the 1.0.X firmware, so those using upgraded firmware won't be affected. The problem is most likely due to reason 1 (not disconnecting the channels before selecting a new bank). We will release a corrected version and send out an announcement in the next few days.

pbotros commented 3 years ago

Great, thanks @jsiegle !

jsiegle commented 3 years ago

FYI the latest version of the plugin (0.3.2) has this fix implemented. Let us know if you get a chance to test it out!

pbotros commented 3 years ago

@jsiegle @medengineer 0.3.2 seems to fix the channel selection problem for me on my existing 1.0.X firmware. I also upgraded my basestation firmware to the latest, and confirmed 0.3.2 still works as expected on that firmware. Thanks for the quick fix!

I'll go ahead and close this issue out, but feel free to re-open it if you have follow ups.