Recently in Science Category

March 3, 2013

Flame Challenge

I've entered the Flame Challenge.  The challenge, specifically, is to answer the following question, scientifically (i.e. not poetically), for an 11 year old, in 300 words or less or as a graphic or video entry.  The entries will be judged by 4th-6th graders in schools in the USA.  It was too much of a challenge for me to resist, and now that the deadline has passed I can reveal my answer:

What is time?

Imagine looking at every slice of a loaf of bread, one by one, starting with the crust at one end and progressing towards the other. First you'd see the crust, then you'd see all the slices from the middle of the bread. If the loaf had an air bubble inside, then you'd see a hole in some of the slices. The slice from right at the edge of the bubble would have a small hole, and the ones which were cut right through the middle of the bubble would have bigger holes. On your way through the slices, you'd see a small hole first, then a bigger one, then another smaller one, then no hole at all.

The passing of time from moment to moment is like moving from one slice to another. Many things stay the same, just like every slice of a loaf of bread looks roughly the same, but some things change --- like the sizes of the holes in the bread slices. Things that change quickly, like an explosion, look very different from one "slice" to the next. Things that aren't changing at all look exactly the same in every slice. Something that's moving, like a car, changes its position from one slice to another.

When you think of time this way, you see that the passage of time is quite similar to moving along in distance. This is actually how scientists often think about it, too. Have you heard of Einstein's Theory of Relativity? That's based on treating space and time as very similar things. The main difference is that we have no choice but to move forwards in time. You can choose to stop moving through the slices of bread and spend longer looking at a particular slice, but you can't stand still in time!

My approach was to make the link between the dimension of time and the dimensions of space by using a familiar household object.  There's so much more that I could've added with a longer word limit, like how things can be measured in time and space by creating an object that changes its appearance regularly along the dimension of interest.  A ruler is just a stick which looks slightly different as you move along its length (the numbers go up), and a clock is just an object which looks slightly different as you move through time (the hands go round).  You can even extend the concept of a crystal to dimensions of time as well, making a space-time crystal.  What I find most interesting of all is how our perception of time is linked to its physical reality: exactly why are we compelled to advance through time, while having apparent free will concerning our movements in other dimensions?  Is it all in our heads?  Perhaps somehow related to the second law of thermodynamics applied to the physical and chemical processes in our brains?

The winners will be announced at the World Science Festival in June this year.  In the unlikely event that I win a trip to NYC at that time, I'll be flying in a highly sleep-deprived state from an experiment at the Linac Coherent Light Source.

October 4, 2011

Project X

I'm still here, and programming.  Work has been taking up most of my "programming brain" recently, but the results will hopefully be released as free and open source software very soon.

For the last few months I've been working on a new non-work project as well, which I'm not going to say too much about just yet - let's call it Project X for now.  It's a piece of major "itch scratching" for me, but I have a feeling that many other scientists who use Linux will love it.  Perhaps many other people besides.  Watch this space...

February 25, 2010

OpenCL Calculation and Reduction

Otherwise known as "calculating a long list of numbers then adding them all up".  For a GPGPU (OpenCL) simulation program at work, I needed to calculate around 160 numbers which would be averaged to produce one result for storage in a 1024x1024 element array.  That's 160 numbers for each of 1024x1024 pixels, which would be a lot to store as an intermediate result for a later step of averaging on the GPU, or (heaven forbid) to be copied back to system memory.

The magic word to search for in tackling this is reduction, and there's plenty of hardcore compsci knowledge about how to make it go as fast as possible in a parallel environment.  But, basically the trick is to have 160x1024x1024 threads operate in groups of 160 (one group for each of the 1024x1024 overall elements).  Threads cooperating like this can share memory, and each thread writes its individual value to an array in that local memory.  Then, one of the 160 threads adds up all the values and does a single write of the final average value to the global array.  For the kernel to test if it's running the "chosen thread" is as simple as something like this:

if ( get_local_id(0) == 0 )

The only bit of "funny business" is that each of the 160 threads has to have finished calculating before the results can be added.  That's done with this statement, which guarantees that all previous local memory writes have completed for all threads: 

barrier(CLK_LOCAL_MEM_FENCE);

This is a really simple example: for one thread to do all of the averaging is a waste of resources when the reduction itself could be parallelised.  In that case, one thread would (say) add up values 0-79 while another added up 80-159, then one of those threads would (after another barrier) add up the remaining two values.  It's easy to see how it can be broken down more and more, and there are variations which make better use of the GPU resources, avoid memory conflicts, and so on.

So, if you'd ever heard of the thread groups and local memory used in OpenCL (also CUDA) and wondered what they were good for, now you know..

NVidia's OpenCL Programming Guide has a lot of discussion of this topic, and there's loads more to be found around the web.

December 20, 2009

Trip to Stanford

On Friday I got back to Hamburg from San Francisco, where I'd been taking part in experiments at the Stanford Linear Accelerator Cente.  We used the LCLS to zap various kinds of object and measure the resulting signals.  Without going into too many gory details, I'm happy to be able to say that the experiment was a great success and we got several terabytes of useful data, which we'll be analysing for many months to come.

I hardly had any time to escape the campus or to explore, but I did manage to find some sites of geeky interest.  Here's a photo of the research stations at the end of the two mile long linear accelerator, which is hidden by the trees at the back of the picture.  The large concrete building on the right is End Station A, where the first experimental evidence for the existence of quarks was recorded around 1966.  Their experiment was like a much larger version of Rutherford's scattering experiment with alpha particles and gold foil.  Today, End Station A contains test experiments to prepare for the International Linear Collider.  I wasn't able to go inside - it's probably possible, subject to the particle accelerator's beam being directed elsewhere and talking to the right people, but there wasn't time and I wasn't keen to push the limits of my security pass (I also couldn't find the door..).

pc170019.jpgThe similar concrete monstrosity on the left is End Station B, which probably contains similarly cool things (remember what I wrote about concrete?).  The long building which comes out between and runs off the picture to the left is the LCLS beam transport hall.  Standing where I took this picture, below me and to the left would be the undulator hall, which contains magnets which cause the electron beam to emit X-ray pulses of unimaginable brightness and brevity.  The tunnel emerges on the other side of the hill I'm standing on, where the electrons and X-rays move into the building where we worked.  The electron beam is dumped (basically by directing it into the ground) and the X-rays make their way into our experiment.

November 7, 2009

Concrete Blocks

Concrete blocks. Absolutely everywhere. That's my dominant impression of this international particle accelerator research centre after the first month. Concrete blocks shielding the outside world from radiation emitted by the shiny things hiding behind them. And generally, the bigger the pile of concrete blocks, the cooler the thing that's lurking behind.

Here are some photos from today's open day at DESY. Most of the things shown (everything apart from FLASH and XFEL) have nothing to do with what I work on, but they're still exciting to look at. The HERA and PETRA tunnels aren't normally open, least of all to the public, and there probably won't be another opportunity to see them for years. In pictures 38, 40, 42, 45, 46 and 51, you can see the sequence of bits of pipes and coils which guided electrons from PETRA, physically above HERA, into HERA's electron ring. HERA was switched off in September 2007, but almost all of it is still in the tunnels. You can also see wider views of the machine. The cylindrical pipe thing on the top is the superconducting ring of magnets which guided protons, and the pink boxy thing underneath is a normally conducting ring of magnets for the electrons. You can even see what's underneath the pink metal cover, but it's not very exciting. Then there's a spin rotator which alters the polarisation of the electrons. A bit further down, you can see the electron and proton rings being brought closer together (the electron beam pipe is the thin bronze-coloured thing just in front of the yellow thing), and then going through the final focusing magnets before colliding with one another in the next room. Not that you can see anything except concrete blocks, because that bit is just way too cool.

And it needs a whole lot of cryogenic stuff to make it work.

PETRA was previously used for particle physics, before being turned into a pre-accelerator for HERA and more recently (last year or so) into a synchrotron radiation source for (e.g.) protein crystallography. This thing is still used - in fact it's one of the most modern synchrotron X-ray sources in the world - but it wasn't switched on while we were in the tunnel, otherwise we would have been fried. Naturally it's hidden behind a huge wall of concrete blocks.

There are plenty more photos to see beyond the ones linked here..!

June 11, 2009

Submitted!

Ok, so it took me a little while to announce it, but I submitted my PhD thesis last Friday.  That means I never, ever, have to write another thesis again.

This is a good thing.

March 12, 2009

Sleep Weirdnesses

I'm having a somewhat sleep-deprived week.  Staying up all night on Saturday night to help with the lighting for a show at the ADC Theatre, more of the same in the evenings, and getting up as early as I can (which admittedly isn't very early) to work on the thesis during the days.  And then doing thesis / other work stuff in my spare time during the evenings as well.  It seems like an appropriate time to write about sleep disorders.

The usual proviso about my not being a psychologist applies, but I find the science of sleep quite interesting.  When you're asleep, your conscious mind is disconnected from your muscles so that you don't act out the things you dream.  When this goes wrong, you aren't properly "unplugged", and you end up sleepwalking.  I did that once or twice when I was about 12: it felt a bit like I drowsily woke up and tried to start doing all the things I would normally have done in the morning, before realising that it was about 4am and I should still be asleep, so getting back into bed.  I woke up, thought that I'd only dreamt it, but I had my trousers and socks on having put them on in my sleep.

The other way it can go wrong is sleep paralysis.  This is essentially the opposite of sleepwalking, and happens to me quite often - around once or twice every month.  You wake up, but can't move a single muscle.  It's very similar to waking up very early in the morning with huge muscle weakness, but much more profound.  A quite scary thing is that things like breathing are still being controlled unconsciously, so although you're still breathing fine you feel like you can't breathe at all.  After a few times of it happening I understood what was going on, but usually I'm too drowsy at the time to really have a clue what's happening to me at the time.

If you've ever heard stories of alien abductions, people often describe exactly this kind of paralysis.  Apparently some people see mysterious shapes or other things like that, but I've never experienced that.  A few hundred years ago, people would report that they'd been visited by a witch or demon.  These days, it's an alien abduction.  Hmmm.

A final weirdness is lucid dreaming - when you dream, but are aware that you're dreaming.  I haven't experienced this in a particularly clear sense, but sometimes I realise I'm dreamining while the dream is still going on, just before waking.  A kind of "Oh, this is a nice dream.  It'd be a shame if I woke up right now" moment between waking and sleeping, just long enough to perceive as the dream slips away and daytime takes over.

March 10, 2009

Diffraction, Caustics and Null Hypotheses

I came across two interesting things while chasing up some references for my thesis today.  The first is the research of Professor Sir Michael Berry, whose work lies in "the borderlands between physical theories - between classical and quantum, between rays and waves".  This includes things to do with rainbows, levitating spinning tops (remember a news article about a levitating frog a few years ago?), the finer points of laser pointers shining through bathroom glass, and the diffraction of atoms by light.  There's also a whole load of stuff that's relevant to my own research, which I'll need to take a much closer look at.

The other thing was JASNH, the Journal of Articles in Support of the Null Hypothesis.  This is a journal which provides a place for research to be published which did not demonstrate that observations of whatever phenomenon being investigated were significant to the usual level "required" for publication.  That means, it contains articles with titles such as "Playing video games does not make for better visual attention skills" and "False Recall Does Not Increase When Words are Presented in a Gender-Congruent Voice".  Possibly amusing, but with a very serious aim.

March 4, 2009

Introducing: The Triclinator

You can only imagine how much I needed to write a program to do the following:

You gave me these measurements:
--------------------------------------------------------------
 h1  k1  l1   h2  k2  l2    Spacing   Angle          ESD
--------------------------------------------------------------
  1   0   0    -   -   -    0.79900    -      +/-  0.04000 nm
  0   1   0    -   -   -    0.54800    -      +/-  0.03000 nm
  0   0   1    -   -   -    0.47500    -      +/-  0.02000 nm
  0   1   1    -   -   -    0.37600    -      +/-  0.02000 nm
  1   0   0    0   1   0        -    90.50000 +/-  0.30000 deg
  1   0   0    0   0   1        -    95.80000 +/-  0.30000 deg
  1   0   0    0   1   1        -    95.86000 +/-  0.30000 deg
--------------------------------------------------------------

Iterating...
---------------------------------------------------------
Itn    a        b        c      alpha    beta    gamma
---------------------------------------------------------
  0  0.82100  0.49300  0.58500 90.00000 94.70000 90.00000 success
  1  0.70848  0.58101  0.30065 89.78806 95.38217 89.82747 success
  2  0.67458  0.48830  0.44046 89.36372 95.96973 89.38617 success
  3  0.79505  0.54190  0.47809 89.43948 95.94105 89.55228 success
  4  0.80376  0.55035  0.47971 89.44351 95.92759 89.55922 success
  5  0.80385  0.55037  0.47977 89.44352 95.92762 89.55927 success
  6  0.80385  0.55037  0.47977 89.44352 95.92762 89.55927
---------------------------------------------------------
Final status = success
chisq/dof = 0.00138664 / 1 = 0.00138664

I think the unit cell is:

                    a =  0.80385 +/-  0.04538
                    b =  0.55037 +/-  0.02869
                    c =  0.47977 +/-  0.02284
                alpha = 89.44352 +/-  0.11985
                 beta = 95.92762 +/-  0.24502
                gamma = 89.55927 +/-  0.25949


Your measurements when calculated with my cell are:
--------------------------------------------------------------------
 h1  k1  l1   h2  k2  l2    Spacing   Angle   Deviation
--------------------------------------------------------------------
  1   0   0    -   -   -    0.79900    -      -0.00000 (0.000%) nm
  0   1   0    -   -   -    0.54800    -      -0.00000 (0.000%) nm
  0   0   1    -   -   -    0.47499    -      -0.00001 (0.001%) nm
  0   1   1    -   -   -    0.37601    -      +0.00001 (0.002%) nm
  1   0   0    0   1   0        -    90.80437 +0.30437 (0.336%) deg
  1   0   0    0   0   1        -    96.14916 +0.34916 (0.364%) deg
  1   0   0    0   1   1        -    95.41835 -0.44165 (0.461%) deg
--------------------------------------------------------------------