+ All Categories
Home > Documents > reed.cs.depaul.edureed.cs.depaul.edu/peterh/class/neu256/weeks/wk4/lab4…  · Web...

reed.cs.depaul.edureed.cs.depaul.edu/peterh/class/neu256/weeks/wk4/lab4…  · Web...

Date post: 05-Jul-2018
Category:
Upload: domien
View: 212 times
Download: 0 times
Share this document with a friend
8
Lab 4: Constructing a plot of firing rate versus time by Christian G. Fink In this lab, you will begin by using a SpikerBox to record the activity of a neuron in a cockroach's leg. The activity will look something like this: You will then import these data into Matlab, where you will write an analysis routine which takes the voltage trace, extracts the spike times, and plots firing rate as function of time. The output corresponding to the above voltage trace looks like this:
Transcript
Page 1: reed.cs.depaul.edureed.cs.depaul.edu/peterh/class/neu256/weeks/wk4/lab4…  · Web view2016-02-11 · You will then import these data into Matlab, where you will write an analysis

Lab 4: Constructing a plot of firing rate versus time

by Christian G. Fink

In this lab, you will begin by using a SpikerBox to record the activity of a neuron in a cockroach's leg. The activity will look something like this:

You will then import these data into Matlab, where you will write an analysis routine which takes the voltage trace, extracts the spike times, and plots firing rate as function of time. The output corresponding to the above voltage trace looks like this:

Page 2: reed.cs.depaul.edureed.cs.depaul.edu/peterh/class/neu256/weeks/wk4/lab4…  · Web view2016-02-11 · You will then import these data into Matlab, where you will write an analysis

Recording Neuronal Activity from a Cockroach Leg

Follow the procedure modeled at the beginning of the lab to record spiking activity from a neuron in the cockroach leg using a SpikerBox. If you run into problems, you may consult the document "Lab 4 Experimental Procedure," as well as the instructional video located at http://wiki.backyardbrains.com/Experiment%3A_Spikes .

Once you have succeeded in obtaining a voltage trace of neuronal activity, observe how the neuronal spiking responds when you stimulate the cockroach leg barbs with a toothpick. This is the data you will process to obtain firing rate as a function of time. Save a copy of the data file in the folder in which you will write the Matlab script to perform this analysis. (You may simply email the file to yourself.)

Writing a Script to Analyze the Data

Download the file rate_vs_time_incomplete.m. This file provides the backbone of a routine to analyze your recorded neuronal activity. Your task is to fill in any spaces marked ??? with appropriate code. This file is segmented into three different sections. You should use the 'Evaluate cell' button in the upper-left corner of your m-file window to evaluate each section as you complete it.

Section 1: Reading and Plotting the Data

First, you will need to load your data into Matlab. Look up the documentation on the function audioread, and use this function to complete the line [voltage, srate]= ???

To plot the neuronal voltage as a function of time, simply typing plot(voltage) will not work, because it will produce a plot like this:

Notice how the x-axis does not display time--in fact, it shows the index associated with each element of the vector voltage. In order to display the correct time values on the x-axis, you need to create a separate vector which contains the time values (measured in seconds) which correspond to each element of the vector voltage. For example, if the data were sampled at

Page 3: reed.cs.depaul.edureed.cs.depaul.edu/peterh/class/neu256/weeks/wk4/lab4…  · Web view2016-02-11 · You will then import these data into Matlab, where you will write an analysis

44,100 Hz, then the 44,100th element of voltage would correspond to a time of 1 second. Use this fact to fill in the line time = ???, then execute the first section of code to check that it works as it should. Your plot should look similar to the plot of voltage versus time shown in the "Overview" to this lab. Paste the plot below.

_________________________Paste figure here_________________________

Section 2: Converting the Waveform into a Series of 0's and 1's

The next step is to convert the signal into a series of 0's and 1's, where the 1's represent spikes. This will make it very easy to calculate the total number of spikes within a given time interval in Step 3. It is fairly simple to identify neuronal spikes just by looking at the voltage trace, since spike amplitudes are so much larger than the surrounding noise. This makes it possible identify spikes whenever the voltage breaches a pre-defined threshold. Look at your data and determine a reasonable threshold, and input this value in the line threshold= ???. For example, in the data displayed previously a threshold of 3e4 would be appropriate (though this is somewhat arbitrary).

Next is the line spikes=voltage. Ultimately, spikes will be a vector that contains just 0's and 1's, but we must first start with the actual voltage trace, then perform a series of operations which simplify it to 0's and 1's. The first step is to set all values which are less than the threshold equal to 0. Do this in the line spikes( ??? )=0.

If you plot spikes versus time, it should look something like this:

Page 4: reed.cs.depaul.edureed.cs.depaul.edu/peterh/class/neu256/weeks/wk4/lab4…  · Web view2016-02-11 · You will then import these data into Matlab, where you will write an analysis

Paste your plot below.

_________________________Paste figure here_________________________

So far, you have thrown away all the noise in the voltage trace, keeping only the "tips" of the spikes. You must now convert each "spike tip" into a "1," as depicted here:

One intuitive way to achieve this is to use a method similar to the thresholding method you applied before, taking only the values greater than threshold. There is a problem with this approach, however: it would result in spikes being converted into multiple 1's, rather than a single 1 (compare the plots above and below), which will pose problems for calculating the number of spikes in a given time interval (as you will see).

Page 5: reed.cs.depaul.edureed.cs.depaul.edu/peterh/class/neu256/weeks/wk4/lab4…  · Web view2016-02-11 · You will then import these data into Matlab, where you will write an analysis

A clever solution to this problem involves taking the discrete derivative of the function using the Matlab command diff. The commands

spikes=diff(spikes); spikes=[spikes; 0];

ensure that for every spike, there is only one time-point that is greater than threshold.

Question 1) How does using the diff command ensure that each spike is converted into a single 1, rather than into multiple 1's? (Hint: It might help to make a plot of 'spikes' versus 'time' right after the commands spikes=diff(spikes);spikes=[spikes; 0]).

_________________________Paste answer here_________________________

You may now finish section 2 by setting every entry less than threshold equal to 0, and every entry greater than or equal to threshold equal to 1. The plot from Section 2 should look something like this, with each "1" corresponding to a spike in the original voltage trace:

Page 6: reed.cs.depaul.edureed.cs.depaul.edu/peterh/class/neu256/weeks/wk4/lab4…  · Web view2016-02-11 · You will then import these data into Matlab, where you will write an analysis

Paste your plot below.

_________________________Paste figure here_________________________

Section 3: Plotting firing rate versus time

Now for the fun part: actually plotting the firing rate versus time. The code for this is already written, but your job is to understand and explain it. The code takes the vector spikes and uses it to produce the plot of firing rate versus time. Examine the code and use the specified plots to answer the following questions:

Question 2) Fix t_slide=0.1, and run the program two different times, first with t_window=1.0 and and again with t_window=0.2. Paste the two plots side by side below, and answer the following questions: What happens to the maximum firing rate as t_window increases? Why?

_________________________Paste answer here_________________________

Question 3) Fix t_window=1.0, and run the program two different times, first with t_slide=1.0 and again with t_slide=0.1. Paste the two plots side by side below, and answer the following questions: How does decreasing t_slide affect the number of individual points that are plotted? Why? Summarize the function of t_window and of t_slide.

_________________________Paste answer here_________________________

Question 4) Suppose you read a research paper where the authors use a moving window technique to plot firing rate versus time, and they find that a neuron in a particular region of the

Page 7: reed.cs.depaul.edureed.cs.depaul.edu/peterh/class/neu256/weeks/wk4/lab4…  · Web view2016-02-11 · You will then import these data into Matlab, where you will write an analysis

brain shows a higher firing rate than has ever been seen before. Should you automatically trust this claim? Why or why not?_________________________Paste answer here_________________________

Submit this Word document, your data file, and your final m-file to Blackboard.


Recommended