This thread is an experiment to see if we can use the new forum interface to come up with some useful general DSP content for the community.
Basically, you are invited to share any insight you may have related to the subject of the thread. In this case "Learning DSP with Python". Your contribution doesn't have to be long or complicated. A short Python snippet to help understand a DSP concept for instance, or maybe a Python trick that you find useful and would like to share.
This might not be the most exciting thread to participate in - but please see this as a warm up exercise to experiment with the new forum.
The hope is that many will participate so that the combination of several little insights and code snippets will make the thread a goto place for people who are currently learning DSP and/or Python.
Make sure to click on the 'thumbsup' button (), located to the left of every post, for the contributions that you like the most. The forum system will automatically put at the top the posts that received the most number of thumbsups.
If your contribution includes a code snippet, don't forget to highlight the snippet by:
- Selecting it
- Clicking on the 'formatting' button ()
- Selecting 'Code'
Also don't forget that you can easily attach a file or add an image to your post by drag & dropping them in the editor.
If you want to include some equations to your post, Mathjax is supported (tutorial here) by this forum.
If this thread ends up being a success with lots of contributions and great content, I will make sure to promote it by email to DSPRelated's 60k+ subscribers.
Finally, let's award some of our beers (click on the beer button) to our favourite posts and participants, making sure to encourage them to contribute often!
Thank you! #FAQ
I can provide a little feedback on my experience. Personally, I have found Python to be a great tool for signal processing (DSP) design and analysis. It should be noted that we are discussing using Python similar to the Matlab, Scilab, Mathematica, etc. and not for real-time DSP implementation (e.g. programming a DSP processor).
For me, Python is a powerful generic programming language that has become very popular with scientist and engineers. My personal opinion, the popularity in these domains is because it is a high-level programming language and the language designers have done a great job. In many ways, Python allows me to focus on the task at hand and less on the programming. I can use Python for many programming tasks not just multiplying matrices.
Two books that specifically use Python and signal processing:
- Think DSP by Allen Downey (already mentioned in the OP)
- Signal and systems for dummies by Mark Wickert (discloser Dr. Wickert was my advisor)
- scipy.signal (along with numpy for low-level numerics and matplotlib for plotting) is a must for doing signal processing in Python (lti, lsim, lsim2, step, and step2 are the ones I've used most often.) I used it in my Padé article quite extensively.
- The python-control library https://github.com/python-control/python-control may be of interest also
@stephaneb Thanks for mentioning Think DSP!
Everyone else: You can download the PDF or read it online at http://think-dsp.com
Think DSP is in technical review now and will be published in July. So if you get a chance to look at it in the next few weeks, comments and corrections are particularly welcome. (They will still be welcome after that, but harder to fix).
I still use Octave and Matlab for high-level analysis scripting, but I contributed to a free online course that uses Python for its audio signal processing examples:
I found the Python onboarding to be helpful and effective.
Here is a list of dsprelated posts that have used Python:
- Pade delay is okay today
- Autocorrelation and the case of the missing fundamental
- Generating pink noise
- Amplitude modulation and the sampling theorem
- Differentiating and integrating discrete signals
- 60 numbers
- Approximating the area of a chirp by fitting a polynomial
- Bayes meets Fourier
- Ten little algorithms, part 2
- Constrained integer behavior
- Adventures in signal processing with Python
- Python scipy.signal IIR filtering: an example
- Polyphase filters and filterbanks
- Python scipy.signal IIR filter
- Python scipy.signal IIR filter cont.
- Python number crunching faster?
The above is not an exhaustive list.
I've used Xavier Serra's sms-tools, available at https://github.com/MTG/sms-tools
It's a bit clunky, but interesting. I used it for his Coursera MOOC, Audio Signal Processing for Music Applications, which is a great course.
There's also a fork of sms-tools that has been optimized, at https://github.com/bzamecnik/sms-tools
Apart from the other things that have been mentioned before, I also like Python Data Analysis Library (pandas). Reading data in from files is a breeze with pandas. For example, say you have a large CSV file with multiple columns (with first row being labels for your columns). Let us your columns are named column1, column2 etc.,These are a few things you can do:
import pandas as pd df = pd.read_csv(fileName.csv, index_col=False) column1 = df['column1'] column2_unique = df['column2'].unique() # Filtering filter = df['column3'] == 50 column3_50 = df[filter]['column3'] # Check if you have a field if('column4' in df): print "column4 exists"
@macsdev, I agree pandas is a very useful package. I don't know if it is just me or if it is a general trend that data folks seem to use column-data whereas signal folks use row-data.