laszukdawid / PyEMD

Python implementation of Empirical Mode Decompoisition (EMD) method
https://pyemd.readthedocs.io/
Apache License 2.0
857 stars 222 forks source link

Problem with seed for reproductibility #124

Closed JhonAndersonVelasco closed 1 year ago

JhonAndersonVelasco commented 2 years ago

Hi I am trying set a seed for the random numbers generation for make my code reusable, but I got this:

CEEMDAN.noise_seed(self,seed=7)
NameError: name 'self' is not defined

And when I run it without 'self' I got:

CEEMDAN.noise_seed(seed=7)
TypeError: CEEMDAN.noise_seed() missing 1 required positional argument: 'self'

And without args names I got:

CEEMDAN.noise_seed(7)
TypeError: CEEMDAN.noise_seed() missing 1 required positional argument: 'seed'

What should I do for make reproductibility possible?

Thank you

laszukdawid commented 2 years ago

Hi @JhonAndersonVelasco ,

You're trying to use noise_seed as a static class method which isn't correct. To set the seed you need to first create an instance, e.g.

ceedman = CEEDAN()
ceedman.noise_seed(seed=7)
results = ceedman(signal)

Hope this helps

JhonAndersonVelasco commented 2 years ago

Hi @JhonAndersonVelasco ,

You're trying to use noise_seed as a static class method which isn't correct. To set the seed you need to first create an instance, e.g.

ceedman = CEEDAN()
ceedman.noise_seed(seed=7)
results = ceedman(signal)

Hope this helps

Thank you, I will try it

JhonAndersonVelasco commented 2 years ago

It worked really fine, thank you