Skip to content

Commit

Permalink
update efel deprecated functions calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkilic committed May 2, 2024
1 parent 4bfe32a commit 41d753e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion bluepyefe/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,8 @@ def extract_efeatures(

if efel_settings is None:
logger.warning(
"efel_settings is None. Default settings will be used"
"efel_settings is None. Default settings will be used: " +
str(DEFAULT_EFEL_SETTINGS)
)
efel_settings = DEFAULT_EFEL_SETTINGS.copy()

Expand Down
12 changes: 1 addition & 11 deletions bluepyefe/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,7 @@ def set_efel_settings(efeature_settings):
if setting in ['stim_start', 'stim_end']:
value = float(value)

if setting == 'Threshold':
efel.setThreshold(value)

elif isinstance(value, bool) or isinstance(value, int):
efel.setIntSetting(setting, int(value))

elif isinstance(value, (float, list)):
efel.setDoubleSetting(setting, value)

elif isinstance(value, str):
efel.setStrSetting(setting, value)
efel.set_setting(setting, value)


def dict_to_json(data, path):
Expand Down
13 changes: 12 additions & 1 deletion tests/test_efel_settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""bluepyefe.cell tests"""

import unittest
import pytest

import bluepyefe.cell
import bluepyefe.recording
Expand All @@ -27,7 +28,7 @@ def setUp(self):
)

def test_efel_threshold(self):

self.cell.recordings[0].efeatures = {}

self.cell.extract_efeatures(
Expand Down Expand Up @@ -69,6 +70,16 @@ def test_efel_threshold(self):
recording = self.cell.recordings[0]
self.assertEqual(recording.efeatures["Spikecount"], 0.)

def test_efel_incorrect_threshold(self):

self.cell.recordings[0].efeatures = {}

with pytest.raises(ValueError):
self.cell.extract_efeatures(
protocol_name="IDRest",
efeatures=["Spikecount"],
efel_settings={'Threshold': "40."}
)

if __name__ == "__main__":
unittest.main()

0 comments on commit 41d753e

Please sign in to comment.