Skip to content

Commit

Permalink
fix edge case in phaseslope_max
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaquier Aurélien Tristan committed Jan 17, 2024
1 parent 203a033 commit ebfeae7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docs/source/eFeatures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,8 @@ Attention, this feature is sensitive to interpolation timestep.
- **Units**: V/s
- **Pseudocode**: ::

phaseslope_max= max(numpy.diff(voltage) / numpy.diff(time))
phaseslope = numpy.diff(voltage) / numpy.diff(time)
phaseslope_max = numpy.array([numpy.max(phaseslope)])



Expand Down
7 changes: 3 additions & 4 deletions efel/pyfeatures/pyfeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,10 @@ def phaseslope_max():
from numpy import diff

phaseslope = diff(voltage) / diff(time)
phaseslope_max = max(phaseslope)

if phaseslope_max.size == 0:
try:
return numpy.array([numpy.max(phaseslope)])
except ValueError:
return None
return numpy.array([phaseslope_max])


def get_cpp_feature(featureName, raise_warnings=None):
Expand Down

0 comments on commit ebfeae7

Please sign in to comment.