Archive | November 2010

Calgary’s winter landscape

As temperatures with windchill hit -40C today (raw temperatures of -30C and -20C for the past week) Calgary is in the mist of a rather snowy landscape so I took a few photos (well I tried to before my fingers froze):
The lunch area at UofC:
IMG_4862
17th Ave bandstand:
IMG_4857
Downtown Scene from 12th Ave SW:
IMG_4851
this bike is going nowhere fast:
IMG_4846
lost ya hat….
IMG_4842
Downtown by Snow Central
IMG_4826
View from my office, no mountains today
IMG_4883
A very cold morning view of downtown, with windchill -40C… yikes
IMG_4872
-40C construction….
IMG_4869

Advertisements

Awk csv and cut the header…

Something I keep having to look up how todo so I’m putting it here for future reference:
Suppose you have a comma separated file, say the list of Abell clusters: e.g. first line:
1,1.89167,16.50972,0.1249,514.3,3.342
and you want to convert this into a nice tab spaced data set and cut off the header…
awk -F’,’ ‘{printf(“%10.8ft%10.8ft%10.8ft%10.8ft%10.8ft%10.8fn”, $1,$2,$3,$4,$5,$16)}’ abell_all.csv > temp_abellcut
len=$(wc -l temp_abellcut | awk ‘{print $1 -1}’)
tail -n $len temp_abellcut > abell_all.dat
rm -rf temp_abellcut
echo “id ra dec z D search_radius” > abell_all.header
… and bob’s ya uncle.

Simple median in python

Yesterday I was doing some python scripting for work on [GALFACTS] and I wanted to take the median of an array. I know I could simply use the [numpy] function but I specifically wanted to alter the behaviour to skip NaNs (in the end I ended up doing this a different way using the isnan functionality) and so I wrote a short script to calculate the median, thought I’d post it as a short example of some simple python programming / you never know if it will come in handy again (for me or anyone else). The full script can be retrieve from my [research script dump], oh and below:
#Function to determine the median of an passed array/list of number
def takemedian(inputvalues):
&nbsp&nbsp&nbsp&nbsp sortedvalues = sorted(inputvalues) #sort values
&nbsp&nbsp&nbsp&nbsp total_len = len(sortedvalues)
&nbsp&nbsp&nbsp&nbsp if (total_len % 2) == 1:
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp return sortedvalues[((total_len+1)/2)-1]
&nbsp&nbsp&nbsp&nbsp else:
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp upperval = sortedvalues[(total_len)/2]
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp lowerval = sortedvalues[(total_len/2)-1]
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp return (float(lowerval + upperval)) / 2
#test function
def validatemedian(correct, takemedianvalue):
&nbsp&nbsp&nbsp&nbsp print “Test Median is: %.2f, takemedian function value is: %.2f, Is Correct? %s” % (correct, takemedianvalue, correct==takemedianvalue)
#test what the ouput is
validatemedian(5.0, takemedian([0,1,2,3,4,5,6,7,8,9,10]))

Lougheed House

Another place that I hadn’t managed to take a look at in Calgary yet, despite only living 3 blocks away, was [Lougheed House].
IMG_4332
I’ve walked passed it a few times but never made that trip inside, well it was quite cold when my Dad was here so we decided that doing something indoors would be a good idea. It wasn’t too expensive, especially since they kindly gave us a buy-one-get-one-free voucher discount even though we didn’t have one. We had a 30 minute or so tour around the building and gave me an interesting take of Calgary 100 years ago. Strange to think all the land around this building would have just been prairie, now its smack bang in the middle of the downtown. As can be seen from this:
IMG_4372
The building was built in 1891, so one of the oldest structures still remaining around Calgary. It has been through many different uses, but thankfully it has now been nicely restored. A good day out, thoroughly would recommend it.
IMG_4359
Oh and I really loved some of the stained glass windows (there is even one, I can’t recall which one, that was placed the wrong way round with the paint on the outside):
IMG_4401
IMG_4373

Walking through downtown Calgary

Just a couple of pictures that I took whilst waiting for a few folks on my way to see the [Prime Time Big Band] and [Ian McDougall] at Ironwood (I really enjoyed the gig, especially since I’m not normally one for jazz).
Nexen Building
Nexen Building
Nexen Building
Oh I did take a few pictures at the gig too, here is one featuring the band and their guest:
Prime Time Big Band @ Ironwood

Monsters

Last night I got to go watch a preview of the new film [“Monsters”] courtesy of a friend giving me a ticket she won via [FFWD] (thanks all round!). Simply, wow. I was very impressed, my expectations were quite low, the concept sounded interesting though: “Six years after Earth has suffered an alien invasion a cynical journalist agrees to escort a shaken American tourist through an infected zone in Mexico to the safety of the US border”.
I was very afraid a good idea would have been spoiled by bad execution. This was not a problem. The film was put together really well, especially given the tiny budget of $15,000. They didn’t use cheesy special effects just nice little things, such as playing low resolution TV reports instead of going into the action (and also had some cool effects too). This actually meant you get to “feel” the characters better. Some sci-fi fans might be disappointed (especially if you are expecting a gun tooting film) and I heard one or two in the audience say quite loudly “I can’t believe I just watched a romance”. I’d say that it was what sci-fi was supposed to be (well what I like anyway biggrin.gif). There was something more to it and I loved the parallels with the US/Mexico border issues now.. but add some real aliens in there, not just the illegal kind.
There was thing I noticed as strange the space-craft they showed was taking off not breaking up… oh well, mistakes happen.
In short I came out thinking this was a bit of Cloverfield meets District 9, but that would be wrong – some links could easily be made to both. The monsters have the Cloverfield sort of feel about them. Comparisons with District 9 are more obvious, especially the social issues being explored through alien interaction.
Overall this is probably the best sci-fi movie over seen in quite a while.

Flames vs Oilers video…

and here is the video…

(video might be slightly truncated to the right / in case link does work: take a look at the actual youtube page)