Homework 2

This problem set is due Monday (10/3/2022) at midnight. Please turn in your work by uploading to Canvas. If you have questions, please post them on the course forum, rather than emailing the course staff. This will allow other students with the same question to see the response and any ensuing discussion. The first goal of this problem set is to briefly review how neurons in the brain can be classified. The second goal is to learn and review how to process neural signals related to EEG and LFP.

  1. Neuron types

    Read this paper (pdf) and this related "Neurons Beyond the Textbook" document.

    a. In Section 1 of Neurons Beyond the Textbook, there are instructions for how to view the morphology of individual neurons in the Allen Institute database. Follow the instructions to view “spiny” (excitatory) and “Aspiny” and “sparsely spiny” (inhibitory) neurons. Why do you think excitatory neurons from different species look more similar than excitatory vs inhibitory neurons in one species? What do you think it means about how excitatory neurons function in the brain?

    b. Look at Figures 4 and 5 in the paper. If you had a technique that allowed you to observe activity in large numbers of individual genetically-targeted neurons, and you wanted to generate a transgenic mouse which would let you study excitatory neurons, but you only had a budget for two mice, which two genes would you choose to target and why? What about if you wanted to study inhibitory interneurons?

  2. Origin of EEF/LFP signals during sleep

    Read this review article (pdf) on field potential oscillations during sleep.

    a. Slow oscillations - patterns of UP and DOWN states - are often associated with both thalamocortical and corticothalamic projections. What evidence suggests that the cortex may be critical for their generation? What transient pattern of activity often occurs at the onset of an UP state?

    b. What oscillatory rhthym is most commonly associated with REM sleep? What neuromodulator is associated with this rhythm in a network involving the hippocampus?

    c. We usually think of the sleeping brain as being disconnected from the world. What pattern of activity can be generated by sensory stimulation?

  3. Understanding Fourier Decomposition and Frequency Responses

    Download and run the Filtering notebook. It walks you through calculating the “frequency response” of a moving average smoothing filter, and then asks you to plot the frequency response of two additional filters, an “approximate derivative” and a “smooth moving average”.

    a. Using the previous code in the notebook as a template, calculate and plot the frequency response of the “approximate derivative” and the “smoothing moving average”.

    b. The moving average filter smooths rapid fluctuations in the data. One way of describing this process is that it acts as a “low-pass filter” — it passes low frequency fluctuations but blocks high frequency ones. What about the approximate derivative - what range of frequencies does it favor?

    c. The smooth moving average is a nicer version of the moving average. Why is it “nicer” for smoothing? (Hint - what happens at certain higher frequencies with the original moving average?)

    d. (Filter Latency) When we calculated the moving average, we had to wait to give an output until our there were enough data points to average over — the output of our signal was the average of the current and preceeding N-1 data points. If there is a sudden pulse in the data, this will mean that we don’t see the peak of the pulse until it’s filled up our window. Ideally, we’d probably like to have our moving average _centered_ on the current sample. This means that the latency of a filtering operation is equal to half the length of the filter. The filtfilt() function creates a zero-latency operation by filtering the data first normally, then backward in time. The second operation introduces _negative_ latency that compensates for the first. This is shown at the end of the example notebook. Questions: Why do you think the normal (forward) filtering operation is called “causal”? (Hint: Does the smoothed pulse start at the same time as the one in the raw data?) The output of filtfilt has a smaller output than that of the original filter. Why is this? (Hint: What is the frequency response of the original filter? What would the response be if you filtered twice?)

  4. Power spectral density of alpha rhythms

    The EEG data demoed in class (from this source also described here) is provided to you in the file alpha_data.npy. You can load it by running:

    import numpy as np
    data = np.load('alpha_data.npy')
    

    It consists of an 87520x3 vector (from “subject_12.mat”). The first two columns are the EEG signals from the Fp1 and Oz electrodes and the third column is a marker variable which is normally zero, and has value 2 at the index when the “Open Eyes” instruction was given and value 1 when the “Close Eyes” instruction was given. The sampling rate is 512 Hz!

    a. Use the Welch method to calcuate the power spectral density of the two EEG signals. Which electrode has a more prominent alpha (~10 Hz) rhythm? What about 60 Hz noise?

    b. Plot the spectrogram of the Oz channel.

    c. Find the boundary indices of eyes closed and eyes open periods (5 and 6, respectively). Calculate and plot the average of the power spectral density of the two conditions for the Oz channel. You can use the signal from the Fp1 electrode to correct the indices given in the 3rd column of data.

    d. From the spectrogram, it appears that the alpha oscillations shifts down in frequency with time. Compare the power spectral densities of the initial and final 5 seconds of each eyes closed period. Do you see a difference in the peak frequency? How could you assess whether or not it was significant? Compare with the data from subject 5 alpha_data_05.npy (or subject 7 alpha_data_07.npy). Do you think this is a real effect?