brainbox.task.passive
Functions dealing with passive task
Functions
Prepares passive receptive field mapping into format for analysis |
|
Compute receptive field map for each stimulus onset binned across depth |
|
Perform SVD on the spatiotemporal rf_map and return the first spatial components |
- get_on_off_times_and_positions(rf_map)[source]
Prepares passive receptive field mapping into format for analysis
- Parameters:
rf_map (output from brainbox.io.one.load_passive_rfmap)
- Returns:
rf_map_times (time of each receptive field map frame np.array(len(stim_frames))
rf_map_pos (unique position of each pixel on screen np.array(len(x_pos), len(y_pos)))
rf_stim_frames (for each pixel on screen stores array of stimulus frames where stim onset)
occurred. For both white squares ‘on’ and black squares ‘off’
- get_rf_map_over_depth(rf_map_times, rf_map_pos, rf_stim_frames, spike_times, spike_depths, t_bin=0.01, d_bin=80, pre_stim=0.05, post_stim=1.5, y_lim=[0, 3840], x_lim=None)[source]
Compute receptive field map for each stimulus onset binned across depth
- Parameters:
rf_map_times
rf_map_pos
rf_stim_frames
spike_times (array of spike times)
spike_depths (array of spike depths along probe)
t_bin (bin size along time dimension)
d_bin (bin size along depth dimension)
pre_stim (time period before rf map stim onset to epoch around)
post_stim (time period after rf map onset to epoch around)
y_lim (values to limit to in depth direction)
x_lim (values to limit in time direction)
- Returns:
rfmap (receptive field map for ‘on’ ‘off’ stimuli.)
Each rfmap has shape (depths, x_pos, y_pos, epoch_window)
depths (depths between which receptive field map has been computed)
- get_svd_map(rf_map)[source]
Perform SVD on the spatiotemporal rf_map and return the first spatial components
- Parameters:
rf_map
- Returns:
rf_svd (First spatial component of rf map for ‘on’ ‘off’ stimuli.)
Each dict has shape (depths, x_pos, y_pos)
- get_stim_aligned_activity(stim_events, spike_times, spike_depths, z_score_flag=True, d_bin=20, t_bin=0.01, pre_stim=0.4, post_stim=1, base_stim=1, y_lim=[0, 3840], x_lim=None)[source]
- Parameters:
stim_events (dict of different stim events. Each key contains time of stimulus onset)
spike_times (array of spike times)
spike_depths (array of spike depths along probe)
z_score_flag (whether to return values as z_score of firing rate)
T_BIN (bin size along time dimension)
D_BIN (bin size along depth dimension)
pre_stim (time period before rf map stim onset to epoch around)
post_stim (time period after rf map onset to epoch around)
base_stim (time period before rf map stim to use as baseline for z_score correction)
y_lim (values to limit to in depth direction)
x_lim (values to limit in time direction)
- Returns:
stim_activity (stimulus aligned activity for each stimulus type, returned as z_score of firing)
rate