allensdk.brain_observatory.ecephys.stimulus_analysis.static_gratings module¶
- class allensdk.brain_observatory.ecephys.stimulus_analysis.static_gratings.StaticGratings(ecephys_session, col_ori='orientation', col_sf='spatial_frequency', col_phase='phase', trial_duration=0.25, **kwargs)[source]¶
Bases:
StimulusAnalysisA class for computing single-unit metrics from the static gratings stimulus of an ecephys session NWB file.
- To use, pass in a EcephysSession object::
session = EcephysSession.from_nwb_path(‘/path/to/my.nwb’) sg_analysis = StaticGratings(session)
- or, alternatively, pass in the file path::
sg_analysis = StaticGratings(‘/path/to/my.nwb’)
You can also pass in a unit filter dictionary which will only select units with certain properties. For example to get only those units which are on probe C and found in the VISp area:
sg_analysis = StaticGratings(session, filter={'location': 'probeC', 'ecephys_structure_acronym': 'VISp'})
- To get a table of the individual unit metrics ranked by unit ID::
metrics_table_df = sg_analysis.metrics()
- property METRICS_COLUMNS¶
- classmethod known_stimulus_keys()[source]¶
Used for discovering the correct stimulus_name key for a given StimulusAnalysis subclass (when stimulus_key is not explicity set). Should return a list of “stimulus_name” strings.
- property metrics¶
Returns a pandas DataFrame of the stimulus response metrics for each unit.
- property name¶
Return the stimulus name.
- property null_condition¶
Stimulus condition ID for null (blank) stimulus
- property number_ori¶
Number of grating orientation conditions
- property number_phase¶
Number of grating phase conditions
- property number_sf¶
Number of grating orientation conditions
- property orivals¶
Array of grating orientation conditions
- property phasevals¶
Array of grating phase conditions
- property sfvals¶
Array of grating spatial frequency conditions
- allensdk.brain_observatory.ecephys.stimulus_analysis.static_gratings.exp_function(x, a, b, c)[source]¶
- allensdk.brain_observatory.ecephys.stimulus_analysis.static_gratings.fit_sf_tuning(sf_tuning_responses, sf_values, pref_sf_index)[source]¶
Performs gaussian or exponential fit on the spatial frequency tuning curve at preferred orientation/phase for a given cell.
- Parameters:
sf_tuning_responses – An array of len N, with each value the (averaged) response of a cell at a given spatial freq. stimulus.
sf_values – An array of len N, with each value the spatial freq. of the stimulus (corresponding to sf_tuning_response).
pref_sf_index – The pre-determined prefered spatial frequency (sf_values index) of the cell.
- Returns:
index for the preferred sf from the curve fit, prefered sf from the curve fit, low cutoff sf from the curve fit, high cutoff sf from the curve fit
- allensdk.brain_observatory.ecephys.stimulus_analysis.static_gratings.gauss_function(x, a, x0, sigma)[source]¶
- allensdk.brain_observatory.ecephys.stimulus_analysis.static_gratings.get_sfdi(sf_tuning_responses, mean_sweeps_trials, bias=5)[source]¶
Computes spatial frequency discrimination index for cell
- Parameters:
sf_tuning_responses – sf_tuning_responses: An array of len N, with each value the (averaged) response of a cell at a given spatial freq. stimulus.
mean_sweeps_trials – The set of events (spikes) across all trials of varying
bias
- Returns:
The sfdi value (float)