Skip to content

Commit fb7323f

Browse files
committed
Fix issue where 'wopt' passed to 'ecurve' could contain Numpy arrays
1 parent bda19f6 commit fb7323f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pymodalib/implementations/matlab/ridge_extraction.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

17-
from typing import Tuple, Union, Dict
17+
from typing import Tuple, Union, Dict, List
1818

1919
import numpy as np
2020
from numpy import ndarray
@@ -59,7 +59,15 @@ def ecurve_impl(
5959
}
6060
)
6161

62-
tfsupp = package.ecurve(tfr, frequencies, wopt, kwargs, nargout=1)
62+
wopt_sanitised: Dict = {**wopt}
63+
twf: List = (wopt.get("wp") or {}).get("twf")
64+
65+
if twf and isinstance(twf, list):
66+
# Avoid passing this field containing Numpy arrays to the MATLAB algorithm.
67+
# It doesn't use this field anyway.
68+
twf.clear()
69+
70+
tfsupp = package.ecurve(tfr, frequencies, wopt_sanitised, kwargs, nargout=1)
6371
return tfsupp
6472

6573

0 commit comments

Comments
 (0)