Blog
Matplotlib colormaps with a surface plot
May 02 2013
Today I was working on surface plots and wanted to know what different colormaps in Matplotlib look like. Luckily it was easy to find out and I decided to post results here in case someone else finds it useful.
more »
Tags:
Python, Matplotlib, SciPy
Publish Python Scripts with Pweave
Apr 19 2013
I have been working on Pweave lately and one new feature for the next release is a new input format and a HTML template that allows easy publishing of regular python scripts. The feature is similar to MATLAB’s publish and the input format for doc and code chunks has been adopted from knitr’s spin. You can use the new format instead of the old noweb format for any document, one advantage is that you can also run the code without Pweave as a normal Python script which makes debugging easier.
more »
Tags:
Python, Pweave
Linear Regression Models with Python
Apr 19 2013
I have been looking into using Python for basic statistical analyses lately and I decided to write a short example about fitting linear regression models using statsmodels-library.
more »
Tags:
Python, Pweave
Create odf, pdf and html report from a single Sweave document
Mar 25 2010
A lot of us know about Sweave and Latex and they work very well in creating elegant dynamic reports from R computation. However, sometimes we would like to also produce a word processing document for a colleague or a html version of the same report. Now there are tools for producing these like odfWeave. But wouldn’t it be nice to get all of the output formats from the source document with same mark up?
more »
Tags:
R, Sweave
Pweave - Sweave for Python
Mar 03 2010
After looking into different options for literate programming with Python I ended up writing my own tool and call it Pweave. I have tried to implement the functionality of Sweave, that I really like and use for my R projects. Pweave is a single python script that is able to weave a python code between <<>>=
and @
blocks and include the results in the document. It can be used with reStructured text and Latex documents.
more »
Tags:
Python, Pweave, Sweave
Python in Sweave document
Feb 09 2010
Lately I have been using a lot of Python for signal processing and I quite like SciPy. However, I have been missing something like Sweave, which is great literate programming environment for R. Today I managed to look a bit more into it and found this hack on how to use Python code in Sweave document by Romain Francois. However, I wanted to be able to catch the input as well as output so I made a small changes to his Sweave Driver.
more »
Tags:
Python, Sweave, R
FIR filter design with Python and SciPy
Jan 18 2010
SciPy really has good capabilities for DSP, but the filter design functions lack good examples. A while back I wrote about IIR filter design with SciPy. Today I’m going to implement lowpass, highpass and bandpass example for FIR filters. We use the same functions (mfreqz and impz, shown in the end of this post as well) as in the previous post to get the frequency, phase, impulse and step responses. You can download this example along with the functions here FIR_design.py. To begin with we’ll import pylab and scipy.signal:
more »
Tags:
SciPy, Python, DSP
ESS on Mac OS X
Nov 25 2009
One of the search terms that bring people frequently to my site is “install ESS on Mac OS X” or something like that. As it turns out installing ESS on OS X is really easy, but Google search does not really bring up good instructions. There are at least two easy options:
more »
Tags:
ESS, R
PyQt 4.6.2 with Snow Leopard
Nov 24 2009
This is again more of a note to myself than a blog post… After upgrading my Mac OS X to Snow Leopard I’ve started to use the default 64bit Python 2.61 and consequently PyQt stopped working. I managed to get it back by compiling from source packages, with the instructions I found from this Finnish blog.
more »
Tags:
Mac, Python, PyQt
MATLAB style stem plot with R
Sep 11 2009
Recently I wanted to plot an impulse response function with R and missed the MATLAB style stem plot for doing it. I couldn’t find an R function for it with a quick Google search so I made my own. So here is the function and a small example:
more »
Tags:
R
R 64 bit on Mac OSX with ESS
Aug 06 2009
The current R version comes also with a 64-bit version so its not necessary to compile it from source anymore, but you do need to tell ESS how to use the 64bit version
more »
Tags:
R, Mac, ESS
IIR filter design with Python and SciPy
May 11 2009
I have had some trouble in IIR filter design with SciPy, e.g. getting the filter phase response and impulse response. After some searching and looking at different examples e.g. here I managed to get what I wanted. So here is a simple example on how to make a filter with Scipy, I hope it helps someone else. The example requires Scipy+Numpy+matplolib. You can also download the entire code: elliptic_bandpass.py
more »
Tags:
SciPy, Python, DSP