Thursday, November 22, 2007

Climate changes and market forces

This post is a response to a (German) radio cast "Das verheizte Klima" (MP3). Looking 25 years into the future, it predicts that everything will be much the same as it is now, except that gas will cost 12 Euros per liter (a 8x increase over current German prices), that the North Pole will be permanently free of ice and that a trans-European power grid to connect wind parks all around Europe will be established. However, the interviewed experts, especially Claudia Kemfert from the German Institute for Economic Research, are very skeptical about any big change, arguing that any technology (in power production and transportation) will take at least 20 years of development before it becomes widespread on the market.

For example, Prof. Kemfert thinks that in 25 years rationing of fuel will be widespread throughout Europe, so that vital industries (the medical and plastics industry are mentioned) can use the oil. I think this underestimates the power of the market:

Energy prices will increase in the future, as the demand in the developing countries grows quickly. However, this will be followed by an increase in supply of fuels, because it becomes economic to use sources that are too expensive to exploit today. So this won't save the world.

However, willing governments can push the markets into a more environmentally friendly direction with a carbon tax that assigns an equal price for every unit of carbon dioxide. (Of course, one needs to make sure that a carbon tax in one country doesn't just shift the emissions across the border.) Such a tax only increases the cost for the consumer, but not the income of the supplier of fossil fuels, hence supply doesn't increase.

Thus follows the good thing for the climate: demand will decrease in response to a carbon tax! On one hand, conservation efforts and increases in efficiency have greater returns on investment. On the other hand, renewable energy sources such as solar and wind power are favored and will be adopted more quickly.

So, I predict that if gas prices increase eight-fold in the next twenty years, we'll quickly see plug-in hybrids and electric cars. People will still have fun with their cars, but the necessary power can come from renewable sources.

Where will this energy come from? There are plenty of possible sources.

Thursday, October 18, 2007

Max Planck Society cancels license agreement with Springer reports that the Max Planck Society, a major German research organization with more than 80 institutes, canceled the negotiations for a renewal of a license agreement for online access to SpringerLink with the end of the year. This means that almost 20,000 scientists will not have access to anything published in 1200 journals after the end of the year. (The archive will still be available.)

The reason that the talks failed is that Springer wanted twice the amount the Max Planck Society considered as justifiable, although they say even the justifiable amount was higher than what other publishers charge.

The Max Planck Society is one of the main proponents of the Berlin Declaration on Open Access to Knowledge in the Sciences and Humanities. It is the first major research organization that I'm aware of that breaks free of the stranglehold of the publishing industry. The question is, of course: what will happen next? Do they stay firm and begin to cause a shift towards Open Access journals? Or will Springer go down with the price just enough that the contract will be renewed?

Update: now reports this story in English as well.

Update 2: Well, they have reached an agreement on January 29, 2008.

Thursday, October 11, 2007

Sending Growl notifications from Python scripts

Working in bioinformatics can be seen as an infinite loop of: think, write a script, run script, analyze data. While I work on a Mac, most of the scripts run on a Linux server, and it would be nice to know when a script is done so that I can look at the data. In order to be notified when a script finishes, I now use Growl (see picture).

I downloaded and wrote a quick and dirty wrapper package around it:

#!/usr/bin/env python

from netgrowl import *
import sys

def growlNotify(title = "Script Finished", message = ""):

addr = ("", GROWL_UDP_PORT)
s = socket(AF_INET,SOCK_DGRAM)
# p = GrowlRegistrationPacket(application="Network Demo", password="?")
# p.addNotification("Script Finished", enabled=True)
# s.sendto(p.payload(), addr)

if not message:
message = sys.argv[0]

p = GrowlNotificationPacket(application="Network Demo",
notification="Script Finished", title=title,
description=message, priority=1,
sticky=True, password="?")

if __name__ == '__main__':

The registration is hidden in a comment, you only need to do that the very first time. So, in my scripts, I just insert the following right before the end of the script (using a Textmate snippet to save typing).

import growlnotify

Friday, October 5, 2007

Feed for NAR Database Issue papers

The NAR Database Issue papers are trickling in. I created a Yahoo! Pipe (with an RSS feed) of the advance access papers (filtered out from the full list of articles). Enjoy.

Wednesday, August 29, 2007

Use case for decorators


Decorators were introduced in Python 2.4 but remain a somewhat obscure feature of the language. A decorator essentially is a function that you apply to another function, replacing it with the return value of the decorator function:
def d(f):

def g():
This is equivalent to:
def d(f):

def g():

g = d(g)
More background here.

The use case

As part of my research project, I’m testing several ways to explain side effects of drugs. So I made a class that loads all the relevant data into memory and that contains methods to fit the data. (I thought about creating subclasses replacing the “fit” method of the base class. However, the data that’s being loaded into memory is the same for all instances of the subclasses, so I don’t want to reload it every time. Thus, I put multiple methods into the base class.)
At first, I used introspection to identify the relevant functions by name (using dir) and then calling them. This worked fine, but it doesn’t make it particularly easy to disable some of the functions. Enter decorators: I wrote a decorator that takes a function, puts it into a list (which is a global variable) and returns the function unchanged. To call every fitting function, I can just iterate over the list. If I want to disable a function, I just comment out one line. Yay!

Another neat trick is that the docstring of each function is accessible as an attribute, so that each fit comes together with a description.

Tuesday, August 28, 2007

Running in circles

You know you're looking for an obscure topic when your own entry in CiteULike comes up on the second page or so of the Google results.

Luckily, I saw my name in the URL and so I didn't get frightened by a Woozle.