Home >

## Fast Track to Designing FIR Filters with Python

Dan Boschen - **Watch Now** - Duration: 01:29:21

Thank you for your interest in the Fast Track to Designing FIR Filters with Python workshop! Below are the installation instructions as well as a Jupyter Notebook with the material that will be presented in the workshop.

**Option 1: Easy path to Python: **Install the Anaconda Individual Edition which will have all the tools we will be using: https://www.anaconda.

**Option 2: Alternative manual path to Python: **As a minimum install we will be using Python 3, Numpy, Matplotlib, and Scipy:

Install python: https://www.python.

From command window type:

pip install ipython

pip install numpy

pip install matplotlib

pip install scipy

(if you encounter any difficulty with installing the packages, see this page: https://packaging.

Being able to run Jupyter Notebooks is not necessary for the workshop but convenient as I am sharing the details of the workshop in the attached Jupyter Notebook for future reference. If you would like further basics on running the Notebook, please see this link:

https://www.datacamp.com/

Notebook: Fast Track FIR Filter Workshop.ipynb

Finite Impulse Response (FIR) filters are the more popular of the two main types of digital filter implementations used in DSP applications. In this workshop, we will go through best practice approaches for optimized FIR filter design and implementation using the free and open-source Python programming language. This will include the common techniques for going from filter requirements to practical implementation and demonstrate both creating FIR filter designs as well as evaluating filter frequency responses using the Python language and its signal processing library.

**This workshop will include:**

- Complete setup to get Python up and running for signal processing applications.
- Summary of the high-level approaches to FIR filter design – which are best and why?
- Fast track to using the signal processing library in Python for creating FIR designs.
- The complete design flow for FIR filters from specification through verification.
- Using Python for filter evaluation, including plotting magnitude and phase responses.

**Pablo**

**Tilak**

At 27:50 It is said: "In LS frequency Response - Decreasing rolloff is good for Multi rate filters, as they can all alias in"

Can anyone throw more light on, how this aliasing between stop band ripples help in the design of multirate filters ?

**DanBoschen**Speaker

This is further detailed on this post I wrote on stackexchange: https://dsp.stackexchange.com/questions/52834/the-condition-in-order-to-not-lose-information-after-upsampling-and-downsampling/52860#52860

**DanBoschen**Speaker

If you make the poor choice of using a filter with an equal level stop-band, with high decimation factors these will all accumulate as they alias in. If the stop-band is rolling off then only the first and dominant ones will contribute to in band noise from the aliasing.

**DanBoschen**Speaker

Decimation (by selecting every Dth sample) results in higher frequency bands in the original wider frequency spectrum that will alias in to the final output spectrum. This is identical to the process of sampling an analog signal (which is decimating an infinitely sampled signal basically) and why we need anti-alias filtering prior to the sampling. With decimation similarly we need anti-alias filtering prior to decimation and for this if done with an FIR filter it is preferred to use a filter with a stopband that rolls off.

**dcomer**

Great Workshop!

10:58:35 From Dan Boschen : hello! 11:27:27 From Fred Harris : ofdm is the best example of thefrequency sampled data filter because all sampled tones in the ofdm signal match the kernels of the the DFT. 11:34:07 From Stephane Boucher : https://www.dsprelated.com/new2/course_registration_dsp_wireless.php 11:55:54 From Dave Comer : I'm sorry I missed your comment details on where you said the Juypter notebook(s) can be downloaded? My apologies. 11:56:26 From Dave Comer : Thank you. 11:56:37 From Stephane Boucher : It is actually currently available here: https://www.dsprelated.com/new2/course_registration_dsp_wireless.php 11:56:49 From Stephane Boucher : Simply click on the 'Description tab' 11:57:17 From Michael Kirkhart : Is this the link to the ipython notebook? : https://s3.amazonaws.com/embeddedrelated/user/1/fast%20track%20fir%20filter%20workshop_89335.ipynb 11:58:29 From Stephane Boucher : Yes, that should be it 12:07:27 From mnapier : Just an observation. The multiband filters are handy for doing resampling. In that case its not multiple pass bands but multiple stop bands. Each stop band where there is an image that needs to be rejected. In between those are don't care regions. The multiple stop bands allow the FIR zeros to be concentrated in area that matter and so reduce the order required. 12:21:35 From gs : Awesome presentation! Newbie question on implementation: I am streaming 500sps data into python, circ-buffering/notch-filtering in chunks of N*500 in np, scipy windowing/fft, and graphing in real-ish time. Have learned a lot so far, and would now like to filter data stream on sample-by-sample basis instead of chunks. Any pointers on how to do this in python? Also, any comments on practical/custom notch filtering (to remove nasty 60 cycle in this case)? Thx, Gil 12:28:43 From Radu Pralea : For aligning the input and output (filtered) signal, without anti-causally passing it twice through the filter (modifying the response), we can always simply discard first N/2 output samples (the group delay), and flush the filter at the end (feed it an additional N/2 zero-samples at the end). 12:29:25 From David Robinson : The trick is the closer to DC, the more risk to have unstability with qusntization 12:29:52 From David Robinson : See the presentation of fred harris last Monday on this topic 12:30:34 From gs : Yes, Fred's talks were incredible. thx 12:31:00 From Rob K. : thanks, dan. great talk 12:31:18 From Mike Swanson : thank you! 12:31:58 From Terrence Lawrence : great talk and demo

Hi Dan, great workshop indeed.

I've wondered if it's possible to get the jupyter notebooks that you used during presentation?

Thanks!