LabView multichannel analog input
When we need access to several analog input channels, we sometimes acquire this information on a separate National Instruments data acquisition board, such as the National Instruments 6071E. (You may ask why we use a separate card for this purpose: the reason is that the CED micro1401/Spike2 system that we use to acquire stimulus timing information and up to 4 analog inputs cannot be inexpensively expanded to handle 32 or 64 channels at high sampling rates.)
Because we are using 2 acquisition devices (micro1401/Spike2 for stimulus timing information and a few analog inputs, and LabView for several analog inputs), we need to learn the time conversion between these devices. This means we need to identify the time shift between when the 2 devices were started (that is, what time on the LabView system corresponds to time 0 on the Spike 2 system?) as well as the time scaling between the 2 clocks (because the clocks on the 2 devices will advance at slightly different rates, and this difference matters over the course of a several minute recording).
To do this, we typically record the stimulus trigger signal on 1 analog input channel of the National Instruments board (usually channel ai63 -- analog input 63 -- on the 6071E). Because the CED 1401/Spike2 system is also acquiring trigger times from this channel, we can analyze the signals from the National Instruments board to learn the exact mapping in shift and scale.
(Note for developers: The function in our library that does this is: vhlv_sync2spike2.m)
The acquisition software we use is our own custom VHLVDaq, written in LabView.
Output of the acquisition program VHLVDaq: It writes 2 files: vhlvanaloginput.vlh (the header file, in text format and human readable, and readable in Matlab with function readvhlvheaderfile.m), and vhlvanaloginput.vld (binary file, readable in Matlab with readvhldatafile.m).
Note: In the next release, it should also write the files vhlv_filtermap.txt, which describes how the channels should be grouped for filtering (see help vhlv_filtermap in Matlab), and vhlv_channelgrouping.txt, which describes how channels should be grouped for spike extraction and spike sorting (see help vhlv_channelgrouping in Matlab).
Note 2: In the meantime, one has to create these files manually. Follow the example in Step 0 to do this.
How to extract and cluster spikes (spike sorting)
Step 0: Making sure all of the description files are correct
Before starting, please make sure you go through your experiment directory to find all of the directories (t00001, t00002, etc) that contain multichannel data to make sure the reference.txt, vhlv_filtermap.txt, and vhlv_channelgrouping.txt files are specified correctly. For example, if you acquired using 16 channels on 2 head stages, and want each electrode site to represent an individual channel, you should use:
[1 2 3 4 5 6 7 8]
[9 10 11 12 13 14 15 16]
Step 1: Launch the LV Sorting tool
Make sure you have a good RunExperiment window for your experiment, that is set so that it is looking at your experiment directory. Then, on the RunExperiment panel, click the LV Sorting button.
Step 2: Set thresholds and extract spikes
On the LV sorting window, click the Set thresholds / extract spikes button. The directories that contain data are listed in the Directory menu popup, with codes (_, t, or T indicate no thresholds have been set (_), some thresholds have been set (t), or all thresholds have been set (T)). The channels that are grouped together in vhlv_filtermap.txt are listed together in the Channel List. Be sure to view all of the channels. Clicking in the white space in a graph (it has to be clear of the graphed data by a few pixels) will set the threshold for that channel, and the spikes that are detected in the bit of data shown will be displayed. You can turn on Zoom in the tools menu to zoom in on the traces, but you'll need to turn it off to select thresholds. Be sure to visit every directory and set thresholds using the GUI.
After you have set all thresholds for a given directory, you can extract the spikes by clicking Extract. This takes a few minutes to run, especially over the network.
Step 3: Cluster the spikes
After you have extracted spikes, then turn attention to clustering spikes. For each name/reference pair in the list, click Cluster. Upon opening the GUI, the system will attempt to use its default clustering methods to cluster the spikes. It will display the features (colored by cluster number) in the feature window on the lower left, and the individual waveforms on the right. You can choose to re-cluster the spikes, use different features, or to merge or re-order the clusters (by moving a given cluster to position 1 using Move to cluster 1). It is important (and the program requires) that you assign a "quality" label to each cluster. Once you are done clustering you can click Done.
That's it! You're ready to analyze the responses.