cortex-lab / neuropixels

Information about Neuropixels electrode arrays
81 stars 15 forks source link

Inputs to basestation #5

Open ajuavinett opened 7 years ago

ajuavinett commented 7 years ago

Hey all -- I'd like to make sure I'm understanding the manual correctly. On the sync board, there's a 24 pin sync header with input for 15 signals, as well as an EXT_START pin. Theoretically, you could send in 15 5V logic signals, plus your EXT_Start signal (I'm not entirely clear on how this is different from the other pins). Right?

Further, will SpikeGLX or OpenEphys acquisition systems be able to read these in? How is everyone dealing with external inputs, and syncing recording data with stimuli, tracking, movement, etc.?

Any input would be super appreciated!

nsteinme commented 7 years ago

That's all correct (actually, there are 16 digital inputs, labeled 0-15). I have never used the EXT_START input - you would have to check the spikeglx or openEphys documentation to see whether this can be used for something, I'm not sure.

In spikeglx, the digital inputs are encoded as a 385th channel of the data files (both AP and LFP). Since there are 16 digital inputs and 16 bits per sample in the data file, each sample on this 385th channel represents, in its 16 bits, the state of each of the 16 digital inputs at that time. In the spikes repository, I have shared matlab functions that will extract the data from this channel (/preprocessing/extractSyncChannel) and another that will parse it into timestamps corresponding to the times when each channel turned on or off (/preprocessing/spikeGLXdigitalParse). For open ephys I think the data is already stored as timestamps, but you may have to be careful about an offset between the start of the data file and the time that's taken as time=0 for these timestamps? @ajpeters could answer questions about that, I think.

My strategy is just to have a single digital synchronization signal (generated by an arduino) that flips up and down randomly, and is fed into the Neuropixels basestation as well as into a separate NI-DAQ that can also record all the analog signals I care about. Then, post-hoc, I take the timestamps of the digital events in the Neuropixels datafile, and those of the same events in the ni-daq data, and perform a linear regression between the two, generating an offset (how much time between the start of the neuropixels recording and the start of the ni-daq) as well as a slope (how much the two devices drift relative to each other, which I have found to be up to ~40ms/hour - enough that for many things, you need to care about it). Then I use this to convert timings from the ni-daq into the same timebase as the Neuropixels data. But many other schemes could also work.

On Sat, Aug 26, 2017 at 6:33 PM, Ashley Juavinett notifications@github.com wrote:

Hey all -- I'd like to make sure I'm understanding the manual correctly. On the sync board, there's a 24 pin sync header with input for 15 signals, as well as an EXT_START pin. Theoretically, you could send in 15 5V logic signals. Right?

Further, will SpikeGLX or OpenEphys acquisition systems be able to read these in? How is everyone dealing with external inputs, and syncing recording data with stimuli, tracking, movement, etc.?

Any input would be super appreciated!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cortex-lab/neuropixels/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/AHPUP2Fr3KsSCRoMkKRh3iElqaHxmuwfks5scFbigaJpZM4PDkGu .

ajuavinett commented 7 years ago

Thanks! I'm curious about this openEphys timing thing, if anyone has additional info on that...

Is that a reason you use a NI-DAQ instead of an arduino for recording the analog signals?

(Also, I'm curious, which signals are analog? Because even our rotary encoder outputs a digital signal...)

ajuavinett commented 7 years ago

And final question for clarity, there is no way to read in analog signals into the basestation, right?

petersaj commented 7 years ago

(here's a link to a thread talking about syncing digital inputs via open ephys: https://github.com/cortex-lab/KiloSort/issues/77 - hopefully that answers but let me know if not)

nsteinme commented 7 years ago

Correct, no way to read in analog signals into the neuropix FPGA, so far as I know.

On Wed, Aug 30, 2017 at 9:38 PM, Ashley Juavinett notifications@github.com wrote:

And final question for clarity, there is no way to read in analog signals into the basestation, right?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cortex-lab/neuropixels/issues/5#issuecomment-326111793, or mute the thread https://github.com/notifications/unsubscribe-auth/AHPUP7v9_l11nO6C92eU4-mKWN4PGKAMks5sdcgtgaJpZM4PDkGu .

apfdomanski commented 6 years ago

I thought a fun hack here could be to get a signal into the FPGA as a 16 bit parallel word, using an external ADC to send one bit to each of the 16 digital inputs and reconstruct the data from the bitwise representation. In reality however, I capture simultaneous analogue signals elsewhere and align a common sync pulse post-hoc as Nick suggests!

nsteinme commented 6 years ago

Ha, yes, that would be a clever workaround for the very committed user :)

On Wed, Oct 11, 2017 at 7:27 PM, Aleksander Domanski < notifications@github.com> wrote:

I thought a fun hack here could be to get a signal into the FPGA as a 16 bit parallel word, using an external ADC to send one bit to each of the 16 digital inputs and reconstruct the data from the bitwise representation. In reality however, I capture simultaneous analogue signals elsewhere and align a common sync pulse post-hoc as Nick suggests!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cortex-lab/neuropixels/issues/5#issuecomment-335904074, or mute the thread https://github.com/notifications/unsubscribe-auth/AHPUP3QRDVZ3utz7mVMSn1QQDs_SrT76ks5srQiHgaJpZM4PDkGu .

weallen commented 6 years ago

Has anyone tried implementing a serial protocol with the digital inputs to the nidaq or FPGA? So that you could, for example, encode the ASCII name of the mouse/protocol/session directly in the recording data. I'm trying to figure out how to run multiple protocols right now; the simplest sync solution is just to have a pulse at the start of each protocol and write them down in the order I run them, but seems like there could be a more sophisticated solution...

nsteinme commented 6 years ago

The serial protocol would be really cool! With the synchronization scheme I suggested above, you can figure out which part of the neuropixels recording each other recording corresponded to, I believe, since the pattern of up/down flips will be unique.