Signal treatment functions philosophy
Opened this issue · 3 comments
I think we should define properly how singanl treatment functions should behave, and in general, how all functions should behave.
I spent a lot of time trying to understand why computevoltage and Anne full chain code was not giving me the exact same result when i noticed that the noise adding function overwrites the input. This is, to my practices, is very bad behaviour and also error prone. Functions should not change the values of input parameters, or if they do they should clearly state it for example by not returning any value (so forcing the user to understand how the function is used before actually using it, and providing the documentation)
What do you think?.
Hi Matias,
just remove line
And add a comment in the description
Valentin will look for a automatic test of things like this.
@azilles : apparently one can ensure that a numpy array is not mutable, as explained here. This could be added to the test suite for example:
test_add_noise():
voltage = numpy.array(some_values)
voltage.flags.writeable = False
noisy_voltage = add_noise(voltage) # Will raise an error if someone tries to modify voltage
I didn't find an automatic checker for that so far :(