allensdk.brain_observatory.stimulus_analysis module

class allensdk.brain_observatory.stimulus_analysis.StimulusAnalysis(data_set)[source]

Bases: object

Base class for all response analysis code. Subclasses are responsible for computing metrics and traces relevant to a particular stimulus. The base class contains methods for organizing sweep responses row of a stimulus stable (get_sweep_response). Subclasses implement the get_response method, computes the mean sweep response to all sweeps for a each stimulus condition.

Parameters:
data_set: BrainObservatoryNwbDataSet instance
speed_tuning: boolean, deprecated

Whether or not to compute speed tuning histograms

acquisition_rate
binned_cells_sp
binned_cells_vis
binned_dx_sp
binned_dx_vis
cell_id
celltraces
dfftraces
dxcm
dxtime
get_fluorescence()[source]
get_peak()[source]

Implemented by subclasses.

get_response()[source]

Implemented by subclasses.

get_speed_tuning(binsize)[source]

Calculates speed tuning, spontaneous versus visually driven. The return is a 5-tuple of speed and dF/F histograms.

binned_dx_sp: (bins,2) np.ndarray of running speeds binned during spontaneous activity stimulus. The first bin contains all speeds below 1 cm/s. Dimension 0 is mean running speed in the bin. Dimension 1 is the standard error of the mean.

binned_cells_sp: (bins,2) np.ndarray of fluorescence during spontaneous activity stimulus. First bin contains all data for speeds below 1 cm/s. Dimension 0 is mean fluorescence in the bin. Dimension 1 is the standard error of the mean.

binned_dx_vis: (bins,2) np.ndarray of running speeds outside of spontaneous activity stimulus. The first bin contains all speeds below 1 cm/s. Dimension 0 is mean running speed in the bin. Dimension 1 is the standard error of the mean.

binned_cells_vis: np.ndarray of fluorescence outside of spontaneous activity stimulu. First bin contains all data for speeds below 1 cm/s. Dimension 0 is mean fluorescence in the bin. Dimension 1 is the standard error of the mean.

peak_run: pd.DataFrame of speed-related properties of a cell.

Returns:
tuple: binned_dx_sp, binned_cells_sp, binned_dx_vis, binned_cells_vis, peak_run
get_sweep_response()[source]

Calculates the response to each sweep in the stimulus table for each cell and the mean response. The return is a 3-tuple of:

  • sweep_response: pd.DataFrame of response dF/F traces organized by cell (column) and sweep (row)
  • mean_sweep_response: mean values of the traces returned in sweep_response
  • pval: p value from 1-way ANOVA comparing response during sweep to response prior to sweep
Returns:
3-tuple: sweep_response, mean_sweep_response, pval
mean_sweep_response
numbercells
peak
peak_run
plot_representational_similarity(repsim, stimulus=False)[source]
plot_running_speed_histogram(xlim=None, nbins=None)[source]
plot_speed_tuning(cell_specimen_id=None, cell_index=None, evoked_color='#b30000', spontaneous_color='#0000b3')[source]
populate_stimulus_table()[source]

Implemented by subclasses.

pval
response
roi_id
row_from_cell_id(csid=None, idx=None)[source]
stim_table
sweep_response
timestamps