From ff7510718787e7531fd9143363eadd7a07bff5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Jaquier?= <72930209+AurelienJaquier@users.noreply.github.com> Date: Wed, 7 Aug 2024 14:50:12 +0200 Subject: [PATCH] fix impedance freq indexing (#407) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix impedance freq indexing * fix test * update Changelog --------- Co-authored-by: Jaquier Aurélien Tristan --- CHANGELOG.rst | 5 +++++ efel/pyfeatures/pyfeatures.py | 2 +- tests/test_pyfeatures.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 63fe2b62..f4167729 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `_, and this project adheres to `Semantic Versioning `_. +5.6.7 - 2024-08 +--------------- + +- Fixed impedance feature (frequency index was inconsistent with smooth Z) + 5.7.1 - 2024-07 --------------- diff --git a/efel/pyfeatures/pyfeatures.py b/efel/pyfeatures/pyfeatures.py index dc2a6e50..b7cb7b19 100644 --- a/efel/pyfeatures/pyfeatures.py +++ b/efel/pyfeatures/pyfeatures.py @@ -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: diff --git a/tests/test_pyfeatures.py b/tests/test_pyfeatures.py index 39711e86..943b55df 100644 --- a/tests/test_pyfeatures.py +++ b/tests/test_pyfeatures.py @@ -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)