allensdk.ephys.ephys_extractor module¶
-
class
allensdk.ephys.ephys_extractor.
EphysCellFeatureExtractor
(ramps_ext, short_squares_ext, long_squares_ext, subthresh_min_amp=-100)[source]¶ -
SAG_TARGET
= -100.0¶
-
SUBTHRESH_MAX_AMP
= 0¶
-
-
class
allensdk.ephys.ephys_extractor.
EphysSweepFeatureExtractor
(t=None, v=None, i=None, start=None, end=None, filter=10.0, dv_cutoff=20.0, max_interval=0.005, min_height=2.0, min_peak=-30.0, thresh_frac=0.05, baseline_interval=0.1, baseline_detect_thresh=0.3, id=None)[source]¶ Feature calculation for a sweep (voltage and/or current time series).
-
burst_metrics
()[source]¶ Find bursts and return max “burstiness” index (normalized max rate in burst vs out).
Returns: - max_burstiness_index : max “burstiness” index across detected bursts
- num_bursts : number of bursts detected
-
delay_metrics
()[source]¶ Calculates ratio of latency to dominant time constant of rise before spike
Returns: - delay_ratio : ratio of latency to tau (higher means more delay)
- tau : dominant time constant of rise before spike
-
estimate_sag
(peak_width=0.005)[source]¶ Calculate the sag in a hyperpolarizing voltage response.
Parameters: - peak_width : window width to get more robust peak estimate in sec (default 0.005)
Returns: - sag : fraction that membrane potential relaxes back to baseline
-
estimate_time_constant
()[source]¶ Calculate the membrane time constant by fitting the voltage response with a single exponential.
Returns: - tau : membrane time constant in seconds
-
pause_metrics
()[source]¶ Estimate average number of pauses and average fraction of time spent in a pause
Attempts to detect pauses with a variety of conditions and averages results together.
Pauses that are consistently detected contribute more to estimates.
Returns: - avg_n_pauses : average number of pauses detected across conditions
- avg_pause_frac : average fraction of interval (between start and end) spent in a pause
- max_reliability : max fraction of times most reliable pause was detected given weights tested
- n_max_rel_pauses : number of pauses detected with max_reliability
-
process_new_spike_feature
(feature_name, feature_func, affected_by_clipping=False)[source]¶ Add new spike-level feature calculation function
The function should take this sweep extractor as its argument. Its results can be accessed by calling the method spike_feature(<feature_name>).
-
process_new_sweep_feature
(feature_name, feature_func)[source]¶ Add new sweep-level feature calculation function
The function should take this sweep extractor as its argument. Its results can be accessed by calling the method sweep_feature(<feature_name>).
-
spike_feature
(key, include_clipped=False, force_exclude_clipped=False)[source]¶ Get specified feature for every spike.
Parameters: - key : feature name
- include_clipped: return values for every identified spike, even when clipping means they will be incorrect/undefined
Returns: - spike_feature_values : ndarray of features for each spike
-
sweep_feature
(key, allow_missing=False)[source]¶ Get sweep-level feature (key).
Parameters: - key : name of sweep-level feature
- allow_missing : return np.nan if key is missing for sweep (default False)
Returns: - sweep_feature : sweep-level feature value
-
voltage_deflection
(deflect_type=None)[source]¶ Measure deflection (min or max, between start and end if specified).
Parameters: - deflect_type : measure minimal (‘min’) or maximal (‘max’) voltage deflection
If not specified, it will check to see if the current (i) is positive or negative between start and end, then choose ‘max’ or ‘min’, respectively If the current is not defined, it will default to ‘min’.
Returns: - deflect_v : peak
- deflect_index : index of peak deflection
-
-
class
allensdk.ephys.ephys_extractor.
EphysSweepSetFeatureExtractor
(t_set=None, v_set=None, i_set=None, start=None, end=None, filter=10.0, dv_cutoff=20.0, max_interval=0.005, min_height=2.0, min_peak=-30.0, thresh_frac=0.05, baseline_interval=0.1, baseline_detect_thresh=0.3, id_set=None)[source]¶ -
classmethod
from_sweeps
(sweep_list)[source]¶ Initialize EphysSweepSetFeatureExtractor object with a list of pre-existing sweep feature extractor objects.
-
spike_feature_averages
(key)[source]¶ Get nparray of average spike-level feature (key) for all sweeps
-
classmethod
-
allensdk.ephys.ephys_extractor.
cell_extractor_for_nwb
(dataset, ramps, short_squares, long_squares, subthresh_min_amp=-100)[source]¶ Initialize EphysCellFeatureExtractor object from NWB data set
Parameters: - dataset : NwbDataSet
- ramps : list of sweep numbers of ramp sweeps
- short_squares : list of sweep numbers of short square sweeps
- long_squares : list of sweep numbers of long square sweeps
-
allensdk.ephys.ephys_extractor.
extractor_for_nwb_sweeps
(dataset, sweep_numbers, fixed_start=None, fixed_end=None, dv_cutoff=20.0, thresh_frac=0.05)[source]¶
-
allensdk.ephys.ephys_extractor.
fit_fi_slope
(ext)[source]¶ Fit the rate and stimulus amplitude to a line and return the slope of the fit.
-
allensdk.ephys.ephys_extractor.
input_resistance
(ext)[source]¶ Estimate input resistance in MOhms, assuming all sweeps in passed extractor are hyperpolarizing responses.