DSP.jl icon indicating copy to clipboard operation
DSP.jl copied to clipboard

API for automatic filter order selection

Open simonster opened this issue 11 years ago • 3 comments

At present we design filters as:

digitalfilter(Lowpass(freq), Butterworth(order))
digitalfilter(Bandpass(freq1, freq2), Butterworth(order))

or equivalent, i.e., we specify filters in terms of the cutoff frequency, order, and optional filter parameters (for Chebyshev and Elliptic filters). It would be nice if we could also specify filters in terms of the cutoff frequency, stopband frequency, passband ripple, and stopband attenuation. We could have something like:

digitalfilter(Lowpass(0.2; Rp=1, Ws=0.5, Rs=90), Butterworth())
digitalfilter(Highpass(0.5; Rp=1, Ws=0.2, Rs=90), Butterworth())

Then for bandpass filters we'd pass Ws and (optionally) Rs as tuples:

digitalfilter(Bandpass(0.2, 0.3; Rp=1,
                       Ws=(0.1, 0.5), Rs=(60, 90)),
              Butterworth())

And for bandstop filters, we'd specify the passband frequencies Wp instead of Ws:

digitalfilter(Bandstop(0.2, 0.3; Rp=(.5, 1),
                       Wp=(0.1, 0.4), Rs=90),
              Butterworth())

This seems a bit complex, but I haven't thought of anything better yet.

simonster avatar Aug 01 '14 20:08 simonster

I think this looks good. Scipy has buttord, ellipord, cheb1ord, cheb2ord, and ellipord implementations that we could use as a reference. Should we pass Butterworth as a type instead of an instance of a type in this case? We could also just check for a defined order in digitalfilter and use the corresponding function in case the instance of the filter prototype has no order defined.

jfsantos avatar Aug 02 '14 20:08 jfsantos

Has any progress been made on filter order estimation? If not, I will have some time in a few weeks to make a start.

rob-luke avatar Jun 26 '15 07:06 rob-luke

As far as I know nobody is working on this, so feel free to propose something :)

jfsantos avatar Jun 27 '15 18:06 jfsantos