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,

Monday, 11 November 2013

Why An Imaginary Monkey Is Helping Me Measure Hydrogen

I once photographed a potato for NASA. This is going to be difficult to top, but I'll give it a damn good try.

Galaxies, by and large, are fairly simple shapes. Generally speaking they're either pretty spiral discs or tremendously boring yellow blobs (a.k.a. ellipticals). You can make analysing them as complicated and tedious as you like, but measuring how bright they are is pretty simple. Put a circle around them and have a program add up all the flux (energy) within the circle. Easy-peasy.

Images from the SDSS.
Of course, things get more complicated most of the time. Usually spiral galaxies are tilted away from us, so they're not neat circles. Sometimes there are stars in our own galaxy lined up directly in front of the distant galaxy, in which case there's little option but to break down and cry. Or find another galaxy to measure.

There are also galaxies whose shapes are just downright freakin' weird. Like this one, discovered by a Puerto Rican student this very summer. I can't resist re-posting this, because... NESSIE !

There are even galaxies which aren't so much exotic as they are... erotic. Well, erotic corporate logos at any rate, which is even weirder. I kid you not.

With galaxies shaped like Nessie or...ahem... rabbits, you could still slap a circle around them and get a reasonable answer. But in these cases you might suspect that the galaxy is made of several separate parts, so possibly you would choose to fit more complicated shapes.

With neutral hydrogen the observations give you 3D data cubes, and the gas can be all kinds of wonderfully complicated shapes. And pretty too. Did I mention it was pretty ? Because it is.

Gas clouds of the Milky Way, from the GALFA-HI survey.
NGC 628 from the THINGS survey.
The above GIFs were produced with FRELLED, my own script that imports FITS files into 3D art software Blender. That lets you freely rotate the view around the 3D images in realtime, which is nice because it makes the animations a lot easier to produce. And do all kinds of science, etc. etc. Anyway, it's pretty obvious in these cases that just drawing a circle wouldn't help much, unless it was accompanied by some arcane symbols and ritual chanting. This - unless you're a dyslexic astrologer who chose the wrong career path - is generally frowned upon as a method of data analysis.

So I was asked to give FRELLED the ability to measure the gas content within spherical or spheroidal regions (it only did cubes*, which are trivial). Well, spheres are easy, because you can very easily find all the pixels in the file which are inside the sphere and add them all up. Deformed spheres (ellipsoids) aren't much harder.
* Most of our observations have much worse resolution than the above examples, so cubes work just fine.

But the heck with that. I can see where this is going - today a sphere, tomorrow an ellipsoid, the day after... well, let's just go for broke and let it do arbitrary shapes. Like, say, a monkey. That's about as arbitrary as you can get.

This is Suzanne, beloved icon of Blender. Over the years she's been subjected to all kinds of deranged shenanigans, though not, I suspect, ever quite as pointlessly technical as this. What I needed was a way to check if any particular point was inside or outside of Suzanne (more generally any closed surface). And I found one on the internet, making life twenty times easier or more.

It's very simple to define the smallest possible cube which contains all of Suzanne. All I have to do is check all the points within this cube to see if they're inside Suzanne or not (I could check the entire data set, of course, but this is huge and would take a lot longer).

At that point I could make a leap of faith and have the program just spit the measurement of how much hydrogen is present. This is a terrible and boring idea. I'd rather have it first show me what the data it thinks is inside Suzanne looks like. That way I get to check if it's working correctly or not.* More importantly, I can now present you with a monkey head made out of hydrogen gas from the Milky Way. You saw it here first.
* Actually this was really important, because several early tests were giving ghastly results - and there isn't some "monkey parameter" to check if this is working. The only way is to look at the data and see if it looks like a monkey**.
**This is not a phrase used much in astronomy.

OK, this is pretty specialist stuff. It boils down to a short algorithm to let you measure hydrogen within an arbitrary volume. This is quite useful, but it isn't going to revolutionize astronomy. Not unless that depends on measuring the gas content of a monkey-shaped galaxy, at any rate.


  1. This comment has been removed by a blog administrator.

  2. This comment has been removed by a blog administrator.

  3. Very cool animations. Are there more? My students found them helpful to visualize these large space structures more easily.

    1. Yes, there are lots more :