Monday, February 8, 2016

Part 2 of Building an Open-source Electrophysiology Rig: Triggers and Signal Flow


Our rig is going to be customized for synchronization of audio stimuli and neural recordings; stimulus design, presentation, and analysis will all be performed in MATLAB. The general design, however, can be modified for visual stimuli and implementation in Python.

In addition to the Intan Components listed in Part 1, we also purchased a Roland Quad Capture external sound card ($250) and used a speaker and big ole sound amplifier that were laying around. The photo below shows the basic set-up that I'm using to prototype the system.



What you need to keep in mind when designing your system is that every digital-to-analog (DAC) and analog-to-digital conversion (ADC) has its own independent jitter and delay. Your goal is to minimize the number of independent conversions so that you can best time-lock the neural signals (i.e. spikes) that you record with the stimulus that was presented.

Working with audio stimuli permits a very useful hack, based on the fact that most sound cards are designed for stereo output. This allows us to design two channels that will both undergo the same D/A conversion; one channel for the audio stimulus and one for your triggers.

Borrowing from the principle of TTLs, triggers can be used to temporally align your audio stimulus with the recorded neural activity. When you design your stimulus (in MATLAB or some other software), you also design a separate channel with the same time discretization; this second channel will contain square steps that can either be spaced at regular time intervals or  indicate the onset and offset of short stimulus trials.


15 seconds of a stimulus (blue) and corresponding triggers (black). While plotted on the same axes, these signals are saved on two different channels.
End of Trial Trigger
Onset of Trial Trigger














These triggers, along with a copy of the stimulus, will be recorded by the Intan board through the ADC port. This allows for a more accurate alignment of your recorded neural activity with the stimulus. It's important to ensure that your different triggers are distinct from each other, so that you can distinguish between them in your analysis script. I made mine distinct in both the duration of the pulses and the number of repetitions.

If you are using the free Intan GUI software, you can trigger the onset of your recordings via a digital or analog input. I designed my stimuli to have a distinct recording onset trigger 1.5 seconds before the first trial. Below is a screenshot of the Intan GUI and the pop-up window where you tell the software what input to trigger off of. You can save your entire configuration for the Intan software so that you don't have to change these settings each experiment.




In part 3, I'm going to go over my stimulus design, presentation, and analysis code, and talk about interfacing MATLAB's dsp toolbox with your sound card.











No comments:

Post a Comment