Parallel python: destroying job_servers

Remember to destroy job servers after they are done. My nice animation generator crashed sometime over the weekend with the following death rattle: Traceback (most recent call last): File “animate_array_job.py”, line 168, in tscale = tscale, dpi = dpi) File “animate_array_job.py”, line 92, in process_file job_server = pp.Server(ppservers=ppservers) File “/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pp.py”, line 336, in __init__ self.set_ncpus(ncpus)… Read More Parallel python: destroying job_servers

Parallel python

Among the many libraries for parallel processing in python I chose what seemed to have one of the simpler interfaces – Parallel Python. There is one trick that is not apparent from the docs: The function you call has to be ‘self sufficient’. You basically have to write up the function you call as if… Read More Parallel python

Only on wikipedia:

Reading a paper about neural circuitry. Came across the word ‘resonant circuitry’. Looked it up on wikipedia. Knew it had to do with band pass circuitry. Looked that up on wikipedia. Read in that entry that Thomas Pynchon claimed the character Kilroy was based on the circuit diagram for a band pass filter. You be… Read More Only on wikipedia:

Efficient pickling in python

Use the highest protocol you have available – which will usually be binary. So as example: import cPickleimport pylabz = pylab.random((10,10))z ndarray 10×10: 100 elems, type `float64`, 800 byteslen(cPickle.dumps(z)) -> 2371len(cPickle.dumps(z, cPickle.HIGHEST_PROTOCOL)) -> 934z = pylab.random((50,50))z ndarray 50×50: 2500 elems, type `float64`, 20000 byteslen(cPickle.dumps(z)) -> 55586len(cPickle.dumps(z, cPickle.HIGHEST_PROTOCOL)) -> 20134 For some reason, I thought the… Read More Efficient pickling in python

3D in matplotlib

One of the frustrating things about matplotlib is its lack of 3D plotting. If matplotlib were a mediocre library it wouldn’ hurt. But it is a GREAT library and produces really good looking plots. So the lack of 3D plotting sometimes makes me want to go out and strangle somebody. There has however always been… Read More 3D in matplotlib

Drawing circles using matplotlib

Use the pylab.Circle command import pylab #Imports matplotlib and a host of other useful modulescir1 = pylab.Circle((0,0), radius=0.75, fc=’y’) #Creates a patch that looks like a circle (fc= face color)cir2 = pylab.Circle((.5,.5), radius=0.25, alpha =.2, fc=’b’) #Repeat (alpha=.2 means make it very translucent)ax = pylab.axes(aspect=1) #Creates empty axes (aspect=1 means scale things so that circles… Read More Drawing circles using matplotlib

Modifying a firefox plugin

I dislike the indistinct icons in the cookie manager plugin CSlite. In Firefox/extensions/{00084897-021a-4361-8423-083407a033e0}/ (the directory for this particular extension) we find chrome/cookiesafe.jar From a hint in a thread here, we learn that the .jar file is just a .zip file, and we can extract that to find skin/classic/cookiesafe and a whole bunch of .gifs there.… Read More Modifying a firefox plugin

CS Lite

I was using the Permit Cookies extension for firefox, but it hasn’t been updated for a few cycles of firefox updates. It works fine, but I started to look for something else. I found CS lite which has a more convenient interface (a popup menu from the status bar). The only gripe I have so… Read More CS Lite