On Thu, Jan 13, 2022 at 10:47 AM <c...@live.in> wrote:

> Hello,
>
> I am a mechanical engineer and am using Numpy Convolve to smoothen 1D data
> collected from physical testing for a diesel engine. (I found convolve the
> best after comparing with other smoothing methodologies)
> I tried reading the numpy manual and the wikipedia article referenced in
> it.
> But I would specifically like to ask/discuss what would happen if the
> second 1D input is not given?


The second input is required, which is evident from the docstring and could
be ascertained by just trying it. Are you instead asking rather if
np.convolve() could be modified to not have to take the second argument?

If so, no, I don't think we would. There are no sensible defaults.
Convolution is inherently a very general operation that combines two inputs
to achieve a variety of effects, not just smoothing.

what type of window will the function pass the data through to smoothen it?


There are several ways to build a low-pass (i.e. smoothing) filter. My
favorite first choice is the Savitzky-Golay filter as mentioned several
times in the StackOverflow answers that you link to. It constructs a
low-pass filter window (i.e. the second 1D input) according to some simple,
understandable design rules and then uses convolution. I recommend starting
with `scipy.signal.savgol_filter()`. If you need to reuse the same filter
window for lots of signals, you can use `scipy.signal.savgol_coeffs()` to
get that window first, and then use `np.convolve()` explicitly.

Here are the articles I have read to implement my smoothing code:
> References:
> 1. https://numpy.org/doc/stable/reference/generated/numpy.convolve.html
> 2. https://en.wikipedia.org/wiki/Convolution
> 3.
> https://stackoverflow.com/questions/20618804/how-to-smooth-a-curve-in-the-right-way


-- 
Robert Kern
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to