Skip to content

Commit

Permalink
handle None values in compute_efeatures (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkilic committed Apr 23, 2024
1 parent b5fc0e5 commit 4bfe32a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bluepyefe/recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,11 @@ def compute_efeatures(
efel_vals = self.call_efel(efeatures, efel_settings)
for efeature_name, efeature in zip(efeature_names, efeatures):

value = efel_vals[0][efeature]
if value is None or len(value) == 0 or numpy.isinf(numpy.nanmean(value)):
if efel_vals[0][efeature] is not None:
value = [v for v in efel_vals[0][efeature] if v is not None]
else:
value = []
if len(value) == 0 or numpy.isinf(numpy.nanmean(value)):
self.efeatures[efeature_name] = numpy.nan
else:
self.efeatures[efeature_name] = numpy.nanmean(value)
Expand Down

0 comments on commit 4bfe32a

Please sign in to comment.