Skip to content

Commit

Permalink
fix impedance freq indexing (#407)
Browse files Browse the repository at this point in the history
* fix impedance freq indexing

* fix test

* update Changelog

---------

Co-authored-by: Jaquier Aurélien Tristan <[email protected]>
  • Loading branch information
AurelienJaquier and Jaquier Aurélien Tristan authored Aug 7, 2024
1 parent f1c89c2 commit ff75107
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.

5.6.7 - 2024-08
---------------

- Fixed impedance feature (frequency index was inconsistent with smooth Z)

5.7.1 - 2024-07
---------------

Expand Down
2 changes: 1 addition & 1 deletion efel/pyfeatures/pyfeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def impedance():
)[0]
smooth_Z = gaussian_filter1d(norm_Z[select_idxs], 10)
ind_max = np.argmax(smooth_Z)
return np.array([freq[ind_max]])
return np.array([freq[select_idxs][ind_max]])
else:
return None
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pyfeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def test_impedance():
"""pyfeatures: Test impedance feature"""
feature_name = "impedance"

expected_values = {feature_name: 4.615384615384615}
expected_values = {feature_name: 4.80769231}
_test_expected_value(feature_name, expected_values)


Expand Down

0 comments on commit ff75107

Please sign in to comment.