-
Notifications
You must be signed in to change notification settings - Fork 0
Neuropixels raster viewer
Download this code here: https://github.com/petersaj/AP_scripts_cortexlab/blob/master/plotting_and_utilities/AP_cellraster.m
This is a raster viewer for Neuropixels data. It assumes certain variable names for Neuropixels data in the workspace, and takes alignment times and groups as inputs.
Usage
Assumes these variables exist in the workspace: *templates (output from kilosort) *channel_positions (output from kilosort) *template_depths (calculated from center-of-mass or otherwise) *spike_times_timeline (spike_times aligned to timeline) *spike_templates (output from kilosort) *template_amplitudes (output from kilosort)
Takes these input variables:
- align_times: alignment times for rasters (e.g. stimulus onsets), can be cell array of multiple types of alignment (e.g. {stimulus onsets, movement onsets})
- align_groups: groups for each alignment (e.g. stimulus type), can be cell array of group for each alignment (e.g. {stimulus type, movement direction})
- unit_sort: the order of units to go through when using up/down keys (default = depth)
Command:
AP_cellraster(align_times,align_groups,unit_sort)
GUI
The GUI displays each unit by depth (dots on left), the waveforms, the PSTH, the raster, plot, and the template amplitude over time (to see if the cell was affected by drift or was active only at certain times in the recording).
Controls and examples:
-
up/down arrow keys, or click on dot on the left-hand plot: pick unit to view
-
pgup/pgdown or spacebar: switch between ungrouped (raster by time) or grouped (raster by time x condition) (e.g. shows unit grouped by stimulus type, this unit only responds to the red condition)
-
left/right arrow keys: switch between alignments (e.g. changes alignment of this unit from stimulus to reward and sorts by rewarded/unrewarded, in addition to increasing activity aligned to stimulus this unit also decreases activity after reward)
-
m: choose boundaries on probe, sum all spikes, display multiunit (e.g. the cells on this segment of the probe are aligned well to movement onset). This is also compatible with grouping using pgup/pgdown/spacebar (e.g. this multiunit segment responds more to the blue direction than the red direction)