Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal treatment functions philosophy #6

Open
mjtueros opened this issue Jun 19, 2019 · 3 comments
Open

Signal treatment functions philosophy #6

mjtueros opened this issue Jun 19, 2019 · 3 comments

Comments

@mjtueros
Copy link

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?.

@mjtueros mjtueros changed the title Signal treatment functions filosophy Signal treatment functions philosophy Jun 19, 2019
@azilles
Copy link
Contributor

azilles commented Jun 19, 2019

Hi Matias,
just remove line


And add a comment in the description

Valentin will look for a automatic test of things like this.

@niess
Copy link
Member

niess commented Jun 19, 2019

@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

@niess
Copy link
Member

niess commented Jun 19, 2019

I didn't find an automatic checker for that so far :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants