Scipy.signal.iirfilter equivalent in DSP.jl and more

Hello,

I did some DSP about 20 years ago but didn’t tackled that field recently.
In order to get back to it I’m planning to build some Pluto.jl notebooks in this field.

I found this blog post Applying digital filters in Python - Samuel Pröll - Homepage which deals with IIR filters with Python

I wonder what is scipy.signal.iirfilter equivalent in Julia / DSP.jl.

I also wonder if some efforts have been made to build “live” digital filters as suggested in Digital filters for live signal processing in Python - Samuel Pröll - Homepage
I wonder if OnlineStats.jl couldn’t be a nice “framework” for this kind of implementation.

Kind regards

I wonder what is scipy.signal.iirfilter equivalent in Julia / DSP.jl.

If you provide a complete example call to scipy.signal.iirfilter, we can try to offer equivalent DSP.jl method invocations.

For example

vf = filt(digitalfilter(Lowpass(bw; fs), Butterworth(3)), v)

applies a 3-rd order Butterworth filter with cut-off frequency bw to signal vector v with sampling frequency fs, in case that helps.

The manual unfortunately doesn’t contain much in terms of examples for beginners right now, except for a couple hidden at the end of that filters page.

1 Like

Thanks @mgkuhn. Sorry my question wasn’t clear enough.

I did a Pluto notebook to test that.

Here is a screenshot showing how to process a vector of input values

and an other one showing how it performs with “live” incoming data

Here is code Some experiments with DSP.jl and filtering · GitHub

In this implementation filt calculates output of filter for input which is a vector using

output_values_signal_1 = filt(filter, cb_input_signal_1)

I don’t think that’s a good idea when performing “live” signal processing.

I wonder if (more exactly how) I can feed filter with only one value at a time (ie not a vector or a circular buffer).

I tried

output_signal_1 = filt(filter, input_signal_1)

but it raises a StackOverflowError

Any idea?

One problem of the current implementation can be shown here (input signal is rolling)

image

orange signal (filtered signal) starts from 0, it should start from it’s previous value (so nearer from -1).

filter should “keep” an internal state