Quantitative Neurobiology

Notes, assignments, and code for NEUROBIO 735 (Spring 2024).

Class details:

1/11 – 4/17:
Tuesday, Thursday
3:00 – 4:30
301 Bryan Research Building

Syllabus

Exercises

Solutions

Book

Homework: DataFrames and Plotting

DataFrames

  1. Let’s use some example data sets from the Seaborn plotting library. You’ll first need to
    import seaborn as sns
    

    to load the library. We can then load some sample fMRI data (the package author is a neuroscientist) by doing

    dat = sns.load_dataset('fmri')
    
  2. What’s the shape of this data frame? What do the first few rows look like? How many unique subjects are there? How many regions?

  3. Make a table that gives the mean and standard deviation of signal for each region for each subject. (Hint: you may have to do some column shuffling and renaming to make this easy on yourself.)

  4. Add a column that estimates the signal-to-noise (SNR) by dividing the mean by the standard deviation and taking the absolute value. Sort the table from highest to lowest SNR.

Plotting

  1. Plot frontal activation for the stim event as a function of time for each subject. You can feel free to use Matplotlib by itself or use Seaborn as well.

  2. Let’s clean up the plot:

    • Rename the x axis “time” and the y axis “BOLD signal”.
    • Title the plot “Frontal stim response”
    • If you don’t already have legend to label individual subjects, add one. It will likely be positioned right over the plot, so use either the loc argument to Matplotlib’s legend function or Seaborn’s move_legend to place it someplace nicer.
    • Add a gray horizontal line at \(y = 0\). Try to place it behind the data traces.