efel.api

eFEL Python API functions.

This module provides the user-facing Python API of eFEL. The convenience functions defined here call the underlying ‘cppcore’ library to hide the lower level API from the user.

Copyright (c) 2015, EPFL/Blue Brain Project

This file is part of eFEL <https://github.com/BlueBrain/eFEL>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as published by the Free Software Foundation.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Functions

FeatureNameExists(feature_name)

param feature_name:

feature_name_exists(feature_name)

Returns True if the feature name exists in eFEL, False otherwise.

getDependencyFileLocation()

rtype:

str

getDistance(trace, featureName, mean, std[, ...])

rtype:

float

getFeatureNames()

rtype:

list[str]

getFeatureValues(traces, featureNames[, ...])

getMeanFeatureValues(traces, featureNames[, ...])

get_dependency_file_location()

Gets the location of the Dependency file.

get_distance(trace, feature_name, mean, std)

Calculate distance value for a list of traces.

get_feature_names()

Return a list with the name of all the available features

get_feature_values(traces, feature_names[, ...])

Calculate feature values for a list of traces.

get_mean_feature_values(traces, feature_names)

Convenience function that returns mean values from get_feature_values()

get_py_feature(feature_name)

Return values of the given feature name.

reset()

Resets the efel to its initial state

setDependencyFileLocation(location)

param location:

setDerivativeThreshold(newDerivativeThreshold)

param newDerivativeThreshold:

setDoubleSetting(setting_name, new_value)

param setting_name:

setIntSetting(setting_name, new_value)

param setting_name:

setStrSetting(setting_name, new_value)

param setting_name:

setThreshold(newThreshold)

param newThreshold:

set_dependency_file_location(location)

Sets the location of the Dependency file.

set_derivative_threshold(...)

Set the threshold for the derivative for detecting the spike onset.

set_double_setting(setting_name, new_value)

Set a certain double setting to a new value

set_int_setting(setting_name, new_value)

Set a certain integer setting to a new value

set_str_setting(setting_name, new_value)

Set a certain string setting to a new value

set_threshold(new_threshold)

Set the spike detection threshold in the eFEL, default -20.0

efel.api.feature_name_exists(feature_name)[source]

Returns True if the feature name exists in eFEL, False otherwise.

Parameters:

feature_name (str)

Return type:

bool

efel.api.get_dependency_file_location()[source]

Gets the location of the Dependency file.

Return type:

str

Returns:

Path to the location of a Dependency file.

efel.api.get_distance(trace, feature_name, mean, std, trace_check=True, error_dist=250)[source]

Calculate distance value for a list of traces.

Parameters:
  • trace (dict) – Trace dict that represents one trace. The dict should have the following keys: ‘T’, ‘V’, ‘stim_start’, ‘stim_end’

  • feature_name (str) – Name of the the features for which to calculate the distance

  • mean (float) – Mean to calculate the distance from

  • std (float) – Std to scale the distance with

  • trace_check (bool) – Let the library check if there are spikes outside of stimulus interval, default is True

  • error_dist (float) – Distance returned when error, default is 250

Return type:

float

Returns:

The absolute number of standard deviation the feature is away from the mean. In case of anomalous results a value of ‘error_dist’ standard deviations is returned. This can happen if: a feature generates an error, there are spikes outside of the stimulus interval, the feature returns a NaN, etc.

efel.api.get_feature_names()[source]

Return a list with the name of all the available features

Return type:

list[str]

Returns:

A list that contains all the feature names available in the eFEL. These names can be used in the feature_names argument of e.g. get_feature_values()

efel.api.get_feature_values(traces, feature_names, parallel_map=None, return_list=True, raise_warnings=True)[source]

Calculate feature values for a list of traces.

This function is the core of eFEL API. A list of traces (in the form of dictionaries) is passed as argument, together with a list of feature names.

The return value consists of a list of dictionaries, one for each input trace. The keys in the dictionaries are the names of the calculated features, the corresponding values are lists with the feature values. Beware that every feature returns an array of values. E.g. AP_amplitude will return a list with the amplitude of every action potential.

Parameters:
  • traces (list[dict]) – Every trace dict represents one trace. The dict should have the following keys: ‘T’, ‘V’, ‘stim_start’, ‘stim_end’

  • feature_names (list[str]) – List with the names of the features to be calculated on all the traces.

  • parallel_map (Optional[Callable]) – Map function to parallelise over the traces. Default is the serial map() function

  • return_list (bool) – By default the function returns a list of dicts. This optional argument can disable this, so that the result of the parallel_map() is returned. Can be useful for performance reasons when an iterator is preferred.

  • raise_warnings (bool) – Raise warning when efel c++ returns an error

Return type:

Union[list, Iterator]

Returns:

For every input trace a feature value dict is returned (in the same order). The dict contains the keys of ‘feature_names’, every key contains a numpy array with the feature values returned by the C++ efel code. The value is None if an error occured during the calculation of the feature.

efel.api.get_mean_feature_values(traces, feature_names, raise_warnings=True)[source]

Convenience function that returns mean values from get_feature_values()

Instead of return a list of values for every feature as get_feature_values() does, this function returns per trace one value for every feature, namely the mean value.

Parameters:
  • traces (list[dict]) – Every trace dict represents one trace. The dict should have the following keys: ‘T’, ‘V’, ‘stim_start’, ‘stim_end’

  • feature_names (list[str]) – List with the names of the features to be calculated on all the traces.

  • raise_warnings (bool) – Raise warning when efel c++ returns an error

Return type:

list[dict]

Returns:

For every input trace a feature value dict is returned (in the same order). The dict contains the keys of ‘feature_names’, every key contains the mean of the array that is returned by get_feature_values() The value is None if an error occured during the calculation of the feature, or if the feature value array was empty.

efel.api.get_py_feature(feature_name)[source]

Return values of the given feature name.

Parameters:

feature_name (str)

Return type:

ndarray | None

efel.api.reset()[source]

Resets the efel to its initial state

The user can set certain values in the efel, like the spike threshold. These values are persisten. This function will reset these value to their original state.

efel.api.set_dependency_file_location(location)[source]

Sets the location of the Dependency file.

eFEL uses ‘Dependency’ files to let the user define versions of features to use. The installation directory of eFEL contains a default ‘DependencyV5.txt’ file. Unless users want to change this file, it is not necessary to call this function. Modifying the Dependency file can be useful in debugging.

Parameters:

location (str | Path) – Path to the location of a Dependency file.

Raises:

FileNotFoundError – If the path to the dependency file doesn’t exist.

Return type:

None

efel.api.set_derivative_threshold(new_derivative_threshold)[source]

Set the threshold for the derivative for detecting the spike onset.

Some features use a threshold on dV/dt to calculate the beginning of an action potential. This function allows you to set this threshold.

Parameters:

new_derivative_threshold (float) – The new derivative threshold value (in the same units as the traces, e.g. mV/ms).

Return type:

None

efel.api.set_double_setting(setting_name, new_value)[source]

Set a certain double setting to a new value

Parameters:
  • setting_name (str)

  • new_value (float)

Return type:

None

efel.api.set_int_setting(setting_name, new_value)[source]

Set a certain integer setting to a new value

Parameters:
  • setting_name (str)

  • new_value (int)

Return type:

None

efel.api.set_str_setting(setting_name, new_value)[source]

Set a certain string setting to a new value

Parameters:
  • setting_name (str)

  • new_value (str)

Return type:

None

efel.api.set_threshold(new_threshold)[source]

Set the spike detection threshold in the eFEL, default -20.0

Parameters:

new_threshold (float) – The new spike detection threshold value (in the same units as the traces, e.g. mV).

Return type:

None

Source

_autosummary/efel.api.rst