# Receptive Field Analysis¶

This notebook demonstrates how to run the brain_observatory.receptive_field_analysis module. This module uses a cell's responses to the locally sparse noise stimulus to characterize the spatial receptive field, including on and off subunits. We highly recommend reading through the the stimulus analysis whitepaper to understand the locally sparse noise stimulus and the analysis methodology.

First we import packages.

Given a cell of interest, we now identify the experiment that contains the locally sparse noise stimulus and download its NWB file. We also look in the NWB file to figure out the position/index of the cell that has the ID we're interested in.

## Compute receptive fields¶

The following method in the receptive_field_analysis module will characterize on and off receptive fields and perform a per-pixel significance test.

## Chi^2 significance map¶

Per-pixel chi-square tests identify cells that show non-uniform distributions of responses across pixels. The receptive_field_analysis.visualization module has function to plot that significance as a heat map.

## Response-triggered stimulus field¶

The response-triggered stimulus field shows, for a given pixel, how many trials contained a detected calcium event.

## Blurred response-triggered stimulus field¶

The RTS field is convolved with a Gaussian to pool the contributions of neighboring stimulus pixels.

## p value field¶

Per-pixel p-values are estimated from the blurred RTS field to understand the significance of the response to each pixel.

The significance mask is p-value field after applying a binary threshold to remove insignificant pixels.

## Gaussian fit¶

Each identified subunit of the on and off receptive fields are fit with a Gaussian in the receptive_field_analysis.postprocessing module.

## 4.65 vs 9.3 degree sparse noise stimuli¶

Newer experiments switched from using a single locally sparse noise stimulus with 4.54 visual-degree pixels to two blocks of stimuli with different pixel sizes (a 4.65 degree block and an 9.3 degree block that are each half the length of the original 4.65-degree-only stimulus). You can characterize the receptive fields from reponses to each stimulus block separately.

This cell comes from an experiment that has the new 4.65 degree and 9.3 degree stimulus blocks. Let's find the experiment that contains the 9.3 degree stimulus.

Note: the NWB files refer to these stimuli as locally_sparse_noise_4deg and locally_sparse_noise_8deg respectively.

Now we can run the receptive field analysis as before and see what this looks like.