Follow the reluctant adventures in the life of a Welsh astrophysicist sent around the world for some reason, wherein I photograph potatoes and destroy galaxies in the name of science. And don't forget about my website,

Saturday, 30 April 2016

Who's Afraid Of The Big Bad Reviewer ?

Peer review is something I've talked about before from time to time, but apparently I'm not making myself clear. I don't know why, I use plain simple language, and it's not very hard to understand. But for the sake of having a go-to post, let me try and put things as briefly and as clearly as possible.

Peer review is not some forced, artificial method of enforcing dogma. It is an inherent and unavoidable part of the scientific method. It occurs at many different levels, from freewheeling discussions with colleagues, to the classical "some random experts read your paper" technique that is now synonymous with the term "peer review", right up to how other experts react when the findings are made public and/or the paper is published. While it's important to be aware that the journal-based peer review (JBPR) technique we all know and loathe today is a modern invention, it's also important to remember that science has never avoided some form of peer review entirely.

Skeptical inquiry demands that all ideas be subject to relentless attack, with a deliberate attempt to falsify them. The reasons we do this are really quite simple : we want to establish the truth, be that for old (apparently secure) ideas and new, novel ones. If an idea stands up to at least one expert trying to disprove it, it's probably worth exploring further en masse. If it can't, it almost certainly isn't. JBPR is a way of restricting access to potentially blind alleys before we get lost in them. In that sense, it is a fundamental part of the scientific process, not some forced product of ivory-tower academia.

Mind you I'd quite like to live in an ivory tower as long as it didn't hurt any elephants.
JBRP varies from journal to journal, but essentially it works like this. An author writes a paper and submits it for publication in a journal. The journal chooses at least one or two other scientists (usually recognized experts in the particular subject area) who decide if the paper be accepted, rejected, or re-reviewed after modifications. If the paper is rejected or modifications are requested, the author can argue their case both with the reviewers and/or the journal editor, who provides oversight to the process. Normally the editor is known to both the author and the reviewers, but the author won't normally know who the reviewers are. Ultimately the author can request another referee if the editor agrees, or even submit it to another journal.

Different journals have different policies, but the role of JBPR is* not necessarily to establish whether a result is either novel or interesting - a result which agrees with an existing finding is still valuable, albeit usually less interesting if it fits established models. Nor does a journal entry absolutely have to contain elaborate interpretation : it's entirely accepted, normal practise to publish papers which are nothing but catalogues of measurements. Sometimes that's literally all there is to it. Really. Honestly. I mean it, dammit.

* Or at least should.

Contrary to unpopular belief, it's fine to simply report results even if they fly in the face of accepted theory. Provided, that is, that you clearly explain how the experiment was done, how the measurements were taken, and don't go overboard with trying to explain the results. And of course the methods you use have to be rigorous : normally, saying, "we picked the data we liked best" (or reporting results which aren't statistically significant) will ensure a rejection letter.

If you're not a fan of JBPR, I implore you to think for a moment. What, exactly, is so unreasonable about asking someone to convince another expert that they have a publishable result if that doesn't even require any interpretation ?

JBRP is not supposed to be a method of proof or disproof. Absolute proof is very rare anyway, but widespread acceptance, which is much more common, almost never happens with the first publication of a result. For that to happen takes time - usually lots of time - for others to verify the findings. Alas this very simple guideline of waiting to see whether the wider community can confirm or deny the initial result is something which is almost entirely lost on the media, who think results are ludicrously black and white... but I digress.

They're also often very stupid.
Likewise, when a paper or proposal is rejected, that does not mean the result is disproven. It simply means it isn't good enough for a paper yet. In no way does that stop you from using other means of communication to the scientific world : conferences, proceedings, arXiv, social media, press releases, whatever. But the chances are that if you couldn't persuade one anonymous expert that you had something worth investigating, you should either abandon your research (sometimes things are just wrong, deal with it) or get better data before you try again.

You might legitimately wonder, why, if peer review doesn't actually disprove anything, scientists cry out for it like a flock of hungry seagulls who have just spotted a bunch of tourists eating bags of chips. The reasons are really very simple. Science is often an incredibly specialised process, and everyone makes mistakes - the reviewer is there both to criticize and to help. At least they are if they're doing their job properly.

Would that Beiber would be eaten by seagulls instead of this nice lady.
If you can convince someone who intimately understands the particular work you did, you're on much surer footing. You've reached a minimum level 0 standard worthy of further investigations : one of the few other people in the world who fully understands what you're doing is convinced you're not a crackpot, allowing others (who may not be so specialised) to have some (but by no means complete) confidence in what you've done. If you can't manage this, you're on very thin ice indeed, along with UFO believers and fans of Justin Beiber, probably. Remember, all you need to do is state your results and make it clear when you're speculating. You don't have to solve the entire mystery.

To be useful, JBPR has to be skeptical, as opposed to denial. Where a paper does present interpretation, attacking weak points is not supposed to mean ripping it to shreds : i.e. the authors should probably say, "we think this is more likely" rather than, "we now know what the answer is". The reviewer should huff and puff and maybe try a chisel, but they aren't supposed to dowse the thing in petrol and throw it to the piranhas - you can find faults with pretty much anything if you really want to.  The reviewer's job is only to decide if the article is worth drawing the attention of the wider community or not. It's not exactly verification or communication, just, "they haven't done anything obviously wrong, here, you take a look at it."

Of course, only a brain-dead gibbon would pretend that this process is perfect. A perfectly objective system run by inherently subjective creatures is fundamentally impossible. One guard against the inevitable bias of the reviewers is their anonymity (which they can discard if they so wish). Thus the reviewer's reputation is in no danger if they accept a publication that contravenes existing ideologies. Obviously that doesn't mean their own biases don't get in the way of being objective, but it greatly reduces the danger of a false consensus. Hence this is one area where transparency is undesirable.

EDIT : It's also worth noting that the journals generally don't pay the reviewers anything, it's just an expected part of any researcher's job. As well as ensuring the referee's are free to speak their minds - a junior postdoc can refute a distinguished professor - anonymity means there's no glory to be won as a reviewer. Refereeing is also an extremely tedious chore for most people that takes weeks of their time they could be spending on their own projects, so the direct tangible rewards of the process are essential nil. Really, what more can you ask of the system ?

Not all reviewers are created equal. Some are pedantically anal idiotic twerps. Others are paragons of virtue and wisdom. Just like any other group of people, really.
That said, there's one aspect of the process I think would benefit from transparency immensely : the exchanges between the authors and the reviewers. This might have been technically difficult not so long ago, because paper costs money, but nowadays no-one reads the paper journals anyway. It would be easy enough to publish everything online. That way the review process itself could be reviewed, which would help everyone understand what the process is really about, not what some people like to think it's about (who've usually never experienced it for themselves).

So no, JBPR isn't perfect, and it can't be. Is it better than not doing it at all ? Yes. The system includes many safeguards against idiotic referees - if you fail to convince two different reviewers and the journal editor that you even just measured something correctly, then the unfortunate truth is that you're probably just wrong. And there's absolutely nothing, err, wrong with that, getting things wrong is fundamental to the scientific method. But it's just not worth publishing fundamentally incorrect data if you can avoid it.

A very strange comment was raised that replication matters more than review. I suppose this might seem sensible if you've never heard of systemic bias, but... no. A thousand times, no, literally ! If you fail to convince an even larger number of reviewers of the validity of your result, the evidence against you has got stronger, not weaker. The only way that would work is if there's a mass bias or widespread incompetence among experts, which is frankly just silly. Remember, there are far more idiots than experts, so it is entirely possible and plausible to get large numbers of people producing stupid results. And I repeat : all you have to do is report your result. You don't have to explain it. You just have to say, "we measured this" with some rigour (i.e. repetition, statistical significance, etc.). That's all. This is not an unreasonable request for a level 0 requirement for publication.

If you insist on finding faults with journal-based science, here's one that's both real and serious : writing style. That's another topic, but in brief, it's god awful. Certain authors seem to take a perverse delight in making their result as obfuscated as possible. It's the old axiom, "if you can't convince, then confuse" writ large. It's bad for science and bad for public communication. Refusing to allow contractions (e.g. isn't, don't, can't, etc.) or insisting on using "per cent" instead of % is just bloody stupid. But that's a rant for another day, or possibly not because the Atlantic article linked is pretty comprehensive.

So, that's it. Journal-based peer review is not a big scary monster hell-bent on enforcing dogma, nor is it any kind of authority with a monopoly on truth. It's just a recognized minimum standard of quality. Where it goes beyond that - and inevitably sometimes it does - it's straying into dangerous territory. You may well argue for particular flaws in particular journals or with particular reviewers. But there's nothing remotely wrong with the method itself. You simply cannot do science without skeptical inquiry - and absolutely no-one is competent or trustworthy enough to be allowed a free hand. Get someone else to have a stab at it, and if it doesn't bleed to death on the first attempt, let everyone else have a go. That's all there is to it.

The Most Boring Thing In The Universe

I once read a popular article on mathematics that stated that if it was possible to calculate how boring each number was, there must be a Smallest Boring Number. Which would thereby make it interesting, so the next smallest boring number would claim the title and become interesting, and so on. Therefore, all numbers must be interesting.

Sorry mathematicians, but - no dice. Being superlatively uninteresting doesn't make something fun, not even if you set them on fire. If that were true, football, cricket, golf, sewing, ironing and Formula 1 racing would be considered spectator sports fit only for adrenaline junkies. They're not.

Excepting the rare crashes, how is watching a car go round a track fifty seven times in any way shape or form considered to be exciting ?
The Universe isn't without its duller moments too. Some people spend their entire lives studying cosmic dust, despite the fact that it is objectively extremely dull*. Or baryon acoustic oscillations, whatever those are. Or the dynamics of star clusters, which have all the excitement of kitten wrestling except that the kittens are replaced with small and particularly inactive pieces of toast.

* Well what did you expect ? It's dust.

But there's one thing which is much less interesting than any of those : aliens.

To be more accurate, it's not really that aliens are boring. It's just that I am bored of aliens - both kinds. Both ? Yes, both. There are only two. First, there are the purely fictitious kind that are supposed to have visited earth and done unspeakable things to American farmers that would have had them arrested in most Arabic countries. Second, there are the entirely speculative distant kind who live way off in space, possibly watching our old TV shows or maybe just quietly living under a stone, no-one is quite sure.

I find that both of these types of aliens fill me with the same excitement as does a small tub of lard.

That's What They Want You To Think

Doctor Who isn't boring at all, obviously.
First, the kind who are supposed to visit or have visited us. Please no more of this, it's just stupid. It's my own fault, I suppose. I grew up on a diet of all things paranormal, from the Loch Ness monster to Nostradamus and Mothman (yes really, Mothman for crying out loud*). I've even got a signed copy of The Orion Mystery probably still hanging about somewhere.

* With hindsight it was probably Mothman that started me thinking that the whole thing was just too bloody far-fetched.

This was all tremendously interesting to the younger me, but what exactly have we learned since then ? What new compelling evidence of aliens from the Pleiades cluster has turned up ? What's the point of the cattle mutilations, the anal probing, and of course all those lovely crop circles ? What Mayan prophecies have been vindicated ? What, given the massive rise of smartphones, new high-quality photographs have emerged of all those spaceships from species apparently intent on both absolute secrecy and massive incompetence ? What benefit has all the ongoing research been to humanity ?

None. It exists only for the benefit of the researchers' egos : the competition is so fierce because the stakes are so low. Oh, they won't agree, obviously. Many of them are really sincere in their beliefs that because a rock on Mars looks a bit like Bigfoot from a certain angle, the entire planet is awash with beautiful princesses. Whereas the other lot are equally sincere in their belief that the entire operation is yet another NASA hoax and that the Mars rovers don't even exist.

Stop it. Just stop it. Not all of parameter space is worth exploring every time some blurry photograph appears on the internet. The Illuminati aren't coming to mutilate your cows or spray you with chemtrails because there's a fuzzy blob in a photo some dude posted on the interweb. You aren't going to be herded into death camps because a politician fiddled their expenses claims. The fact that a Renaissance painting looks absolutely nothing whatsoever like the Orion nebula, which in turn looks absolutely nothing whatsoever like a brain, proves precisely 100% finely distilled nothing. With perfect accuracy.

One of the arguments that used to convince me about the whole UFO thing was that while 95% of cases are obviously mistaken identity, the remaining 5% aren't so easily explained. And if just one of them turned out to be something interesting, then that would be the greatest discovery in history. The problem is that it's a complete fallacy to imply that if you have a lot of things at least some of them must be interesting by sheer numbers. It's entirely possible to have a huge number of boring things, such as every game of cricket that's ever been played or every single episode of The Wire.

You're not fooling anyone mate.
Such people will often invoke the idea that "lots of people can be wrong" to suggest that the establishment view that flying saucers don't exist could itself be wrong. Yes, that's possible. So could all those stupid fuzzy blobs on Mars. Having a lot of dodgy photos does not mean you must have at least some interesting ones - statistics just doesn't work like that. 1% of nothing is still nothing.

Of course, there are varying levels of belief in flying saucers : from the casual, "maybe there have been a few alien visitations" down to, "snake women from Jupiter are using chemtrails to make us all believe the Earth is round !". If you put a gun to my head I suppose I could be persuaded to admit the possibility of a few alien visitations that have been captured on camera*. But a large-scale cover up which only a few (generally speaking) uneducated and incoherent people on the internet can expose** ? No. That shouldn't even need a rebuttal, because it's buggeringly obvious why it's just stupid.

* Bearing in mind that, "admit the possibility" and, "think that's a load of tripe" aren't mutually exclusive.
** Of course They let them have their YouTube videos exposing the truth as part of a multiple-bluff. Layers within layers within layers. Such people wouldn't understand Bill's Razor if it gently trimmed their nose hair while they were sleeping.

It's not really that I find the idea of alien visitors boring. It's just that the same overblown arguments are made again and again and again on the basis of the same dodgy "evidence". It's just tiresome. If you want to keep researching this stuff, then fine - but I won't accept anything less than a flying saucer landing on the White House lawn or in the gardens of Buckingham Palace*. Those are my terms. I don't think that really solid in-your-face proof is too much to ask, especially considering that there's not a lot I could do about a global conspiracy anyway.

* And no, you twerp, President Obama isn't a reptile. 

In other words, unless your UFO video contains something like this I'm just not going to bother evaluating it any more.

Aliens, Schmaliens

On then, to the second kind of aliens : those who haven't visited Earth at all but are just "out there" somewhere. An equally originally interesting idea which has become less exciting than watching a tortoise hibernate in slow motion. At least with UFOs there is some evidence to debate, even if the photographic quality is such that it makes a celebrity sex tape look like a Stanley Kubrick masterpiece of cinematography. With the non-visiting aliens, however, we've got absolutely zilch. At least zilch in terms of solid proof - which puts us back on exactly the same terms as for the alien visitors.

I suppose Eyes Wide Shut is the closest we'll ever come to seeing what would happen if Stanley Kubrick directed a celebrity sex tape. Unsurprisingly, it was dire. It consists solely of Tom Cruise not having sex for two and a half hours.
I have absolutely no idea if aliens exist or not. "But they must, there are so many stars, it would be an awful waste of space !" Blah blah blah blah blah. Or, "If they existed they would be here." Or you can harp on about how unlikely it is that intelligent life will evolve, or come up with some dribble (it's like drivel but worse) about the difficulties of interstellar travel, or deliver a magnificent sermon on how life might be unrecognisable to us or be so infinitely more advanced that it wouldn't care about us.

The point is we have no actual data. We can keep discussing the same stuff over and over again if you want, but new arguments for and against appear to have long ago stagnated. Sure, the mathematical probability of life arising may or may not be very high, but then again it also seems pretty reasonable to assume that life will try and spread itself. Which of these wins ? We have no idea. No idea at all. It doesn't matter how sophisticated the models are we use to make predictions, they're all just speculation until we have hard numbers.

Which is not to say that we shouldn't try and produce any of those sophisticated models, or that the ones we have weren't worth producing. Not at all. Speculation is an extremely valuable exercise... it's just that the speculations have all become variations on a theme. Every so often a headline emerges with a claim that there's a "new" solution to the Fermi paradox, or a new model about why earthlike planets should either be rare or so common it's a wonder the Earth itself isn't bashing into them every five minutes. All of them are just new ways of expressing the old ideas.

OK, I'm bored of aliens - but that doesn't mean you should be. If you haven't heard the various arguments a dozen times, many of them are extremely interesting. It's just that we're apparently stuck with this God-awful mystery and the theoretical side of things appears to be moving as slowly as a paralytic slug being chased by a sloth that took an arrow to the knee. There are two ways to make this interesting again :

1) A genuinely new theoretical argument, rather than yet another nuanced solution to the Fermi paradox. None of the proposed solutions are particularly convincing and all debates degenerate into "well, maybe the aliens blah blah blah." Yeah, maybe. Without knowing anything about the aliens you can speculate any solution you like.
2) Observational constraints. We don't have to detect aliens, but if we had some limits on how common they are then at least our speculations would be informed. E.g. if we detected no earthlike planets or artificial signals (of comparable strength to our own) within 50 light years, we could begin to say how common aliens are. And don't blather on about only looking for life as we know it - how the hell do you expect us to look for life as we do not know it ?

And aliens are also used as a sort of ultimate-level justification for space research. "You may not understand why I'm putting this shrimp on a treadmill today, but you'll thank me when I work out how to contact aliens tomorrow". Talking to aliens is seen as an end in itself with no further justification needed. Why is China building a giant radio telescope ? To talk to the aliens. Why do astronomers look for extrasolar planets ? To work out where the aliens live. Why do we study star formation ? To see how common planets (and thereby aliens) might be. Gamma ray bursters ? Might be nasty for the aliens. Dust ? Important in planet (and thereby alien) formation. Hydrogen line ? Best way to listen for aliens.

Aliens are depicted as a singularity event - something of such awesome mind-expanding potential that whatever happens after contact is completely unpredictable. Knowing that we're not alone in the Universe will either cause us to unite and form a global utopia or becoming angsty emos who are too depressed to get out of bed. But would it ? Would it really be such a revelation given that we're already intensely familiar with the concept, indeed have been for many centuries ? I rather doubt it. Despite the total lack of any evidence, most people overwhelmingly favour the notions that aliens do exist rather than that they don't*. It would be a bit like finding out about government spying programs : lots of hoo-hah,very little that actually happened as a result, and consequently one of the least surprising discoveries of all time.

* Furthermore, a huge swathe of the population just don't care.

Sci-fi is supersaturated with aliens. We've considered them as overlords and conquerors and invaders and refugees and parasites and gods and ordinary people. They've been super-intelligent, very stupid, factionalised, united, had pointy ears or been formless energy clouds. There's really not much more of parameter space left to explore. If and when we finally do make contact, it will almost certainly be a massive anti-climax. Instead of aliens landing on the White House lawn to mutilate our women and steal our cows (or possibly the other way around), it's likely to be some kind of transmission. And unlike in Contact, it will take years or decades to decode and won't contain any instructions for building a wormhole machine. It will, in short, be really really boring.

Yet aliens are being sold as this incredibly profound event, presumably by lazy public outreach types who can't be bothered to try and understand or explain scientific projects for their own sake. Now, my being bored doesn't necessarily mean that the whole thing is ridiculous, but we do have a few examples of how boring the discovery of aliens would be, of which the most famous is That Rock from Mars. You remember, the one with the fossils, right ? You probably do, since if you're reading this blog you're likely at least vaguely interested in science.

But it's very possible that you don't : I distinctly remember my sister's near-total lack of reaction. Massive controversy in the popular press which was sustained for considerable time, but twenty years later and its Wikipedia entry is shorter than that of Cardiff Bus. Doctor Who's blasé attitude, "it's them aliens again, I'll bet my pension", may well be far closer to the reality of contact that the singularities of other popular fiction.

The opposite question is much more rarely asked : what if it's just us ? Forget whether you think that's more or less likely or not, that's irrelevant. Rather, just consider the possibility. What does that mean for us ? Does it make us more or less special ? Would we still want to reach the stars if there was no-one there to meet ? Have you ever really stopped to even think about this before ?

Here's how I would handle the whole situation. Continue the research exactly as is being done right now (or heck, increase it - just because it's boring right now doesn't mean it wouldn't be interesting if we had some actual numbers), but with one teensy-weensy change : stop making major press releases whenever a tiny incremental adjustment is made. That could make the whole thing exciting again. Alternatively, I should take a holiday. One which doesn't involve radio astronomy in any way shape or form. That sounds nice.

Saturday, 16 April 2016


Sometime late last summer I saw a job advert I was morally obligated to apply for. Astronomy Visualisation Specialist ? I am one already ! Experience with visualisation software and generic programming languages, e.g. Python ? The 11,000 lines of Python code for Blender that I wrote ought to tick that box and then some. New ways of visualising data ? Assisting astronomers cre... look, just visit my website. It's all there. All of it. Never have I seen a job description that felt so precisely tailored to me.

The application deadline was 1st October, though I submitted mine well before that. It's normal in astronomy for responses to take at least one month, sometimes two or even three. A few places - which are downright rude - never bother to respond. Still, by early December I was beginning to suspect that despite being objectively very, very qualified for the job, they must have given it to someone else. Well, it did say, "as soon as possible" on the job description.

They hadn't. I'm not sure if you'd call it an early Christmas present or not but I had a Skype interview on 18th December. Which was the day after I moved out of my flat in Prague (roomate left, couldn't possibly afford the place on my own) which had involved a week of hauling heavy suitcases back and forth to move my stuff to the institute. And it was the day after I got back to Cardiff, just to make things as frantic as possible.

Anyway it went well, but unfortunately it went well for everyone else as well. After a rather nervous Christmas, in early January I got en email saying that they'd go to a second stage round where they'd send us all a data set to visualise. Which they duly did a couple of weeks later.

It was actually quite a fun little project to work on, because the data set wasn't in a format I was familiar with. 3D data sets generally describe the density or temperature or whatever at different locations in space. The location is specified by 3 positions : x, y, z. Nothing very complicated about that.

And that's fine if, as is usually the case, your data set describes something that's roughly box-shaped. And by roughly I mean very roughly indeed, like this :

Simulation of a star-forming filamentary cloud, or something.
But this data set didn't use ordinary "Cartesian" coordinates, it used spherical polar coordinates. These aren't difficult either, but they may be unfamiliar. Instead of specifying 3 linear distances from the origin, they specify one distance and two angles :

Why in the world would you want to use such things ? Surely, it's more intuitive to think in terms of distances, not angles ! No, not always. There's a very simple everyday example that should help you understand : maps. With a street map, you could easily specify a position in Cartesian coordinates. You could say, for example, that Cardiff Castle is about 150m north and 25m west of the Revolution bar, if you thought that breaking into the castle on a Saturday night was somehow a good idea.

You could also specify how high the castle keep is, if it was vitally important to reach a precise level for some reason.
On a scale this small, the fact that the Earth is curved doesn't matter. You could hold out your arm and say, "go 50 metres in that direction" and no-one would have any difficulty. But if you said, "go 5,000 miles in that direction", anyone taking you literally would have ended up in space. Of course, they intuitively understand that you mean "along the surface of the Earth", not really, "in the path followed by a perfectly straight laser beam going in that direction". Unless they're a cat, of course.

This is why you don't give cats directions using laser pointers, because if it involves going into space then damn it that's what they'll do.
North, south, east and west are really just angles. Nothing very complicated about that : if you want to go to Australia you can say it's around 140 degrees east of Great Britain and 20 degrees south of the equator. Or you can give this in miles, it's the same thing.

We don't normally specify the distance from the centre r unless you're a mountaineer, pilot, miner, or deep sea diver. OK, you'd normally give distance from sea level rather than the centre of the Earth, but it's the same thing.
Or is it ? Well, not quite. 50 miles north or south is the same everywhere, unless you're so close to a pole you can't actually go that far. E.g. if you head in a northerly direction when you're 25 miles south of the north pole, after 25 miles you'll find yourself heading south. Much worse is the case of walking east or west if you're near the pole. You can't actually go east or west if you're standing on the pole itself, and if you're just a few steps away from the pole, then walking 25 miles east or west is going to involve walking around in a lot of circles until you get dizzy.

And at the north pole it will also involve discovering Santa's secret hideout or being eaten by a polar bear.
Using angles makes things a lot easier for cartographers. Line of longitude (east or west position) have constant angular separation, even though the physical distance between them varies (i.e. 1 degree involves walking a much larger distance at the equator than near the poles). And the mathematics to convert between the two is easy and precise, so if we have two lat-long positions we can easily compute how far we have to travel to get from one to the other - even if we're at weird positions like the poles.

In numerical simulations, polar coordinates have some other advantages, which are a bit more complicated. Imagine if you will a cat on a record player*. If you wanted to specify any point on the cat, you could give its x,y position. Or you could state its r,φ (pronounced "phi") coordinates instead. There's not really any advantage to either... unless the record player is turned on and it stars spinning.

*Conjecture : there is no scientific concept which cannot be explained with the right cat gif.

If that happens it's very much easier to specify how fast each point is moving in the φ direction. If you wanted to specify its velocity using x,y coordinates, you'd have to give two velocities - which is much less intuitive than saying, "it's spinning at such-and-such a speed". And anyway the velocities in the x,y directions are constantly changing and depend on distance from the centre of the record player, whereas the angular speed in the φ direction remains constant everywhere.

"The cat is spinning at 20 rpm (or 120 degrees per second)", vs, "the cat's x velocity is 1 m/s and its y velocity is 0.5 m/s, no wait now it's 0.6 m/s and 0.2 m/s, no wait it's changing again, aaaaaargh !"
Or to illustrate this slightly more scientifically :

When the green point is at the top or bottom of the circle, it has no velocity in the y-direction at all. Similarly, when it's at the extreme left or right, it has no velocity in the x-direction. But it always has a constant angular velocity.

So polar coordinates are much more useful for describing rotating discs. The problem is that of course for rendering images, pixels generally aren't in polar coordinates : we have to convert back to Cartesian. That's a problem when visualising simulations : just like trying to map the spherical Earth with a flat surface, you can get horrible distortions or lose detail if you're not careful.

Converting between polar and Cartesian coordinates is literally like trying to square the circle.
My first approach was to convert the data into the regular Cartesian system : knowing the r,θ,φ coordinates directly from the data, it was easy to convert to x,y,z. Which gave me this :

It's simulation of a protoplanetary disc.

... at which I make a brief interjection because at about that moment I received the following email, which I will keep anonymous because I'm not a total douchebag :
...and I do my first steps in scientific visualization. I am very interested in astronomy, though my main job till now was connected only with graphic design in university sector. I have some 3D modelling experience (several years ago me and my colleague made a fulldome video). Now I learn Blender and try to write my first scripts in Python. Slowly I become the idea, how everything works. Although the more I read, the more question I get...But it is normal I guess :)
Hopefully soon the quantity of my knowledges will transfer to their quality. About a month ago I got a chance to apply for a position as a specialist for astronomical visualization. My interview was quite successful and now we got a test task, which will probably define the proper candidate. I have already an idea, how to solve it. But it would be nice to find someone, who understand the materia, could evaluate my job and give me some practical advices. So I would like to ask you, if you had time and wish to answer some of my questions.
OK... one of the other candidates is asking me for help without even realising that I'm applying for the same job.

I decided the only safe course of action was to make absolutely no response whatsoever, so that's what I did.

Anyway the first result was not bad, but not great. The problem is that when you convert between coordinate systems there's no guarantee the Cartesian data set will be completely filled - especially at large radii. The polar coordinates tell you the centres of each data cell (pixel) and the density (or temperature or whatever) in that entire cell. But the centre of that cell only corresponds to the position of one particular pixel in Cartesian coordinates - it's not the same as checking every pixel in Cartesian coordinates and finding which polar cell they're in. The upshot is that you end up losing detail in the centre (where the polar cells are closer together than the Cartesian cells) and large blank areas at the edges (where the polar cells are further apart than the Cartesian cells).

To illustrate that, let's take another look at the comparison between polar and Cartesian grids. First in the very centre :

Every large square of the Cartesian grid contains multiple points from the polar grid. So multiple polar cells get reduced to a few Cartesian cells - detail is lost.
And now in the outskirts, shading every Cartesian cell that's intersected by at least one polar cell corner point :

Oh noes ! Not every Cartesian cell is filled ! And this only gets worse at larger radii.
That's not a hopeless problem. One nice feature when converting is that you're free to choose how many Cartesian pixels you want very easily, so you can optimise for a balance of detail in the centre vs. empty regions on the outskirts. In principle, you could then fill in the blanks based on the nearest pixel, or accurately determine the value for each Cartesian cell by working out which polar cell it corresponds to. Doable, but not easy - and certainly not doable in the space of an afternoon, which was the stated scope of the exercise.

There's a more fundamental problem : to you show all the detail in the central regions, you'll need a lot more cells in Cartesian coordinates than if you used polar. Large data sets can easily run into hundreds of millions of cells, which means hundreds of millions of pixels : ouch ! Wouldn't it be better if we could somehow have non-square pixels ? Then we could show the data in its original polar form, with no loss of detail and no need to have a single pixel more than we really needed.

It turns out that we can do just that in Blender. Consider a slice right through the centre of the protoplanetary discs. If we pretend that r and φ are really y and x, we get this :

Of course they're not really x and y at all, which means we're looking at something that's weirdly distorted. But we can correct for this. The method I came up with was to assign each pixel to a face in Blender (UV mapping). Then we can move each vertex (i.e. distort each face) to put it back where it would have been in polar coordinates.

Bingo - we can have our cake (original spherical polar coordinates) and eat it too (no need to convert to square pixels). Of course, the real data isn't just one slice - it's lots of slices, each of a constant angle θ. So what we have is a series of cones :

And if we show all the cones, we get this - which is a pretty convincing way to fake a volumetric render, with the gaps between the cones only becoming apparent at certain angles :


In the above, density controls bother temperature and opacity (transparency). But it doesn't have to be density. It could be, for example, this mysterious Q parameter which is apparently heat transport that I know nothing about except that it looks nice :


In principle, we could fill those gaps by switching to spheres when the viewing angle is through the cones. Actually, I started with spheres because I'd already tried this* - I only had the idea to use cones during a long and boring meeting. They look nice enough on their own, though to really get things perfect we'd need to combine the two.

* Spheres are much easier to do because there's no need for UV mapping - Blender can calculate the distortion to a sphere itself just fine, but not cones.


So having figured out this somewhat complicated process, some considerable time passed before I heard anything back. It felt like forever.

Eventually at the beginning of March - a full five months after the application deadline, I got the news that... I was invited to an on-site interview ! Which led me to an odd mix of glee and frustration.

Many wisecracks did ensue, of course. Maybe, said colleagues, they just wanted more data visualised as a sort of way of getting cheap labour. Maybe they hadn't rejected anyone from the first two rounds. Maybe the number of candidates was actually increasing at each stage.

Nonetheless, I want along to said interview about three weeks later and went at it hell for leather. I brought along both glass cubes, 3D glasses, a copy of the Discover magazine in which I nuked a potato, and I even organized most of my Blender files and scripts from the last 14 years. It would be a five year position with the possibility of a permanent contract at the end, with a salary far more... European than those of the Czech Republic. Worth fighting for, even if the "as soon as possible" phrase had long since rung hollow.

Getting to Heidelberg involved a 7 hour bus trip. It was a very nice bus and I had the whole lower compartment to myself, which was nice. With wi-fi. Heck, it was better than most British trains by a considerable margin. There wasn't much to look at on the trip, but I've always thought that it's far easier to make my own entertainment than it is to make my own legroom.

The only real event that happened was that there was a perilously short connection between the bus to Mannheim and the train to Heidelberg, so I ended up jumping on a plausible-looking train (German trains do not indicate the destination and route very clearly) more out of hope than expectation. Which resulted in a fairly tense 20 minutes until the train stopped at the correct destination. After hauling my really quite surprisingly heavy bags to my hotel, I had little enough time in the evening to do anything except a short walk. I didn't get to see any of the pretty parts of Heidelberg.

Of course I did see the Haus der Astronomie the next morning. My interview went as well as it could have gone. With hindsight I wouldn't have changed a damn thing. There wasn't time to show everything, but I left fully satisfied that I'd done as much as I could possibly have done. I answered all their questions. I showed them the extremely heavy data cubes and 3D movies. I was a little peeved that - bizarrely - they really did want someone to start extremely soon, but I'd have been more than prepared to take the job anyway (even though I'd really, really, really like an extended period back in the UK). So off I went back to Prague while they interviewed the other candidate.

Alas the return trip was not without incident. About one hour in to the seven hour trip, the bus ground to a halt due to an accident up ahead. It didn't move an inch for the next four hours. The bus driver let everyone off to walk around (and even some people on to use the toilet). I talked to some otherwise politically like-minded Germans who were, it must be said, none too fond of the Czechs, but even the nicest bus becomes wearying after 11 hours. I eventually crawled back into my room - still dragging my laptop and heavy glass cubes, of course, at about 2:30am.

Then I proceeded to play the waiting game. Again. For another three weeks. Until finally :
Dear Rhys,
thank you for your patience. It was a difficult decision, but in the end we offered the job to the other remaining candidate. This is in no way a reflection on the skills you demonstrated - we were very much impressed by your visualizations, found that you communicated well with the astronomers who would have been your colleagues here, and you would have been a great addition to our team. In the end, it came down to experience - the candidate to whom we offered, and who has now accepted, the job, is older than you and had put those additional years to good use in the visualization field.
We wish you all the best for your future career - you have an unusual and interesting mix of skills, and I hope you will find a good place to put them to the best possible use, either in astronomy or beyond!
It's a very nice rejection letter, but a rejection all the same. All of that effort had been for absolutely nothing except a free but incredibly exhausting 24 hours in Heidelberg. Was it worth it ? I'll let John Cleese answer that. Skip to 46:28 if it doesn't automatically.

On the one hand, the successful applicant is about 10 years older than me, done four-dimensional relativistic raytracing calculations, and has written a freakin' book. Fair enough, I'd have hired him instead of me. On the other hand, it doesn't take six months to decide who's more experienced. You can do that from the start. Especially if you use the words, "as soon as possible" in the advertisement.

Oh well. As Captain Picard once eloquently put it, "shit happens". In another reality, alternate me is taking a short break in Cardiff before preparing to move to yet another country despite never wanting to leave home in the first place. Actual me is now in the more mundane process of searching for a flat before he gets kicked out of the institute's accommodation. Aaaargh.

Saturday, 9 April 2016

Perfectly Wrong : Or, Necessary But Not Sufficient

Right now the popular science media is all a-flutter with "news" of the "discovery" of "Planet 9". This post isn't about that... at least, not directly. What I want to do here is sound a cautionary note using a surprisingly relevant tale from the normally unrelated field of extragalactic astronomy. There are, however, three things I must say about Planet 9 before we begin :
  • It's. Not. A. Discovery. It's an inference. You can't discover something unless you see it. Oh, you can have extremely good evidence for it, to the point where the actual detection becomes almost a formality, but we're nowhere even remotely near to that stage of credibility.
  • The attitude of the scientists. Their stridingly-confident approach is the very last thing one should see coming from someone at the forefront of research. Why ? Because science is a process of getting things wrong, and this whole attitude of, "this thing we just thought of is right but all the other claims of more planets were wrong" is just aaaaaargh.
  • It would be Planet X anyway because Pluto is a planet, deal with it. Or possibly not because who knows if it's cleared its orbit or not ? No-one, that's who.
But on to our feature presentation. It's the fact that Planety McPlanetface hasn't been discovered that I want to emphasise.

Have a look at this particularly lovely pair... of galaxies, that is. You do your own joke.

NGC 4438 (the big one) and NGC 4435 (the little one) as seen in the Sloan Digital Sky Survey.
The correct first response is "Oooooh !". The correct second response is, "well how did that happen ?".

Being such a big, bright, and downright spectacular object, Markarian's Eyes (as they are sometimes known) have attracted an awful lot of attention from magpie-like astronomers over the years. And rightly so, because aside from observational astronomers naturally liking pretty pictures as much as anyone else (maybe even more so), this system is weird even by the standards of other cosmic train wrecks.

As early as 1988, computer models were being used to try and explain this bizarre-looking duo. Sensibly enough, Francoise Combes et al. carefully combined observations and simulations, rather than doing just one or the other as is often the case. Basically what they did was model a collision between the two galaxies. Which also seems thoroughly sensible because there are quite clearly two galaxies involved in the collision.

A little background might be beneficial here. In some ways, the very broad properties of the system are easy to explain. We know that some galaxies contain gas (which is necessary for star formation), whereas others (for a host of interesting reasons) do not. We also know that massive stars are blue and don't live very long, so we expect regions of gas which is actively forming stars to look blue. So, if one of the two galaxies had gas and the other didn't, we could certainly expect that a collision would cause lots of blue areas to develop in one of them while leaving the other one much more nonchalant about the whole thing.

Which is of course exactly what we see. The problem is one of detail : can we explain those precise structures that are actually observed ? From the Combes et al. simulations it seems the answer is yes, yes we can. Here's their simulation on the left compared to the observations again on the right.

Pretty darn good ! OK, it's not a perfect agreement : the smaller galaxy is a little bit too far to the north in the simulation, the southern tail is straight in the simulation but curves in reality, and the tip of the northern tail is a simple angular point in the simulation but looks distinctly "pinched" in the observations. Yet the broad agreement is very impressive.

One should also remember that this was 1988, when computers had all the raw power more normally associated with a rampaging snail or a high-powered sloth. The simulations were necessarily very primitive compared to what's possible today. They didn't (couldn't) model any of the gas physics or the star formation or anything like that. All they did was to have two gravitational fields for the two galaxies and a bunch of test particles (that is, particles which don't have their own gravity) representing the stars. So they could predict where most of the mass should be, but that's about it.

But don't underestimate the achievement of the result. To explore the enormous parameter space of two colliding galaxies (which could have a huge range of initial positions and relative velocities) and get something that resembles the observations this closely is, frankly, heroic. Which means according to Blackadder we all have to stand like this in celebration : 

Here we get a very pertinent example of Occam's Razor. It seems that we can explain the system very well indeed using nothing more than the simplest of physics. If we were to use the Razor as is popularly supposed (the simplest explanation is usually the correct one) we'd get the absurd result that we should ignore all the other physical processes because they clearly just can't be very important. That's why the Razor needs to be handled as carefully as any other sharp pointy object.

Fortunately real scientists are not movie scientists and don't assume the simplest explanation is the correct one, which isn't what Occam said anyway. They keep investigating. So in 2005, Vollmer et al. (the et al. includes the heroic Francoise Combes, by the way) did more sophisticated modelling of the system - though still with the basic approach of smashing two galaxies together.

Although they were still limited in some ways (no star formation and only simple approximations for the dark matter), they were now able to model the gas and stars separately and include the effects of the the intracluster medium on the gas. Even intergalactic space is not totally empty, and as galaxies move through the particularly dense gas that pervades galaxy clusters, their own gas can get pushed out. Whether or not a model without that intracluster medium works or not is irrelavent : it's there regardless.

Terribly famous image showing the gas in various galaxies (size greatly exaggerated) in the Virgo cluster along with the gas in the cluster itself. 
The result of this more sophisticated modelling does not, on first glance, give a result which is a dramatic improvement over the earlier model. Better, yes, but not massively so. That changes somewhat if you read the details of the gas distribution (not shown here) - there are certain details, the authors found, that just can't be explained without including this intracluster gas.

Unfortunately most of the figures given in the paper are rather small. The only decent one only shows the stars in the larger galaxy, for some reason. However, some rather better movies of the simulations are available here.
Still, the fact that this is an incremental improvement bodes well. The basic structures can be reproduced very well with this model of two colliding galaxies, and even more precise details can be re-created when you include the hot gas outside the galxies. Surely, this means the model must be basically right - two colliding galaxies and some extra gas are all that's needed. Right ?


Recently I described how the scientific method is an incredibly messy process, especially at the forefront of research (though things are rather different if you limit yourself to the least controversial areas). One comment received was, " looks as if "Observation" is the start of the scientific method which yields results for peer review."

Yes. That's exactly what I very deliberately wanted to say. Because sometimes, as I shall now show in spectacular fashion, observations tell you something you wouldn't have had a hope in hell of guessing if you limited yourself to the classical theory -> prediction -> observation approach. For when this area of the Virgo cluster was observed at a wavelength sensitive to hot gas of a particular temperature, Kenney et al. 2008 found this :

Oh, crap.

Here we see the new observations overlaid in red and green (depending on the precise velocity of the gas, but that's not important here) on a standard visible-light colour image. Instead of just the two galaxies colliding, it's now virtually certain that they've also interacted with a third, much larger galaxy. All those carefully fine-tuned simulations which reproduced the precise structures very well... nope. The lesson should be powerfully self-evident : even if your model does a fantastic job of reproducing even the very fine details very well, it can still be wrong - or at least woefully incomplete.

Which is, of course, not to say that the Combes and Vollmer models are definitely totally wrong. It's still possible that NGC 4435 and 4438 are interacting, and maybe that is still the main mechanism for the formation of the weird-looking structures. But it's also abundantly clear that that is, at the very least, not the whole story. If the third galaxy was just a tiddler then this likely would be a case of slightly modifying the original suggestion. But, since the third galaxy is enormous, it's also even possible that the major structures formed by a totally different mechanism and perhaps the close proximity of the original two galaxies is just a coincidence. This is commonly known as the "more than one way to skin a cat" principle.

I trust this makes the point about Planety McPlanetface clear. Even if they do have a really good model that explains the observations - and I'm not convinced that's the case - that doesn't mean jack without an observation. You have to be very, very careful to distinguish between, "this model works" and, "this model is correct".

I wouldn't often presume to correct Feynman on the scientific method (though there are other aspects of Feynman that I would have few scruples about attacking) but this is not quite the whole story. It's a minor but important detail, but you've got to be damn sure it really does disagree with experiment (or observation) before you say it's definitively wrong. Given enough research, this is possible. But, as a general rule of thumb, it is foolhardy indeed to reject or accept anything at the forefront of research even if they have seemingly good observational evidence... and positively deranged to accept an idea on the basis of a model alone. 

Now, not for one moment would I dare to suggest that I have any authority to pronounce judgement on Planety McPlanetface* - just that I'm prepared to bet against its existence. I have zero expertise in Solar System dynamics. Someone could potentially find it tomorrow and prove me wrong - but until that happens, I don't find the model-that-fits-the-facts to be anything more than an intriguing possibility, and the barrage of speculation is just hopelessly overblown. 

* Though I insist upon naming rights.

The take-home message from this post is simple. If it really does disagree with observation, it's wrong. But the reverse situation does not follow. If a model really does agree with observation, it isn't necessarily right - no matter how specific its predictions are.