10

Just read a presentation about using Python for Scientific Computing. I am currently using MATLAB (student license FTW, which will expire when I graduate soon).

So I was wondering how matured SciPy and NumPy are with respect to relying on them for all the Scientific Computing I need to do. The advantage is that it's free. I am mainly focused on Signal Processing, Audio, Acoustics kind of computing.

I can imagine that the NumPy and SciPy projects are evolving with respect to the support for more complex techniques. So, how fast are they evolving, are there large communities behind them?

Finally, are there other solutions?

4

5 Answers 5

5

In short: Python is a much better language than Matlab, and has more complete general-language features, but Matlab has a more complete set of scientific computing tools than Python.

Octave also has more complete scientific tools than Python, and is a closer language to Matlab if you're already familiar with it, but also shares the language's flaws. Octave and SciPy are free, Matlab is very not free.

I am mainly focused on Signal Processing, Audio, Acoustics kind of computing.

Me too, and I've found SciPy lacking. Some examples:

  • Documentation is poor or non-existent for many functions
  • Filter design tools convert to transfer function representation internally, so higher-order filters suffer from numerical error problems. (fixed)
  • Other functions like freqs only accept tf representation, which, again, causes numerical error problems.
  • Doesn't support filters in second-order-sections representation
  • FFTs are not as fast
  • Lots of functions from Octave/Matlab don't exist yet in SciPy, and can't be directly translated from Octave because of GPL vs BSD licensing
  • ...

But I still prefer SciPy, because the language is much nicer to use, and does most of what I need. It's free and open-source, and actively developed, and you can contribute easily just by pushing "Edit" on Github. Since I'm primarily using this to learn and practice signal processing, I don't consider it a problem that I have to contribute documentation (old vs new) or improvements myself. That's the sort of thing I want to learn anyway.

Also, while in the process of trying to fix some of these things, I've uncovered some flaws in Matlab's filter design tools: 1 2 So open-source development with lots of test cases has its advantages, too.

8

You should look into Sage; it is the open source alternative to Matlab, Mathematica and others. The core language is python, so you can use all python libraries natively, and it has bindings for most free and non-free mathematical software so you can use Matlab, Mathematica and others inside it. It has a lot of support from within the mathematical community and its lead developer is very highly thought of and committed to the project.

2
  • 1
    Sage is just a wrapper for lots of other tools. Unless you're doing advanced mathematics, you're probably better off using those tools directly.
    – endolith
    May 14, 2013 at 13:54
  • (I was referring to things like andrejv.github.io/wxmaxima rather than using maxima through sage, which is much clunkier)
    – endolith
    Apr 18, 2014 at 2:06
5

Under the "Other Solutions" topic: Have a look, also, at Octave and SciLab. These are usually close enough to Matlab to make translation of scripts fairly painless.

However, moving to Python seems like a good idea, too! There seems to be some work on integrating with Python in SciLab.

3
  • You didn't mention their price, and sometimes it is quite important. Other then that, their capabilities are quite good. May 14, 2013 at 18:37
  • @BЈовић: The price of Octave and SciLab? Free!
    – Peter K.
    May 15, 2013 at 7:35
  • 1
    @PeterK. I know they are free :) You didn't mention it in the answer. May 15, 2013 at 9:37
3

Also under "other solutions":

I'm very much on the Python-for-science bandwagon, but my free/open source "I don't have a Matlab license" substitute often ends up being R instead.

I find it somewhat frustrating syntax-wise (indices start at 1? assignment is done "varname <- value"? Come on ...), but it is fairly ubiquitous at least in my scientific discipline, ecology, where scientists may not be generally programming-literate (& hence bewildered when I send them a Python module), but do use Matlab/R-type statistical packages - I have ported Matlab code to R for signal processing-type applications (not personally for audio in specific, but I do know bird researchers using it for that).

3
  • Interesting.. Good to know!! :)
    – notthetup
    May 11, 2011 at 6:56
  • @ntt - if this is at all interesting/useful, you mind giving it an upvote? Thanks :)
    – Beekguk
    May 11, 2011 at 19:39
  • Yup!! hahaha.. Hard to choose an 'answer'.. But thanks for all the feedback.. :)
    – notthetup
    May 12, 2011 at 15:56
1

Python with SciPy/NumPy is a pretty mature platform for scientific computing.

The one place where arguably it's pretty weak is upper level statistics - I haven't been terribly impressed with the offerings in that area, and despite my deep love for Python have not adopted it as a statistics workbench at all. The good news is you can get around this by calling R from Python.

With the addition of R (or another statistics language - the only other one I'd consider unless you really had a specific requirement would be SAS, and that's pricey), the combination of the two is a very solid, open-source and actively developing platform. R does work a little bit differently than most programming languages, because of a slightly different philosophy. It's designed for how statisticians think, rather than programmers. Hence things like indices starting at one - that's often because that's also "Subject 1", "ID0001" etc.

Not the answer you're looking for? Browse other questions tagged or ask your own question.