diff --git a/README.md b/README.md index e2bf6a7d..eb76dfcb 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,13 @@ To get a list with all the available feature names efel.get_feature_names() ``` +To change the spike detection threshold setting (default is -20 mV) + +```python +efel.set_setting('Threshold', -30) +``` +For a full list of available settings, please refer to the [Setting class](./efel/settings.py) + The python function to extract features is get_feature_values(...). Below is a short example on how to use this function. The code and example trace are available @@ -205,6 +212,9 @@ def main(): # argument should be a list traces = [trace1] + # set the threshold for spike detection to -20 mV + efel.set_setting('Threshold', -20) + # Now we pass 'traces' to the efel and ask it to calculate the feature # values traces_results = efel.get_feature_values(traces, diff --git a/efel/api.py b/efel/api.py index aefda482..738b633f 100644 --- a/efel/api.py +++ b/efel/api.py @@ -182,7 +182,7 @@ def get_distance( if trace_check: trace_check_success = get_feature_values( - [trace], ['trace_check'])[0] # type: ignore + [trace], ['trace_check'], None, True, True)[0] if trace_check_success["trace_check"] is None: return error_dist @@ -401,14 +401,14 @@ def get_mean_feature_values( parallel_map=None, return_list=True, raise_warnings=raise_warnings) - for featureDict in featureDicts: # type: ignore + for featureDict in featureDicts: for (key, values) in list(featureDict.items()): if values is None or len(values) == 0: featureDict[key] = None else: featureDict[key] = np.mean(values) - return featureDicts # type: ignore + return featureDicts def register_feature(feature_function: Callable): diff --git a/examples/basic/basic_example1.py b/examples/basic/basic_example1.py index f8e888de..836d72b9 100644 --- a/examples/basic/basic_example1.py +++ b/examples/basic/basic_example1.py @@ -41,6 +41,9 @@ def main(): # argument should be a list traces = [trace1] + # set the threshold for spike detection to -20 mV + efel.set_setting('Threshold', -20) + # Now we pass 'traces' to the efel and ask it to calculate the feature # values traces_results = efel.get_feature_values(traces,