Tim's blag

To content | To menu | To search

Tag - Python

Entries feed - Comments feed

Tuesday 20 December 2011

English Spelling

I found a rather brilliant British English poem and added the pronunciation next to it in IPA. I used Apple's Dictionary Service available in Python to parse all words and extract the pronunciation.

English Spelling screenshot

Thursday 17 November 2011

Python meets C: Cython

This bit is about optimizing code Python code using something that's closer to the metal (i.e. a CPU/GPU). Before you do anything about optimization, realize this:

Early Optimization is the root of all evil - Donald Knuth

If you still think you need to optimize your code, read on.

Continue reading...

Monday 7 November 2011

Analyse written text

Earlier I wrote a simple script that checks a text for structural integrity, making sure there are no words close together etc. I converted this script to Python, dubbed it metacheck.py and I present the new and improved version here!

Continue reading...

Python introduction 101

I recently gave a introductory presentation to Python to some colleagues. The topics covered include the basic language syntax of Python, available data types, some words about memory management and some sightly more advanced Python features like list comprehension and array slicing. Click further to read more details.

Continue reading...

Sunday 6 November 2011

iPhone 3GS battery usage

I had some trouble with my iPhone 3GS where the standby time and usage time was the same, so I started monitoring the battery usage. I solved the intial problem (fully resetting the whole phone helps) but thought it'd be interesting to continue monitoring battery usage and analyse the results. The results are presented below.

Continue reading...

Monday 27 June 2011

PyAna Python library

PyAna is a Python library for reading and writing (Rice-compressed (pdf)) ANA files. I wrote this when I was working with ANA files a lot, but this is no longer the case. Therefore, I am not maintaining the code any longer. The current version seems to be quite stable (no known memory-leaks), albeit a bit rough on the edges.

The library wraps some ancient C routines into a NumPy module. See PyAna @ github for more details. I wrote this with help from this NumPy recipe and the NumPy book.

Besides a useful library, this can also be used as boilerplate code if you want to write your own Numpy module.