Robin's Blog

Author Archive

Convolution in python – which function to use?

Slightly boringly, this very similar to my last post – but it’s also something useful that you may want to know, and that I’ll probably forget if I don’t write it down somewhere. Basically, scipy.ndimage.filters.convolve is about twice as fast as scipy.signal.convolve2d. I run convolutions a lot on satellite images, and Landsat images are around 8000 […]

Previously Unpublicised Code: manifestoclouds

This entry in my series covers manifestoclouds: my code for producing word clouds from political party manifestos. This is very simple, generic code that just ties together a few libraries – and is by no means restricted to just political party manifestos – but I keep it around because I find it useful occasionally. I use […]

Bokeh plots with DataFrame-based tooltips

Recently I’ve been investigating a key dataset in my research, and really seeking to understand what is causing the patterns that I see. I realised that it would be really useful if I could plot an interactive scatter plot in Python, and then hover over points to find out further information in them. Putting this into […]

Calculating percentiles in Python – use numpy not scipy!

This is just a brief public service announcement reporting something that I’ve just found: np.percentile is a lot faster than scipy.stats.scoreatpercentile – almost an order of magnitude faster in some cases. Someone recently asked me why on earth I was using scoreatpercentile anyway – and it turns out that np.percentile was only added in numpy 1.7, which […]

van Heuklon ozone model now available on PyPI and conda

I was going to post this as one of my ‘previously unpublicised code’ posts, but that would be stretching the title a bit, as I have previously blogged about my implementation of the van Heuklon (1979) ozone model. This is just a brief update (in the spirit of my ‘previously unpublicised code’ posts) to say that […]

Happy 7th Birthday Blog!

No, I’m not seven years old (even though I may act like it sometimes)…but this blog is! My first blog post was on the 11th November 2008 – a rather philosophical post entitled Wisdom and Knowledge – and so on this anniversary I thought I’d look at my blog over the years, the number of […]

Orthogonal Distance Regression in Python

Linear regression is often used to estimate the relationship between two variables – basically by drawing the ‘line of best fit’ on a graph. The mathematical method that is used for this is known as Least Squares, and aims to minimise the sum of the squared error for each point. The key question here is how do […]

Previously Unpublicised Code: RTWIDL

When looking through my profile on Github recently, I realised that I had over fifty repositories – and a number of these weren’t really used much by me anymore, but probably contained useful code that no-one really knows about! So, I’m going to write a series of posts giving brief descriptions of the code and […]

Blue Marble: From Apollo 17 to DSCOVR, an EPIC journey

NASA image ID AS17-148-22727 is famous. Although you may not recognise the number, you will almost certainly recognise the image: This was taken by NASA Apollo astronauts on the 7th December 1972, while the Apollo 17 mission was on its way to the moon. It has become one of the most famous photographs ever taken, and has […]