Skip to content

Commit e91f94c

Browse files
committed
Allow "wavelet='Morse-a'" in wavelet transform
1 parent 932e811 commit e91f94c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pymodalib/algorithms/wavelet.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from typing import Tuple
2222

2323
from numpy import ndarray
24+
from pymodalib.implementations.python.wavelet.wavelet_transform import MorseWavelet
2425

2526
from pymodalib.utils.parameters import verify_parameter, BadParametersException
2627

@@ -71,7 +72,7 @@ def wavelet_transform(
7172
(Default = False) Whether WT coefficients should be set to NaN out of the influence (see [1]).
7273
Use `cut_edges=True` if you wish to analyze the WT only within the cone of influence, which is recommended
7374
if you are estimating only the time-averaged quantities.
74-
wavelet : {"Lognorm", "Morlet", "Bump", "Morse-a"}
75+
wavelet : {"Lognorm", "Morlet", "Morse-a"}
7576
(Default = "Lognorm") Wavelet used in the WT calculation.
7677
For a list of all supported names and their properties, see Appendix E in [1].
7778
*Note: supplying a wavelet using a custom function is not supported in PyMODAlib.*
@@ -128,7 +129,7 @@ def wavelet_transform(
128129
Part II: Resolution, reconstruction and concentration."
129130
{preprint:arXiv:1310.7274}
130131
"""
131-
verify_parameter(wavelet, possible_values=["Lognorm", "Bump", "Morlet"])
132+
verify_parameter(wavelet, possible_values=["Lognorm", "Bump", "Morlet", "Morse-a"])
132133
verify_parameter(implementation, possible_values=["matlab", "python"])
133134

134135
if implementation == "python":
@@ -143,7 +144,9 @@ def wavelet_transform(
143144
elif wavelet == "Morlet":
144145
wp = MorletWavelet(resolution)
145146
elif wavelet == "Bump":
146-
raise NotImplementedError("Bump wavelet is not implemented yet.")
147+
raise Exception("Bump wavelet is not supported yet.")
148+
elif wavelet == "Morse-a":
149+
wp = MorseWavelet(3, resolution)
147150
else:
148151
raise ValueError(f"Unknown wavelet: '{wavelet}'")
149152

pymodalib/implementations/python/wavelet/wavelet_transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def wavelet_transform(
363363

364364
signal = np.concatenate([padleft, signal, padright])
365365
if preprocess and dflag == 1:
366-
signal = preprocess(signal, fs, fmin, fmax)
366+
signal = pymodalib.preprocess(signal, fs, fmin, fmax)
367367

368368
Nq = int(np.ceil((NL + 1) / 2))
369369

0 commit comments

Comments
 (0)