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

slice in https://github.com/scipy/scipy-cookbook/blob/master/ipython/SignalSmooth.ipynb #23

Open
louking opened this issue Dec 25, 2017 · 1 comment

Comments

@louking
Copy link

louking commented Dec 25, 2017

Sorry not sending pull request as I am not sure I am correct. But I tried returning the slice suggested and had different output length. I am not sure of the math and how numpy.convolve works but my correction seems to pull the "middle" slice. E.g,. for window_len = 5 my suggested slice omits first two and last two elements.

NOTE: length(output) != length(input), to correct this: return y[(window_len/2-1):-(window_len/2)] instead of just y.

be

NOTE: length(output) != length(input), to correct this: return y[(window_len/2):-(window_len/2)] instead of just y.

@rgommers
Copy link
Member

Thanks @louking, that seems to be correct. With the suggestion as given now, y.shape = (101,) while x.shape = (100,).

@WarrenWeckesser agreed that that's the way to change it?

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

2 participants