Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add set_setting example in quickstart and fix issue #366 #395

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
darshanmandge marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions efel/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions examples/basic/basic_example1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading