Note
Click here to download the full example code
Fit V1 cell
Learning objectives
- Learn how to combine GLM with other modeling approach.
- Review previous tutorials.
import jax
import math
import os
import matplotlib.pyplot as plt
import nemos as nmo
import numpy as np
import pynapple as nap
import requests
import tqdm
import workshop_utils
# required for second order methods (BFGS, Newton-CG)
jax.config.update("jax_enable_x64", True)
# configure plots some
plt.style.use(workshop_utils.STYLE_FILE)
Data Streaming
path = workshop_utils.data.download_data("m691l1.nwb", "https://osf.io/xesdm/download",
'../data')
Pynapple
data = nap.load_file(path)
print(data)
epochs = data["epochs"]
spikes = data["units"]
stimulus = data["whitenoise"]
- stimulus is white noise shown at 40 Hz
- white noise is a good stimulus for mapping basic stimulus properties of V1 simple cells
fig, ax = plt.subplots(1, 1, figsize=(12,4))
ax.imshow(stimulus[0], cmap='Greys_r')
stimulus.shape
print(spikes)
spikes = spikes[[34]]
- goal is to predict the neuron's response to this white noise stimuli
- several ways we could do this, what do you think?
Spike-triggered average
- compute spike-triggered average to visualize receptive field.
- visualize spike-triggered average and decide on our spatial filter.
- use the spike-triggered average to preprocess our visual input.
Preparing data for nemos
- get
counts
andfiltered_stimulus
into proper shape for nemos
- Set up the basis and prepare the temporal predictor for the GLM.
Fitting the GLM
- Fit the GLM
- Examine the resulting temporal filter
Further exercises
Total running time of the script: ( 0 minutes 0.000 seconds)
Download Python source code: 04_v1_cells_users.py