Bloxors

Bloxors is a great puzzle game. Play it between neural recordings, behavioral training sessions, when you take a break from writing that paper and when the reviewers make you mad. StrategyThe fun in bloxors comes from the fact that your footprint (how many floor blocks you block occupies) varies with the moves you make. You… Read More Bloxors

Opensource Workflow

My efforts to shift my work flow to rely more on open source tools has been going relatively smoothly. My current work flow is Create figures using python and pylab (matplotlib) Save the figures in svg format from pylab Import the svg figures into inkscape and annotate them (eqtexsvg to insert latex equations) Save the… Read More Opensource Workflow

Using PCA in MDP

I found mdp on sourceforge. I needed to do PCA for some of my simulations. The mdp.pca function is easy to handle. The input is a m x n matrix, n is the dimension of the space, and m are the observations (rows = observations, cols = dimensions. The doc string is confused as to… Read More Using PCA in MDP

Custom colormaps

From an excellent post here , we have a clear explanation of how to make custom colormaps. Under matplotlib there is a colors module which has a method called LinearSegmentedColormap that can create a colormap for your use. First you need to make a color dictionary which looks like this: cdict = {‘red’ : ((0.,… Read More Custom colormaps

String formatting

String formatting is weird in Python, but rumor has it that Python 3000 will break backwards compatibility and fix that. Currently (Python 2.5) you do this x = ‘Rabindranath Tagore’y = 1861z = 80.25print ‘%s was born in %d and lived %2.2f years’ %(x,y,z) Weird, ain’t it? Incidentally, python has no ‘num2str’ like matlab, so… Read More String formatting

Latex and SVG export

Pylab will render LaTeX equations (yeehah!). But there are glitches when the figures are saved to svg. First, you have to take the BaKoMa fonts (TrueType version of the Computer Modern fonts) located in the “matplotlib/mpl-data” dir (the cm*.ttf files) and install them. Now you can see the glyphs. However, the subscripts and superscripts are… Read More Latex and SVG export

Lists

In MATLAB when ever I had to make arrays of inhomogeneous data I would use arrays of structs. In Python ‘Lists’ can be used for that. Lists are indexed containers for any mixture of data. So for instance, I need to store event times for a series of nodes. The nodes go from 0..N-1 and… Read More Lists