Category Archives: Python

Thresholding numpy array, well sort of

Here is a test case >>> import numpy as np >>> a = np.array( [ 0.0, 1, 2, 0.2, 0.0, 0.0, 2, 3] ) I want to turn all non-zero elements of this array to 1. I can do it … Continue reading

Posted in Python, Uncategorized | Tagged , | Leave a comment

Comparision of various matplotlib/pylab plotting styles, version-1.(4, 5)

This post explores different matplotlib styles for plotting various type of plots. Continue reading

Posted in Python | Tagged , , , | Leave a comment

Matplotlib Animation class, how to save the video with different background

This is what you have to do when saving the video: ani_.save(‘output.avi’, fps=args_[‘fps’], savefig_kwargs = { ‘transparent’ : True , ‘facecolor’ : ‘black’  } Argument savefig_kwargs is the key parameter. It is applied to savefig which is called every time … Continue reading

Posted in Python, Uncategorized | Tagged , | Leave a comment

Cython documentation in PDF

cython-20-tutorial.pdf Build from their github repository on May 10, 2014.

Posted in Python | Leave a comment

Search files on linux containing a given pattern

The linux utility grep is great. But somehow I do not like it. Too much to remember and regex format sucks. I wrote a python script which does something similar. This is how one should use this script ./sniff.py path … Continue reading

Posted in NoGuiNoMouseNoProblem, Python | Tagged

The game of “Bulls and Cows” : A python implementation

Recently, a friend taught me a simple game of bulls and cows. This game goes like this. There are two players, A and B. A thinks of a 4-letter word and asks B to guess it. Assume that A thought … Continue reading

Posted in Games and Puzzles, Python | Tagged , | Leave a comment

A wordpress client to post and update blogs from command line

There is a fascinating python library which uses xmlrpc to communicate with WordPress. Unfortunately it does not support http_proxies yet but he has promised to support it in next release. Till then, one can set-up transparent proxies [See my repository … Continue reading

Posted in NoGuiNoMouseNoProblem, Python, Scripts | Tagged