EfelFeatures

An extensive set of features for single neuron voltage traces is found in the Electrophys Feature Extraction Library (eFEL). Uncertainpy has all features in the eFEL library contained in the EfelFeatures class. As with SpikingFeatures, many of the eFEL features require the start time and end time of the stimulus, which must be returned as info["stimulus_start"] and info["stimulus_start"] in the model function. eFEL currently contains 153 different features, we briefly list them here, but refer to the eFEL documentation for the definitions of each feature.

AHP1_depth_from_peak AHP2_depth_from_peak AHP_depth
AHP_depth_abs AHP_depth_abs_slow AHP_depth_diff
AHP_depth_from_peak AHP_slow_time AHP_time_from_peak
AP1_amp AP1_begin_voltage AP1_begin_width
AP1_peak AP1_width AP2_AP1_begin_width_diff
AP2_AP1_diff AP2_AP1_peak_diff AP2_amp
AP2_begin_voltage AP2_begin_width AP2_peak
AP2_width AP_amplitude AP_amplitude_change
AP_amplitude_diff AP_amplitude_from_voltagebase AP_begin_indices
AP_begin_time AP_begin_voltage AP_begin_width
AP_duration AP_duration_change AP_duration_half_width
AP_duration_half_width_change AP_end_indices AP_fall_indices
AP_fall_rate AP_fall_rate_change AP_fall_time
AP_height AP_phaseslope AP_phaseslope_AIS
AP_rise_indices AP_rise_rate AP_rise_rate_change
AP_rise_time AP_width APlast_amp
BAC_maximum_voltage BAC_width BPAPAmplitudeLoc1
BPAPAmplitudeLoc2 BPAPHeightLoc1 BPAPHeightLoc2
BPAPatt2 BPAPatt3 E10
E11 E12 E13
E14 E15 E16
E17 E18 E19
E2 E20 E21
E22 E23 E24
E25 E26 E27
E3 E39 E39_cod
E4 E40 E5
E6 E7 E8
E9 ISI_CV ISI_log_slope
ISI_log_slope_skip ISI_semilog_slope ISI_values
Spikecount Spikecount_stimint adaptation_index
adaptation_index2 all_ISI_values amp_drop_first_last
amp_drop_first_second amp_drop_second_last burst_ISI_indices
burst_mean_freq burst_number check_AISInitiation
decay_time_constant_after_stim depolarized_base doublet_ISI
fast_AHP fast_AHP_change interburst_voltage
inv_fifth_ISI inv_first_ISI inv_fourth_ISI
inv_last_ISI inv_second_ISI inv_third_ISI
inv_time_to_first_spike irregularity_index is_not_stuck
max_amp_difference maximum_voltage maximum_voltage_from_voltagebase
mean_AP_amplitude mean_frequency min_AHP_indices
min_AHP_values min_voltage_between_spikes minimum_voltage
number_initial_spikes ohmic_input_resistance ohmic_input_resistance_vb_ssse
peak_indices peak_time peak_voltage
sag_amplitude sag_ratio1 sag_ratio2
single_burst_ratio spike_half_width spike_width2
steady_state_hyper steady_state_voltage steady_state_voltage_stimend
time_constant time_to_first_spike time_to_last_spike
time_to_second_spike trace_check voltage
voltage_after_stim voltage_base voltage_deflection

API Reference

class uncertainpy.features.EfelFeatures(new_features=None, features_to_run=u'all', interpolate=None, labels={}, strict=True, logger_level=u'info')[source]

Calculating the mean value of each feature in the Electrophys Feature Extraction Library (eFEL), see: https://github.com/BlueBrain/eFEL.

Parameters:
  • new_features ({None, callable, list of callables}) – The new features to add. The feature functions have the requirements stated in reference_feature. If None, no features are added. Default is None.

  • features_to_run ({“all”, None, str, list of feature names}, optional) – Which features to calculate uncertainties for. If "all", the uncertainties are calculated for all implemented and assigned features. If None, or an empty list [], no features are calculated. If str, only that feature is calculated. If list of feature names, all the listed features are calculated. Default is "all".

  • new_utility_methods ({None, list}, optional) – A list of new utility methods. All methods in this class that is not in the list of utility methods, is considered to be a feature. Default is None.

  • interpolate ({None, “all”, str, list of feature names}, optional) – Which features are irregular, meaning they have a varying number of points between two evaluations. An interpolation is performed on each interpolate feature to create regular results. If "all", all features interpolated. If None, or an empty list, no features are interpolated. If str, only that feature is interpolated. If list of feature names, all listed features are interpolated. Default is None.

  • labels (dictionary, optional) – A dictionary with key as the feature name and the value as a list of labels for each axis. The number of elements in the list corresponds to the dimension of the feature. Example:

    new_labels = {"0d_feature": ["x-axis"],
                  "1d_feature": ["x-axis", "y-axis"],
                  "2d_feature": ["x-axis", "y-axis", "z-axis"]
                 }
    
  • strict (bool, optional) – If True, missing "stimulus_start" and "stimulus_end" from info raises a ValueError. If False the simulation start time is used as "stimulus_start" and the simulation end time is used for "stimulus_end". The decay_time_constant_after_stim feature becomes disabled with False. Default is True

  • logger_level ({“info”, “debug”, “warning”, “error”, “critical”, None}, optional) – Set the threshold for the logging level. Logging messages less severe than this level is ignored. If None, no logging is performed. Default logger level is “info”.

Variables:
  • features_to_run (list) – Which features to calculate uncertainties for.
  • interpolate (list) – A list of irregular features to be interpolated.
  • utility_methods (list) – A list of all utility methods implemented. All methods in this class that is not in the list of utility methods is considered to be a feature.
  • labels (dictionary) – Labels for the axes of each feature, used when plotting.
  • strict (bool) – If missing info values should raise an error.
Raises:
  • ValueError – If strict is True and "stimulus_start" and "stimulus_end" are missing from info.
  • ValueError – If stimulus_start >= stimulus_end.
  • ImportError – If Efel is not installed.

Notes

Efel features take the parameters (time, values, info) and require info[“stimulus_start”] and info[“stimulus_end”] to be set.

Implemented Efel features are:

AHP1_depth_from_peak AHP2_depth_from_peak AHP_depth
AHP_depth_abs AHP_depth_abs_slow AHP_depth_diff
AHP_depth_from_peak AHP_slow_time AHP_time_from_peak
AP1_amp AP1_begin_voltage AP1_begin_width
AP1_peak AP1_width AP2_AP1_begin_width_diff
AP2_AP1_diff AP2_AP1_peak_diff AP2_amp
AP2_begin_voltage AP2_begin_width AP2_peak
AP2_width AP_amplitude AP_amplitude_change
AP_amplitude_diff AP_amplitude_from_voltagebase AP_begin_indices
AP_begin_time AP_begin_voltage AP_begin_width
AP_duration AP_duration_change AP_duration_half_width
AP_duration_half_width_change AP_end_indices AP_fall_indices
AP_fall_rate AP_fall_rate_change AP_fall_time
AP_height AP_phaseslope AP_phaseslope_AIS
AP_rise_indices AP_rise_rate AP_rise_rate_change
AP_rise_time AP_width APlast_amp
APlast_width BAC_maximum_voltage BAC_width
BPAPAmplitudeLoc1 BPAPAmplitudeLoc2 BPAPHeightLoc1
BPAPHeightLoc2 BPAPatt2 BPAPatt3
E10 E11 E12
E13 E14 E15
E16 E17 E18
E19 E2 E20
E21 E22 E23
E24 E25 E26
E27 E3 E39
E39_cod E4 E40
E5 E6 E7
E8 E9 ISI_CV
ISI_log_slope ISI_log_slope_skip ISI_semilog_slope
ISI_values ISIs Spikecount
Spikecount_stimint adaptation_index adaptation_index2
all_ISI_values amp_drop_first_last amp_drop_first_second
amp_drop_second_last burst_ISI_indices burst_mean_freq
burst_number check_AISInitiation decay_time_constant_after_stim
depolarized_base doublet_ISI fast_AHP
fast_AHP_change initburst_sahp initburst_sahp_ssse
initburst_sahp_vb interburst_voltage inv_fifth_ISI
inv_first_ISI inv_fourth_ISI inv_last_ISI
inv_second_ISI inv_third_ISI inv_time_to_first_spike
irregularity_index is_not_stuck max_amp_difference
maximum_voltage maximum_voltage_from_voltagebase mean_AP_amplitude
mean_frequency min_AHP_indices min_AHP_values
min_voltage_between_spikes minimum_voltage number_initial_spikes
ohmic_input_resistance ohmic_input_resistance_vb_ssse peak_indices
peak_time peak_voltage sag_amplitude
sag_ratio1 sag_ratio2 single_burst_ratio
spike_half_width spike_width2 steady_state_hyper
steady_state_voltage steady_state_voltage_stimend time
time time_constant time_to_first_spike
time_to_last_spike time_to_second_spike trace_check
voltage voltage voltage_after_stim
voltage_base voltage_deflection voltage_deflection_begin
voltage_deflection_vb_ssse    

See also

uncertainpy.features.EfelFeatures.reference_feature
reference_feature showing the requirements of a Efel feature function.
add_features(new_features, labels={})

Add new features.

Parameters:
  • new_features ({callable, list of callables}) – The new features to add. The feature functions have the requirements stated in reference_feature.

  • labels (dictionary, optional) – A dictionary with the labels for the new features. The keys are the feature function names and the values are a list of labels for each axis. The number of elements in the list corresponds to the dimension of the feature. Example:

    new_labels = {"0d_feature": ["x-axis"],
                  "1d_feature": ["x-axis", "y-axis"],
                  "2d_feature": ["x-axis", "y-axis", "z-axis"]
                 }
    
Raises:

TypeError – Raises a TypeError if new_features is not callable or list of callables.

Notes

The features added are not added to features_to_run. features_to_run must be set manually afterwards.

See also

uncertainpy.features.Features.reference_feature()
reference_feature showing the requirements of a feature function.
calculate_all_features(*model_results)

Calculate all implemented features.

Parameters:*model_results – Variable length argument list. Is the values that model.run() returns. By default it contains time and values, and then any number of optional info values.
Returns:results – A dictionary where the keys are the feature names and the values are a dictionary with the time values time and feature results on values, on the form {"time": t, "values": U}.
Return type:dictionary
Raises:TypeError – If feature_name is a utility method.

Notes

Checks that the feature returns two values.

See also

uncertainpy.features.Features.calculate_feature()
Method for calculating a single feature.
calculate_feature(feature_name, *preprocess_results)

Calculate feature with feature_name.

Parameters:
  • feature_name (str) – Name of feature to calculate.
  • *preprocess_results – The values returned by preprocess. These values are sent as input arguments to each feature. By default preprocess returns the values that model.run() returns, which contains time and values, and then any number of optional info values. The implemented features require that info is a single dictionary with the information stored as key-value pairs. Certain features require specific keys to be present.
Returns:

  • time ({None, numpy.nan, array_like}) – Time values, or equivalent, of the feature, if no time values returns None or numpy.nan.
  • values (array_like) – The feature results, values must either be regular (have the same number of points for different paramaters) or be able to be interpolated.

Raises:

TypeError – If feature_name is a utility method.

See also

uncertainpy.models.Model.run()
The model run method
calculate_features(*model_results)

Calculate all features in features_to_run.

Parameters:*model_results – Variable length argument list. Is the values that model.run() returns. By default it contains time and values, and then any number of optional info values.
Returns:results – A dictionary where the keys are the feature names and the values are a dictionary with the time values time and feature results on values, on the form {"time": time, "values": values}.
Return type:dictionary
Raises:TypeError – If feature_name is a utility method.

Notes

Checks that the feature returns two values.

See also

uncertainpy.features.Features.calculate_feature()
Method for calculating a single feature.
features_to_run

Which features to calculate uncertainties for.

Parameters:new_features_to_run ({“all”, None, str, list of feature names}) – Which features to calculate uncertainties for. If "all", the uncertainties are calculated for all implemented and assigned features. If None, or an empty list , no features are calculated. If str, only that feature is calculated. If list of feature names, all listed features are calculated. Default is "all".
Returns:A list of features to calculate uncertainties for.
Return type:list
implemented_features()

Return a list of all callable methods in feature, that are not utility methods, does not starts with “_” and not a method of a general python object.

Returns:A list of all callable methods in feature, that are not utility methods.
Return type:list
interpolate

Features that require an interpolation.

Which features are interpolated, meaning they have a varying number of time points between evaluations. An interpolation is performed on each interpolated feature to create regular results.

Parameters:new_interpolate ({None, “all”, str, list of feature names}) – If "all", all features are interpolated. If None, or an empty list, no features are interpolated. If str, only that feature is interpolated. If list of feature names, all listed features are interpolated. Default is None.
Returns:A list of irregular features to be interpolated.
Return type:list
labels

Labels for the axes of each feature, used when plotting.

Parameters:

new_labels (dictionary) – A dictionary with key as the feature name and the value as a list of labels for each axis. The number of elements in the list corresponds to the dimension of the feature. Example:

new_labels = {"0d_feature": ["x-axis"],
              "1d_feature": ["x-axis", "y-axis"],
              "2d_feature": ["x-axis", "y-axis", "z-axis"]
             }
preprocess

Preprossesing of the time time and results values from the model, before the features are calculated.

No preprocessing is performed, and the direct model results are currently returned. If preprocessing is needed it should follow the below format.

Parameters:*model_results – Variable length argument list. Is the values that model.run() returns. By default it contains time and values, and then any number of optional info values.
Returns:Returns any number of values that are sent to each feature. The values returned must compatible with the input arguments of all features.
Return type:preprocess_results

Notes

Perform a preprossesing of the model results before the results are sent to the calculation of each feature. It is used to perform common calculations that each feature needs to perform, to reduce the number of necessary calculations. The values returned must therefore be compatible with the input arguments to each features.

See also

uncertainpy.models.Model.run
The model run method
reference_feature(time, values, info)[source]

An example of an Efel feature. Efel feature functions have the following requirements, and the given parameters must either be returned by model.run or features.preprocess.

Parameters:
  • time ({None, numpy.nan, array_like}) – Time values of the model. If no time values it is None or numpy.nan.
  • values (array_like) – Result of the model.
  • info (dictionary) – A dictionary with info[“stimulus_start”] and info[“stimulus_end”] set.
Returns:

  • time (None) – No mean Efel feature has time values, so None is returned instead.
  • values (array_like) – The feature results, values. Returns None if there are no feature results and that evaluation are disregarded.

See also

uncertainpy.features.Features.preprocess()
The features preprocess method.
uncertainpy.models.Model.run()
The model run method
validate(feature_name, *feature_result)

Validate the results from calculate_feature.

This method ensures each returns time, values.

Parameters:
  • model_results – Any type of model results returned by run.
  • feature_name (str) – Name of the feature, to create better error messages.
Raises:
  • ValueError – If the model result does not fit the requirements.
  • TypeError – If the model result does not fit the requirements.

Notes

Tries to verify that at least, time and values are returned from run. model_result should follow the format: return time, values, info_1, info_2, .... Where:

  • time_feature : {None, numpy.nan, array_like}

    Time values, or equivalent, of the feature, if no time values return None or numpy.nan.

  • values : {None, numpy.nan, array_like}

    The feature results, values must either be regular (have the same number of points for different paramaters) or be able to be interpolated. If there are no feature results return None or numpy.nan instead of values and that evaluation are disregarded.