May 15, 2012

ALMA at the SSE imaging

We've been working on a bunch of things for the upcoming ALMA Summer Science Exhibition stand including a hands on ALMA simulator.

I've just finished adding our "Send to twitter" function with a bit of windows based commandline wizardy - I'm actually very pleased with it. So here is a bit of an Easter egg, me through the eyes of the ALMA SSE Imager - a bit of Earth rotation really brings out my features - can you guess what is on my t-shirt?

me through ALMA imager

May 1, 2012

How to make an image in radio astronomy

Radio Astronomy 101

In a rather simplistic viewpoint: you get uv data from your array (bottom right); you convolve it with a point spread function (top right) to get a nicely uniformly gridded data set (top left) and then you take the FFT of it to get a pretty image (bottom left).

Of course that's a gross under-estimate of what you need todo but highlights a key point - you have to grid the data. This is computationaly expensive and something I'm working on at the moment. The above plots are really just an example of a small python script I've developed to try out a few ideas. In reality, you'd have some source structure in there and hopefully your final image would be something that would be much more representative on the sky than the criss-cross pattern you seen in the final image (bottom left).

Astronomy Events in May

Want to know what local astronomy events are going on this month? The [Federation of Astronomical Societies] have a great list of events that are taking place all over the UK. There are some 50 or so activites that range from talks on advanced imaging techniques to solar observing. Of course I know this list quite well being the gate keeper and all. Go out and enjoy some astronomy run by the thousands of volunteers across the country.

If you are unsure where you local astronomy society is you can find this out on their google map.

April 20, 2012

M52: a cluster of stars

M52 is an open cluster in the Cassiopeia constellation. This is a good binocular target and you will see some 200 or so stars belonging to the cluster:

M52

April 13, 2012

Data interpolation in python

Quite often in my day to day work I end up having to flag out bad data. In many cases this just creates a gap and normally this is fine just to throw away. There are occasions however, such as when creating the bandpass of reciever that its still quite useful to have some idea as to what is going on in the normally flagged out channels - especially when its large chunks of data. To solve this we use interpolation. This post isn't about explaining data interpolation - for that I suggest you take a look at wiki.

When interpolating I like to use splines. In linear interpolation we use a linear function for each intervale,s with splines we use low-degree polynomials in each of the intervals chosing a polynomial that nicely fits the sections together. Generally works quite well.

Python has many different ways todo interpolation, be it spline or not. There is a huge variety of interpolation functions and I'd urge you to explore the scipy help for an exhaustive list. In this example I'm going to use the spline functions from scipy.signal

Firstly, import the functions required (asciidata is to read in the data and is not needed):

from scipy import *
from numpy import r_, sin
from scipy.signal import cspline1d, cspline1d_eval

I've defined a function to do the actual work:

def spline_lowchan(beamdata):
   lastzero = max(where(beamdata == 0)[0]) #first 146 channels are 0
   startchan = lastzero+1
   x = r_[startchan:len(beamdata)]
   dx = x[1]-x[0]
   newx = r_[0:startchan:1] # notice outside the original domain
   y = beamdata[startchan:]
   cj = cspline1d(y,lamb=0)
   newy = cspline1d_eval(cj, newx, dx=dx,x0=x[0])
   aa = list(newy)
   bb = list(y)
   mod = aa + bb
   return mod

The function is called like:

output = spline_lowchan(originaldata)

Where originaldata is the initial bandpass (just a sequence of numbers in an array or list)

In the above example of interpolating the function is assuming that the first set of data is all set to 0, hence the where is 0. We then interpolate the data over the range where there is no signal. We then add this to the original signal, hence allowing the region without any useful data to have an interpolated data set. Not perfect but gives a better idea of what might be happening. Of course this is not really how you should treat the edges but the cspline1d method very well when you say lose a few data points out of a bandpass.

April 8, 2012

M36: an open cluster in Auriga

M36 is an open cluster in Auriga - its a good binocular target and is some 4,000 light years away from the Earth. If this star cluster were as close as the Pleiades are then it would look very similar from the Earth.

M36

April 2, 2012

Rugby at Wembley

I have to say I really enjoyed going down to London to watch the Saracens lose to the Harlequins on Saturday. At first watching rugby being played at Wembley sounded very strange to me, but once you are there you realise what a magnificant stadium it is. Its the first time I've been there since the new stadium opened at is just look spectacular. I reckon no matter were you sit you get a great view. We had some great seats though:

Woop Wembley

Its nice to feel I was part of a new world record too. The highest attendance at a club rugby game; 83,671 people were at the game. I have to say though, that I was a bit disapointed with the need for a warm-up band - McFly, and the presence of cheerleaders. Felt a bit American and distracted from what we were there for - for watch 30 guys play rugby.

March 30, 2012

Concatinating measurement sets in CASA

Combining data from different spectral windows or different days is quite useful. Quite often I will image these seperately and then combine in the image domain. It is useful, however, to be able to combine these into one measurement set, its just easier to keep track of the files - and time based flagging in the case of many spectral windows is probably the same (e.g. one antenna is down, well it will be for both spectral windows). Anyway, in AIPS this was quite straightforward and it was something I did often. I've only just needed a reason todo this in CASA and again its fairly easy. You just need to use the task "concat". I've put together a little script thats in two files from the commandline and runs this, see the code below:

from os import sys #python library to read input from command line
inputfile1 = str(sys.argv[3:][0])
inputfile2 = str(sys.argv[3:][1])
visoutfile = 'combined.ms'
print inputfile1,inputfile2,visoutfile
concat(vis=[inputfile1,inputfile2], concatvis=visoutfile)

Save this (as concatms.py) and run as:
casapy -c "concatms.py file1.ms file2.ms"

Assuming the two files are different frequency ranges you will end up with a file that has two spectral windows in.

March 21, 2012

Globular cluster, M3

I occasionally use the Bradford Robotic Telescope for remote imaging... here is an image of the Ring Nebula, M3 a globular cluster in the constellation Canes Venatici:

M3 with BRT

March 17, 2012

SSH Keys and multi machine processing

A lot of my processing can be parallelised effectively by just splitting up the data and running on many machines. To accomplish this I use SSH keys so I can start jobs over the network from one bash script. Works nicely and is quite effective - the only downside is normally having to send data over NFS.

Anyway, crucial to this is the ability to install SSH keys, this can be done quite easily.

Firstly make sure that you have ssh'd from the machines you want to set this up on before. Simply just ssh into another machine, this will create a .ssh in your home directory with the proper permissions.

Now on your main machine run:

ssh-keygen -t dsa

This will generate a key. It will ask you for a passphrase. If you are hoping to spawn loads of jobs over many machines then don't put anything here (otherwise you'll be asked for the passphrase instead of your password!). Of course this is a security risk - so make sure you trust your network etc.

Now copy this key over to the other machines, in this case I'm using a virtual machine at 192.168.56.101, so:

scp ~/.ssh/id_dsa.pub 192.168.56.101:.ssh/authorized_keys2

Now on the machine you just copied it over (in my case ssh 192.168.56.101) run:

ssh-agent sh -c 'ssh-add < /dev/null && bash'

This will add the key and allow you to effectlviely have passwordless login - and allow for some nice multi-machine processing - we do this for lots of the Arecibo data we have to deal with, allows us to effectively run on 100 cores without any fancy software just a small bash script that loops over an array of machines.

March 14, 2012

M57: the ring nebula

A short image of the Ring Nebula out at Wast Hills. It is a rather prominent planetary nebula well worth a look through a telescope:

M57

March 12, 2012

Talk bingo generator

During my [talk on Saturday at the University of Birmingham] I played talk bingo. The idea is that as I give the talk the younger members of the audience can be entertained by playing a game that requires them to pay attention. Whenever I give a talk I tend to use a subset of words (and indeed this can be played with a rather small number of words in any extragalactic seminar) from the field of astronomy. So all I did was generate a bunch of random bingo games and I say the words the audience cross them out. Eventually they will call bingo and I offer a small prize. On Saturday, due to a bit of a mix up with computers this didn't quite go as to plan but I think all were quite entertained. I suggested to a few that I'd put this together in a useful format.

So do you want to play talk bingo? You can use my [online talk bingo generator] on my research pages. It should be quite straight forward to use. Just provide the words (with space seperation) and a size of the grid and off you go. It produces html tables which can nicely be copied to openoffice for easy printing.

For those of you who might be interested in implementing this yourselves, here is the basic code (this is what I used for Saturday and I've changed it a bit to work nicely on my website, testing for max sizes and taking in input):

$random_text = array("Telescope","Dish","Data","Array","Universe","MeerKat","LOFAR","Space","Wave","Moon","Shock","Life","Transit","SKA","Radio","Exoplanet","Aurora","HD209458b","Arecibo","GMRT","ASKAP","POSSUM","GALFACTS","Galaxy","Jupiter","Sun","Earth","Magnetic","Gas","Electron","Kepler","Space","Venus","Mars","EVLA","Aliens","WOW","SETI","Radar");
$number_of_games = 50;
$number_elements= 25;
$elementsinrow = 5;
$intro = "";
for ($j = 0; $j < $number_of_games; $j++) {
   $rand_keys = array_rand($random_text, $number_elements);
   $sizeof_arr = sizeof($random_text); //echo $sizeof_arr;
   $intro .= "<table border=\"1\"><tr>";
   $b = 0;
   for ($i = 0; $i < $number_elements; $i++) {
      $intro .= "<td><font size=\"6\">" .    $random_text[$rand_keys[$i]] . "</font></td>";
   $b +=1;
   if ($b > 4){
      $intro .= "</tr>";
      $b = 0;
   }
   }
   $intro .= "</table><br /><br />";
}
echo $intro;

As you will see its nothing particularly fancy, but darn useful

Recent Photos

Solar Activity

Sun Latest
Image credit: SOHO/MDI

Get Firefox! Valid XHTML 1.0! Valid CSS! RSS Feed BlogUniverse - listed Powered by Apache Creative Commons License ringsofsaturnrock's Most Interesting Photos on Flickriver

Powered by
Movable Type 3.38