More colours than the rainbow

500px-CIE1931xy_blank.svg
This post is about making the bridge between how a physicist understands colour, and something a bit more useful.

Light is a collection of electromagnetic waves; for a physicist the most important property of a wave is its wavelength, its “size”. The wavelengths of visible light fall roughly in the range 1/1000 of a millimetre to 1/2000 of a millimetre. (1/1000 of a millimetre is a micron). Blue light has a shorter wavelength than red light.

Things have colour either because they generate light or because of the way they interact with light that falls upon them. The light we see is made of many different wavelengths, the visible spectrum. Each wavelength has a colour, and the colour we perceive is a result of adding all of these colours together.

The diagram to the right summarises this: it’s called a chromaticity diagram, the numbers around the edge are wavelengths in nanometres (a millionths of a millimetre), pure, single wavelength light falls on this line; any point inside the line is formed from the mixture of wavelengths. The line represents “all the colours of the rainbow”; colours inside the line are not in the rainbow. The chromaticity diagram is the “periodic table” for colour scientists, it’s iconic and it summarises the world of colour.
This chromaticity diagram is just a slice through a volume, we could draw another one a little bit dimmer, and a little bit dimmer than that until we reached black.

How do we get to this diagram? The central issue to understanding perceived colour is that although the light in the environment comes as a mixture of a multitude of wavelengths, our eyes are limited by the light sensitive cells they contain, known as “cones”. In humans cones come in three types, which are sensitive in three different ranges of the spectrum. Roughly there are red-, blue- and green sensitive cones. So the eye gives just three readings in terms of colour description. The chromaticity diagram comes from a calculation trying to predict these three values and combining them to fit on a flat page (which only gives you two dimensions to play with).

Some other animals don’t have three sorts of cones. Birds, for example, have four – this is known as tetrachromacy which sounds to me like some sort of wizardry involving chairs (I’m reading Terry Pratchett at the moment). Birds have an extra type of cone in the ultra-violet part of the spectrum – so they are sensitive to wavelengths which we are not. Most mammals are dichromatic, but other primates, like humans, are also trichromatic. Dichromatic animals will be able to perceive a smaller range of colours than us. The evolutionary implication here is that earlier mammals lost some colour sensing ability, possibly for a gain in low light sensitivity but some mammals subsequently regained the ability.

The chromaticity diagram is still something of a physicists play-thing, it’s useful for doing calculations. There are other ways of describing colour which are related to human perception, they are developments based on the first steps used in constructing the chromaticity diagram. The aim of these methods is to similar numbers to colours that look similar; make those numbers reasonably easy to explain from a conceptual standpoint and try to give numbers twice as big to colours that are twice as bright. My favoured system in this respect is the CIE LAB system. The colours are expressed as three numbers L, a and b: L tells you something about overall brightness, a tells you the point on a scale between red and green and b tells you a point on the scale between yellow and blue.

But all of this is a bit of a fraud, because actually the colours you’re seeing on your monitor aren’t the real colours I’m trying to show you. The problem is that display devices contain red, green and blue elements but they don’t fall anywhere near the extremes of the chromaticity diagram and we can only get colours inside the the triangle defined by the red, green and blue elements in the monitor. A typical monitor gamut is shown here.

All this is based on the study of ideal colour stimuli (little square patches) on grey backgrounds, things get an awful lot more complicated if we start to worry about context. This is best illustrated with an image:

Adelson

As far as my computer is concerned squares A and B have the same colour, my brain and your brain are interpreting the scene context and giving them different colours. This is called Adelson’s checker shadow illusion.

“Intimidating equations”

Taking lessons from Goldacregate, I’ve removed all the rant and sarcasm from this post.
In this article in today’s Observer, we’re advised that this:
PA = gUG + min(k – g, (1 – g)(1 – r))
is an “intimidating” equation”. Only if we’re easily scared! It relates the profit gained from dynamically priced airline tickets to some variables. This equation really is a very straightforward it says:
“profit equals two things multiplied together plus the smallest of two other things”
Using a Greek letter (capital pi) with a superscript following is a bit of showmanship, P would have done perfectly well in this instance. You can read the paper from which it is drawn here. It is written in the style of a paper in pure mathematics, which might explain the intimidation of the journalists in question.
I wrote a little bit about maths a while back: maths is the language of much of the science I do, but its a convenient tool – it’s not an end in itself. The seed of “Goldacregate” was a query by a journalist as to how to read out an equation, the thing is that practitioners rarely speak equations out loud: they scribble them on the nearest available surface (often illegibly, and incorrectly) or fight endless battles with machines to get them into electronic documents. Furthermore there is a long and dishonourable history of public relations companies using essentially meaningless equations to promote products and services.
For non-users of equations they are simply a cloak, a cloud of chaff thrown up to hide the truth beneath. For users, they are a compact and exact way of writing down the truth.
The next time you see an equation, don’t be scared beneath it there is something simple which can be said.
Unexpurgated version: Ah, bless, the economists are playing at being scientists by using an equation and the journalists have got the vapours at the impossible complexity of it all. Nasty equation: please, don’t hurt me.

100 days later: A Lib Dem view

I woke this morning to the sound of a bandwagon rolling past, grabbing my keyboard I jumped aboard. It is 100 days since the Coalition formed following the General Election. For people wedded to the decimal system of counting 100 is a nice round number, for programmers of a certain generation 128 is preferable. Perversely the Marquis de Sade chose 120 days, but I can’t wait 20 days.

As a member of the Liberal Democrats for 20 years, I thought my opinions on a 100 days of partly Liberal Democrat government might be interesting to at least a few people. You can see my previous political postings here, to get a bit more context.

Things I’m pleased about:
Pupil premium; a rising lower tax threshold; increased capital gains tax; Ken Clarke sounding like a liberal on prison policy, an end to ID cards and over-enthusiastic lawmaking for every occasion; some hope of constitutional reform both in the Lords and for general elections;  no changes to the married tax allowance;

I’m also pleased by the very existence of a coalition government, it seems far more healthy to me that government is composed of members from two parties representing a majority of voters in the country, rather than one party who through a quirk of the electoral system has scraped in with a majority of seats based on a minority of votes. Far better coalition than more opposition where our influence is minimal.

I see my vote as delegating my views to the Liberal Democrats based on their manifesto, if they were in government alone I’d expect them to attempt to implement the entire manifesto (even if I didn’t like all of it). In coalition I expect them to negotiate using that manifesto as a basis, the fact that the entire manifesto is not being implemented is a result of them not achieving an overall majority. The inability to implement the entire manifesto is a fact of electoral arithmetic.

Things I’m not so pleased about:
fatuous comparisons of civil servant pay with the Prime Ministers pay; ostentatious “dipping of hands in blood” following the Budget, at times it felt like the only people cabinet ministers defending it were Liberal Democrats; David Laws’ rapid exit from government; Trident – I’m not particularly anti-nuclear but now was the perfect time to get shot of a piece of Cold War willy-waving.

As far as the economy is concerned, I believe we’d be in approximately the same place as we are now regardless of which party was in government prior to the election. The logic of this is also that regardless of who would have won the election they would have ended up doing approximately the same thing now (or in the near future): cutting government spending fairly dramatically. Arguments about timing are largely political; economics, it seems to me, is a “science” too imprecise to tell us much about the future and the fervent calls for cuts now, or cuts later are largely political. There is some marginal argument about the scale of the cuts, but given a Labour government we would be facing cuts of broadly the same magnitude.

I suspect there is a lot of departmental spinning going on at the moment: they’ve been asked to make fairly large cuts and they’re leaking the ideas for cuts that they know will be politically the most unpalatable in order to give themselves some leverage for the spending review.

There’s much enthusiasm about the LibDem’s apparent problems in the polls, however they’re generally at levels comparable with the last 10 years or so (see the Guardian Datablog). They are only low if you compare them to the heady heights of the election campaign which were quite evidently wildly inaccurate – the only accurate poll was the exit poll. I suspect a LibDem party in coalition with Labour would find itself in very much the same position.

It’s worth highlighting again the inequity of first past the post system: plug the latest opinion poll into the BBC’s calculator: (Lab:37% Con: 37% LibDem: 18%) and you get (Lab: 336 Con: 244 LibDem: 42). Labour get a 92 seat advantage over the Tories for an identical percentage of the vote and they get  8 times the number of seats as the Liberal Democrats for twice the vote. The Electoral Reform Society did a report for “Conservative Action for Electoral Reform”, on this subject – interesting conclusion is that equalising constituency size doesn’t really address the problem.

After the General Election the Liberal Democrats had three options: one it seems was unworkable, one was simply lazy, we chose to do the other thing. The only principle the Liberal Democrats have given up is the principle of not being a party of government.

Journalists unable to cope with the conditional?

A short rant on the newspapers today. Is there something in the style guides that says either something must happen or something is not happening? I take as an example, this piece in the Observer:

In its first few months in government, the coalition has delivered one major housing reform after another – from plans to cut down on “garden-grabbing” to crackdowns on housing benefit and the unexpected announcement by the prime minister that council tenants would no longer be guaranteed a right to lifetime occupancy.

This (emphasised) statement is simply not correct. Or it’s only correct if you believe it’s an accurate reflection of this reply the prime minister made to a question at a PM Direct event:

At the moment we have a system very much where, if you get a council house or an affordable house, it is yours forever and in some cases people actually hand them down to their children. And actually it ought to be about need. Your need has got greater … and yet there isn’t really the opportunity to move.”

“There is a question mark about whether, in future, should we be asking, actually, when you are given a council home, is it for a fixed period, because maybe in five or 10 years you will be doing a different job and be better paid and you won’t need that home, you will be able to go into the private sector….

“So I think a more flexible system – that not everyone will support and will lead to quite a big argument… looking at a more flexible system, I think makes sense.

I’m a simple scientist not trained in the intricacies of the English language (particularly the apostrophe), but even I can tell the difference between asking a question and making a definite statement of policy. It seems important to me that events should be reported accurately and not simply re-worded to suit your prejudices. The article I quoted here is actually quite good, and interesting, but given this example of a deviation between what was said and what was written, how can I trust the rest of it?

*Preparation for this blog post hindered by @HappyMouffetard’s Tourette’s Syndrome breaking out whenever she hears the voice of David Cameron.

A piece of land

I am the under-gardener to The Inelegant Gardener, more specifically I am the under-allotmenteer. For those outside the UK, allotments are standard sized vegetable gardens enshrined in UK law. We took possession of our first half allotment plot on 1st October 2006.  I remember our visit to the colony to see the allotment; we’d taken our traditional Saturday morning wander around town when The Inelegant Gardener mentioned, apparently in passing, that she’d like to look at an allotment (or rather a half-plot). I was instantly wary of this idea, I remember watering and weeding on my dad’s allotment as a child, back breaking and boring work. But when I stood at the foot of the overgrown plot I was instantly converted. A strange feeling came over me, of land, food, honest toil and soil – it was like my own Soviet propaganda film. Here I could work the land and provide!

PA010065

The half-plot on possession, October 2006

But more was to come: walking back to the car some months later, after working on the half allotment, I pointed and laughed at the risible start someone had made on digging a neighbouring whole plot. A sheepish Inelegant Gardener admitted to being the owner of the risible start and a new whole plot. It turns out she was an aggressive territorial expansionist, albeit a pathetic digger. The Inelegant Gardener did her best “feeble female” look, and I agreed to dig the new allotment. A task I was to complete some 18 months later, almost exactly two years ago.CIMG0807

A risible start to the digging of the whole plot, April 2007

As under-gardener my principle tasks are digging and construction: sheds, paths, compost bins and the like. It’s rather satisfying work compared to my day job, which mostly concerns generating abstractions inside a computer. Allotment work produces tangible output: an hours digging produces a patch of turned soil and a bucket of roots. Construction produces sturdy, useful structures of which a man can be proud. As a result of this toil I am able to identify perennial weeds purely from their roots: dock, bindweed, nettles, couch grass, horsetails, ground elder. I sometimes worry that The Inelegant Gardener will pimp me out to other allotmenteers for digging work.

The Inelegant Gardener is still subject to unrealistic fancies, having directed me to spread about a ton of farmyard manure on the potato-patch-to-be she seemed to believe the worms would quickly incorporate it into the soil. Bollocks would they, not in two weeks, not without the aid of little squad of wormy JCBs! It was muggins wot’ dug in the manure. I still think potatoes are magic though, turning over the soil with a fork and white egg-shaped edible things appearing – it’s magic. More realistically the potatoes came out all manner of shapes and sizes, several years they suffered from blight.

For us allotmenteering is a bit of fun, if a crop fails it doesn’t matter. Seeing the blight-wilted potato-tops and unearthing the rotten, stinking tubers gives an insight into what it is to rely so closely on the vagaries of nature for your livelihood. Seasonality becomes much more obvious; despite being relatively clued up about agriculture in truth I had little sense of when what vegetables were in season. Now I know, and it’s cabbage for most of the winter. Currently in season are courgettes (bloody hundreds of them), carrots, sweetcorn, potatoes, mangetoute, French beans, raspberries, beetroot. It’s fair to say we haven’t entirely cracked planting appropriate quantities, to start with we had one or two exemplars of any particular vegetable per meal, now we have massive, short-lived gluts.

We achieved a crop on our second visit to the allotment or rather Henry, a fellow allotmenteer, gave us some produce to keep us interested. He has continued to provide advice ever since, but now we swap vegetables and fruit. When we started only a small fraction of the plots on our colony were in cultivation, and Henry seemed to be keeping the place alive. These days most of the site is cultivated, it’s a friendly sort of place – most people will stop to say a few words as they pass on their way to their own plots. I can do a passable impression of a someone who knows how to grown stuff, if interrogated.

Our other neighbour at the allotments keeps chickens, at one point they had free range across the whole site they would come and supervise digging, jumping into the trench at inopportune moments to pluck out a tasty grub. Nowadays they are behind chicken wire, but still come to the fence if you’re digging or weeding by them, making approving clucking noises. There is something very reassuring about this companionship.

These days the allotment is looking almost ship-shape, at least it does when we’ve caught up with all the weeds. I continue to be proud of my construction efforts.CIMG0844

New paths! June 2010