March 7, 2010

SKA Pathfinder Video

I'm a radio astronomer, which is pretty obvious if you know me or have ever looked at my blog before, and sometimes I find it hard to properly explain what I do - especially since my current work is based on a telescope that is still in the design stages (the Square Kilometre Array). One of the pathfinder telescopes to the SKA is ASKAP (the Australian Square Kilometre Array Pathfinder, imaginative name, eh?!). Anyway the ASKAP guys have a cool movie showing the design of the telescope... so if you have ever wonder what the heck I'm going on about maybe this will help:

If you can't see the link try [here]

February 28, 2010

Basic Parallelisation in Bash

I have recently started writing some quite CPU intensive code and since we have a nice cluster here (without any management software on it) I decided that it would be best for me to take advantage of the number of cores on them. Actually, this works nicely on my desktop which has four cores anyway (and 4GB of RAM). Essentially, I'm lazy and this basically runs my pipeline in parallel for different sources by sending off different jobs to different cores (to the maximum number that you specify)... and then when they finish runs then next few... and so on until they are all done. No longer do I have to worry about waiting for the jobs to finish and wasting time by missing their finishing point. I also no longer have to have lots of [screen] sessions or loads of terminals open... bliss...

Oh here is my basic [Bash] script:

#!/bin/bash
#By Samuel George; www.krioma.net
#Original: 27/02/2010
array=(`ls -d */`)
#My scripts run in sub directories, replace with your list of commands to run.
len=${#array[*]}
maxjobs=1
jobnumber=0
#loop over the maximum number of jobs based on the number of files in array
while [ $jobnumber -lt $len ]; do
jobsrunning=0
while [ $jobsrunning -le $maxjobs ]
#start jobs up till maximum and then wait for them to finish before continuing.
do
#go into the directory and run - this is an oddity of my processing
#replace with your own functions
cd "${array[$jobnumber]}"
"run.sh" &
#go back a dir
cd ../
#add to counter so that you know how many jobs are running at once.
jobsrunning=$(( $jobsrunning + 1 ))
#keep a running total, such that the script will loop over all the jobs you want running jobnumber=$(( $jobnumber + 1 ))
done
wait
#keep a listing of where you are.
echo $jobnumber
done

Stick this in a shell script, chmod 700 file.sh and job done.

There is definitely room for improvement here. For example this code will wait till all of the processes in the inner loop, ideally you'd want it to move on after the first one is finished. Watch this space... well that might not happen since my tasks all take about the same time to finish in.

February 22, 2010

Monster Truck Madness!

I took my first trip down to the Saddledome here in Calgary yesterday to go watch [Monster Jam]! It was also a chance to experience some "proper white trash". It was lots of fun watching these huge beasts crush cars and fly through the air. From the pictures its hard to really understand the size of these things... but just look at the people for scale (some pics below).I put a video compilation together of some of the best bits I recorded (if you can't see it below go to [youtube.com]...

Donkey Kong flies through the air...

Monster Jam - donkey kong

The fans favourite, Grave Digger takes on the giant dirty mound...

Monster Jam - Gravedigger

It wasn't all big trucks crushing things though.. there was a cool freestyle motocross show too:

Monster Jam freestyle motocross

More pics over at [flickr].

Dinos vs UBC

I went to watch my first University sport match while I have been in Calgary on Friday. It was the [University of Calgary Dinos] versus the University of British Columbia. Oh it was ice hockey. I'm happy to say the game was good, though due to drinking of beer we did miss the first period... oh well. It was 1-1 when we got there. The final score was 3-1 to the Dinos... go Dinos!

UofC Dinos vs UBC hockey faceoff

This was my second hockey game while I have been here and it was a bit higher pace than the [last one (Canada's Women's national team)] with a few big "hits" and a bit of a fight... not a "good" one though...

UofC Dinos vs UBC hockey fight!

A few more pictures over on [flickr].

February 15, 2010

Olympic Celebration in Calgary..

Last Saturday Calgary (well CTV) held a celebration for the start of the Olympic Games over in British Columbia. I have to say this is probably the coldest gig I've ever been to. It was fun though.. but still it was darn cold. Not sure if holding an outdoors gig in Calgary in the winter is ever a good idea... it was foogy too - such that you could just make the outline of the Calgary tower:

Is that the tower?

I got there in time to watch some local band called who played a solid set of music. Not sure if they are really my thing but they are defineely worth a look out. Probably the best local band I've seen so far. I've not seen many though.

"The Dudes" play

Eventually, as it got darker, the Tower broke through the clouds and you could see the Olympic Flame burning brightly over Calgary...

Calgary Tower, olympic flame

The main attraction for me to go down to the event was to see the headline band, Simple Plan. They were definitely worth waiting around in the cold for (well it wasn't so cold after I had a hot chocolate and then jumped around a bit).

Simple Plan at Olympic Celebration

Simple Plan at Olympic Celebration

.. but by the end of this and when I got on the C-train to go home I couldn't feel my feet properly.. hmmm. Oh and here is a quick clip of the gig:

More photos from the gig can be found [on flickr].

February 13, 2010

Playing with gnuplot

The otherday it was about time I tried out [gnuplot] for a change. I used to do all of my scientific ploting (and actually a lot of my analysis) in [R]. These days I tend to use [python+matplotlib]... but I wanted something that would allow me quickly to visualise data and plot functions without much effort... this is where [gnuplot] really does seem to be powerful.

I came across an excellent intro to gnuplot page: [Plotting Data with gnuplot].

Here is an example plot of what you can easily produce in a few seconds. Pretty swish.

gnuplot example

Oh and gnuplot is nicely in the [Ubuntu] repositories... you probably want to get:

sudo apt-get install gnuplot-x11

February 10, 2010

Turning a PDF into an animated GIF

Today I was asked to take a bunch of PDF files (essentially frames of the animation) into an animated GIF. This is actually a fairly simple task todo with [imagemagick] and its fast too. Simply all you have todo (assuming the PDF, or other image files etc are in order) is:

convert -delay 20 -loop 0 frame*.pdf output.gif

The -delay 20 specifies the time between frames and the -loop 0 tells the image to loop forever.
Quite nice really (the animation is for a conference and so I won't post it).

The only issue I had is I wanted it to stay on the last frame for a while, but this was simply accomplished by a bit of bash before running the above:

for i in $(seq 28 1 38) do cp -r frame27.pdf frame$i.pdf done

Thus this took frame 27 and copied it in a sequence from 28 to 38. Sweet.

Finally I was asked to put two animations next to each and this can be done by using the append functionality:


for i in $(seq 01 01 38)
do
convert frameset1/frame$i.pdf frameset2/frame$i.pdf +append output$i.pdf
done

This adds the same frame number from each set next to each other in one larger image. Once this is done it is a simple procedure of running the earlier animation script on the newly created pdfs.


February 7, 2010

Sunset from Science B

My first trip onto the roof of Science B of the University of Calgary was timed nicely with a gorgeous sunset...

View from Science B roof

... here you can see (what I think it is anyway) the ski jump that Eddie the Eagle must have jumped off back in the 1988 games.

I didn't just go on the roof to look at the sunset, though it was probably worth it just for that, but to also do a bit of astronomy. There was a class on and I tagged along for the start and helped setup the scope (they were investigating the size of craters on the Moon) and took this pic:

The Moon from Calgary

Not a bad setup really..

Telescope and Moon

January 31, 2010

My first hockey game

I went to watch my first hockey (oh and for any Brits by hockey I mean the ice variety) game the other day. It was at the Father David Bauer arena here in Calgary. It was a game between the National Women's Team (the Canadian Olympic team basically) and the Calgary Royals.

Canada vs Royals Face-Off

It was actually quite a good game, well for someone who has only ever watched it on telly. Of course in the women's game there are no big body checks or fighting (though I'd probably not want to get in a fight with any of those lasses looked like they could have held their own). The final score was 4-4 which in North American sports means we have overtime and then penalties... with the women winning 7-6 on pens. Lots of fun. Oh there is a short video below... (and a bunch of other pics over on [flickr].

Canada vs Royals

If you can't see the video try it [here].

January 24, 2010

Olympic Flame at UofC

Last Tuesday the University of Calgary got into the Olympic spirit that is slowly ramping up in Canada ahead of the 2010 Vancouver games. As the torch makes its journey through Canada it made a nice stop at the Calgary Olympic Oval (Calgary was the host of the 1988 games, if you are a Brit you will probably remember Eddie the Eagle, it was these games that he did that) on its way through Alberta. Of course, I couldn't miss out on this!

Olympic Torch skates around the Olympic Oval

Olympic Rings

Oh and on the way home the torch on the Calgary tower was on...

Olympic Flame on Calgary Tower

More photos at: [flickr.com/photos/starrydude/].

January 20, 2010

2009: a review of my year...

Hmm, I know this is a bit late but given my flying back to the UK for Christmas and then coming into a busy work schedule of just not had time. I thought that I probably should write a few things down though.

So 2009, a good year and can be summed up by three things.

Got engaged. Passed Phd. Moved to Calgary.

Of course much more happened but that's really the quick summary. Getting engaged was by far the most important thing to happen to me.. and now we are organising an August 2011 wedding since I moved to Calgary (Canada) to take up a postdoctoral position in radio astronomy... this came after I successfully completed my PhD in astrophysics (title of PhD - "From planets to galaxies: the low frequency radio sky").

Many pictures were taken throughout 2009 and I was involved in many events (many surrounding the International Year of Astronomy). I travelled quite a bit (apart from the obvious moving to Calgary) - I went to Arecibo (Puerto Rico) for an observing trip (great to be in control of the world's largest telescope) and I took a vacation to Barcelona (a fantastic city).

I don't have much time to finish this properly right now so I'm hoping to come back to this at some point and add some pictures...

January 17, 2010

Football Manager 2010 on Ubuntu

By far my favourite computer game is [Football Manager] and for Christmas I was given the latest incarnation, FM2010. Now I could just play it on Windows, and indeed I probably will at some point, but that's not me. I never use Windows unless I have to these days (I only ever need to windows to play games). So I went about trying to get it to work on [Ubuntu]. [FM2008 was pretty easy to install] but I had a few problems with this one. For some reason I just couldn't get the correct settings in [Wine].

So in the end I just went and installed [PlayOnLinux] which has a nice install script for the game and it WORKED! The install went smoothly (make sure you don't do the via steam option though). I first had issues with the graphics but all I did was make sure that fm.exe was added to the list of programs to run in XP mode in winecfg. I also think that you have to make sure you run kill all tasks running with the wine prefix and then simulate the windows reboot. After doing that - job done. I have a few issues with the graphics and the 3D engine is currently not working, but I probably wouldn't use that anyway...

ubuntufm2010