Sunday, June 30, 2013

Google Reader is dead!

Google has finally pulled the plug on the Reader. It is time to move on another feed reader. In the meantime,  here is the last screenshot from the Trends page:

More than 45k read items since October 2008. Looking forward 450k more to read :)

Thanks to Mihai Parparita's Python scripts I archived all there is to archive from the Reader.

Happy news reading!!!

Wednesday, November 7, 2012

Issues with GDL Python module

1-) Importing GDL segfaults in IPython

$ ii # this is alias for ipython --pylab
Python 2.7, IPython

I1 import GDL

I2 Segmentation fault (core dumped)

however, works fine in Python shell

>>> import GDL
>>> GDL.findgen(5)

>>> GDL.function('findgen',5)
array([ 0.,  1.,  2.,  3.,  4.], dtype=float32)

possibly readline module issue? Interestingly, works fine in Spyder's IPython console.

2-) Source compiled (with --enable-python_module option) GDL Python module fails to work

 >>> import GDL
Traceback (most recent call last):
  File "", line 1, in
ImportError: ./ invalid ELF header

possibly, due to wrong lib arch use, during compilation?

3-) GDL's dindgen yields wrong result while accessed through its Python module

>>> GDL.function('dindgen',10)
array([  0.00000000e+000,   1.00000000e+000,   2.00000000e+000,
         3.00000000e+000,   4.00000000e+000,   0.00000000e+000,
         5.92878775e-323,   3.30571061e-313,   6.94380683e-310,

Posted this issue on dindgen with GDL python module

Calling IDL, GDL, and FL from Python

Thanks to Anthony Smith's pIDLy module, accessing IDL, and its clones GDL and FL from within Python becomes really easy. 

Launch an IPython session, then typing these example lines to see pidly in action:

I1 import pidly
I2 idl = pidly.IDL()
I3 fl = pidly.IDL('fl', idl_prompt='FL> ')
I4 gdl = pidly.IDL('gdl', idl_prompt='GDL> ')
I5 idl.findgen(10)
O5 array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.], dtype=float32)
I6 fl.findgen(10)
O6 array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.], dtype=float32)
I7 gdl.findgen(10)
O7 array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.], dtype=float32)
I8 np.arange(10, dtype='float32')
O8 array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.], dtype=float32)

Testing these with:

I2 pidly.__version__
O2 '0.2.4+'

I3 np.__version__
O3 ''

$ idl
IDL Version 8.1 (linux x86_64 m64). (c) 2011, ITT Visual Information Solutions

$ gdl    # the version that ships with Fedora 16
GDL - GNU Data Language, Version 0.9.2

$ fl      # latest development snapshot (10/Oct/2012)
Fawlty Language 0.79.18 (linux amd64 m64) Copyright (c) 2000-2012

Example access to an IDL procedure:

I5'cgplot', np.sin(np.linspace(0, 6*np.pi, 1000)))

I6'iplot', np.sin(np.linspace(0, 6*np.pi, 1000)))

For more information, just read the quick usage guide on pidly's web-site, or clone the source from

Worldcloud for ccnworks

Here is a worldcloud created for my code repository on:

First get the commit message history into a text file (the last commit is r287):

svn log >> test.txt

Then with a bit of VIM trick and manual step, remove unwanted lines:

sort u

Select of all the text, and import into

Tadaaa, here comes the result :)

Indeed, we are data scientists here in atmospheric science!

Alternative wordcloud implementation comes from Andreas Mueller. I saw his A Wordcloud in Python titled posting via Planet SciPy. In order to run his I needed to change unsigned int[:,:] integral_image -> unsigned long[:,:] integral_image in query_integral_image.pyx to get past 'ValueError: Buffer dtype mismatch, expected 'unsigned int' but got 'unsigned long''.

Then feeding the same log data I get the following image, which is nicer looking than the wordle's image :)

Saturday, February 11, 2012

Python videos

# from AMS

# PyCon10 Videos

# various 

Various open-source videos

What's under the hat? A sneak peek at Fedora 13 by Jesse Keating
Git er done with GIT by Jesse Keating

Keynote: MeeGo: A Free & Standard Linux OS for the Mobile Industry

Google I/O 2009 - The Myth of the Genius Programmer
Google I/O 2009 - Do You Believe in the Users?
Google I/O 2008 - Project Hosting on Google Code
Google I/O 2008 - Open Source Projects and Poisonous People
Google I/O 2008 - Open Source is Magic
What's In It for Me? Benefits from Open Sourcing Code
Learning from

Paul Graham - Great Hackers (2004)
Paul Graham - Open Source Software Development (2005)

# resources
Euroscipy 2010 tutorials
RCE 48: NumPy
The Pragmatic Bookshelf | List of Tips
Code Like a Pythonista: Idiomatic Python
NumPy MedKit by Stéfan van der Walt (.tar.gz)
PEP 3099 -- Things that will Not Change in Python 3000
Building Skills in Python

Monday, December 26, 2011

NumPy 1.5 Beginner's Guide review

This new NumPy book provides an easy start to NumPy for those who want to churn numbers in Python programming language, whether you don't have much programming background or you are switching from your favorite language. The author of the book uses quite a friendly tone throughout the book. Most of the important aspects of NumPy is well covered with well explained examples. The examples provided are step by step explained, starting from the basic array/matrix creation to more complex tasks like signal analysis and linear algebra related calculations.

To get best out of this book, it is recommended that you would try out the examples and challenge yourself with the exercises given in have a go sections of the book. If you are feeling lazy for some reason, you can get the source code from the book's page. I finished perusing the book in about a week (having a few years of NumPy experience has definitely role in this). For me reading and understanding through stock market related examples were a bit boring, but if you are in to financial business you might enjoy putting NumPy in your toolstack with the help of this book. Notably, besides the basic NumPy beginners chapters, the book extends into basic Matplotlib and SciPy lands. A lot of examples use Matplotlib to create plots and better illustrate the operations at hand (e.g. curve fitting, statistical distributions) It is a bit surprising to see MaskedArray module didn't get any mention in the book. However, with the basics you gained, it should be fairly easy to start experimenting with masked array functions of NumPy.

Overall, if you are looking for a book to get started in NumPy in about 200 pages, you might give this one a chance. It is available in both print and electronic formats. Further on, you can try their advanced matplotlib and and Sage books, if you are willing to enhance your scientific Python skills.

Final Note: I received a review copy from the publisher. Thanks to Packt publishing for their contributions to open-source literature and providing me a free copy of the book.