Rotolux

Physics, Python programming, Miscellaneous geekness

Hailstone pics

Just for reference, I need to link to the recent news reports about the big storm we had last week, which used my photo.

Pasting syntax-highlighted code

I just found this guide on pasting syntax highlighted code (escaped with this form) into Blogger blogs. It's probably not all that useful, but anyway, let's give it a go with a function I use to read a binary file output by xmds into Python:


def read_file(indat_fname, xsil_fname):
# get datafile name and precisions
if got_lxml:
with open(xsil_fname) as xml:
xsil = objectify.parse(xml).getroot()
ulong_len = xsil.XSIL.Array[1].Stream.Metalink.get("UnsignedLong")
precision = xsil.XSIL.Array[1].Stream.Metalink.get("precision")
else:
xml = open(xsil_fname).read()
ulong_len = str(xml2obj.xml2obj(xml).XSIL[0].Array[1].Stream.Metalink.UnsignedLong)
precision = str(xml2obj.xml2obj(xml).XSIL[0].Array[1].Stream.Metalink.precision)
ulong_type = {'uint32':'<u4','uint64':'<u8'}[ulong_len]
float_type = {'single':'<f4','double':'<f8'}[precision]

with open(indat_fname,'rb') as f:
xlen = fromfile(f, ulong_type, 1)[0]
xs = fromfile(f, float_type, xlen)
ylen = fromfile(f, ulong_type, 1)[0]
ys = fromfile(f, float_type, ylen)
zlen = fromfile(f, ulong_type, 1)[0]
zs = fromfile(f, float_type, zlen)

rlen1 = fromfile(f, ulong_type, 1)[0]
reals1 = fromfile(f, float_type, rlen1)
ilen1 = fromfile(f, ulong_type, 1)[0]
imags1 = fromfile(f, float_type, ilen1)
psi1 = (reals1+1j*imags1).astype(np.complex64).reshape(xlen,ylen,zlen)
del reals1, imags1

rlen2 = fromfile(f, ulong_type, 1)[0]
reals2 = fromfile(f, float_type, rlen2)
ilen2 = fromfile(f, ulong_type, 1)[0]
imags2 = fromfile(f, float_type, ilen2)
psi2 = (reals2+1j*imags2).astype(np.complex64).reshape(xlen,ylen,zlen)
del reals2, imags2

return psi1, psi2


which sort of works, except for the wrapping - maybe I did something wrong with the template. I'll have another go one day (maybe)

Origami documentary

I just watched an incredible documentary called "Between the Folds" on the art and science of origami. There was something about it that fired my "inspiration" centre. I need to put this aside for now, what with thesis writing, but I must it again later and look into the subjects of that film.

Changing the eSlick text font

On the Foxit eSlick Forum are various somewhat unclear instructions for changing the text font. To be explicit, the steps are:
1. Create a folder named "Fonts" in the root folder of the eSlick's internal memory.
2. Find a Truetype font, i.e. a *.ttf font - I used the Gentium Book Basic font.
3. Rename "GenBkBasR.ttf" (or whatever) to "fxfont.ttc" and copy it to the "Fonts" folder.
4. Reset the eSlick by depressing the recessed Reset switch on its back whilst it is powered on.

Chickens and eggs of physics

Whilst listening today to the ABC science show, I mused on the following (poorly thought-out) inequities of science communication.

Astronomers and paleontoligists have an advantage over the rest of us trying to communicate our science in that they can assume a greater level of knowledge amongst the general public. Thus they get to explain more of what's new to the general public within a given amount of time. Is this why Catalyst seem to have an overrepresentation of stories on astronomy and dinosours? Or is it because two of their prominent reporters have backgrounds in these areas? Probably the latter. However, experience of dealing with Monash media and marketing people, would tend to support me, so I'll stand by my suspicion that there is a bias.

Astronomers like to talk about how big things are, how old things are, how far away things are ... in short how far from everyday experience the things they study are. I also do this when talking to people about my research, because this is what "bends their minds". Luckily I at least work in an are where I can explain how small things are, which gives me a "hook". However, I often think that this distorts the intrinsic value of all the other things that I (and other scientists) encounter in research - many of the beautiful parts of my research are simply too hard to explain to non-specialists without also relating a significant number of background concepts.

By the way, Paleontologists like to talk about how big dinosaurs were, how long ago they lived, how easily they could crush a human skull etc.

Some interesting articles

The latest Edge has an interesting article. I like
this one arguing against Gardner's theory of Multiple Intelligences in favour of a single useful measure "g", which is presumably IQ. The argument is that the curriculum in schools is pandering to Gardner's labels, which aren't orthogonal. I tend to agree that this is a problem, but I wonder whether a roughly-orthogonal set could be found using proper research and data mining or Principle Component Analysis techniques.

Guide to reducing borders around text in a pdf

OK, here’s a howto on using LaTeX with the pdfpages package to strip whitespace from around the text of an existing pdf document. Say you have a pdf with a large blank marginspace around the text. The following LaTeX file will make a new version. Unfortunately, it will lose any bookmarks, links etc. I usually run it with pages={-8} to process just a few pages, tweaking the offset and scale values until it’s stripping out the bits I want, then change back to pages={-} or maybe a different page range to strip out any guff you don’t want. It’ll also let you glue together multiple pdfs into one file.

\documentclass[a5paper,oneside]{book}
\usepackage{pdfpages}
\begin{document}
\pagestyle{empty}
\includepdf[pages={-},offset=0mm -5mm,scale=1.3,pagecommand={}]{”pdf_file_name”}
\end{document}

Guide to reducing the file size of a pdf for the eSlick

I reported a problem to Foxit with reading a few pages of Kevin O'Holleran's 27MB thesis on my eSlick.
Christina from Foxit explained that the error message "! This page cannot be displayed normally" was indicating a memory issue. Therefore, I worked out how to reduce the file size to a comparatively small 3.4MB by re-sampling just the raster images. Now the eSlick handles the file without problems.

To produce the smaller file on a Windows PC:

  1. Install the latest version of the free PDFCreator software v0.9.8.
  2. Open the original file and print it to the PDFCreator printer device.
  3. After the printing Progress bar completes and the printer driver queue empties, the PDFCreator dialog appears. Click the Options button. Click the Ghostscript link. In the Additional Ghostscript parameters field, add the text "-dPDFSETTINGS=/screen" (without the quotes) and click the Save button.
  4. Click the Save button on the PDFCreator dialog.
  5. Enjoy reading your new, lighter ebook

Gutenberg rejoiner

So, what does one do with an e-reader? Why, read project Gutenberg etexts of course. One way to do this if you've got an eSlick is to use feedbooks to generate a nice pdf for you. In your profile settings, feedbooks lets you set up a custom pdf page format. I use 92 x 122mm, 11px Palatino for the eSlick. However, for novels it's probably better to just use a text file. Then the eSlick can reflow the text for you. The trouble is that Gutenberg etexts are filled with unwanted newline characters so they don't flow nicely on screen. What to do? Well, if you use Perl, you could try the script here. Alternatively, if you're a more enlightened Pythonista like me, you could use the following Python script to rejoin the lines (Note: I created this listing using this cool page):

from Tkinter import Tk
from tkCommonDialog import Dialog

class OpenFile(Dialog):
command = "tk_getOpenFile"

rootwin = Tk(); rootwin.withdraw()
fname = OpenFile().show().split('/')[-1]
if fname != '':
print >>open('out_'+fname, 'w'), open(fname).read().replace('\n\n','#uNiQuE#').replace('\n',' ').replace('#uNiQuE#','\n')

First eSlick post


So, I bought a new toy - one of those newfangled e-ink book readers that herald the death of the print industry - not that I've got anything against the print industry. Occasionally common sense takes leave of me and I become an early adopter of something - in this case it's a Foxit eSlick. That's a photo of me holding it, showing a page of David Paganin's Coherent X-Ray optics book. Hopefully this post spells the start of me blogging some helpful tips for making reading with the eSlick a nicer experience.

London

So the fact that I made no entries during my Dublin visit should tell you that I was pretty busy and didn't have very good internet access. I've just arrived in London. Not really feeling like spending time to blog about Ireland except that it was really good, especially the 3 day bus trip tour I did which was great. I'm planning on doing a couple of things whilst in London; the tower and westminster. Unfortunately there's a conference on at Nottingham which may wipe out some of my audience for my visit to Imperial College on Wednesday - hopefully not all of it. I feel like I'm back in civilisation after the Ireland trip - funny that.

Antipenultimate post?

For those keeping count, there was another fire alarm and evacuation and I heard that there was yet another, but it must have been during my night in Bath, so I missed it. Boohoo.

I think this may well be close to the last post here before I return home; possibly the second or third last, simply because I've been busy and haven't been taking many photos.

To remedy this, here's an exciting one of a letterbox.

And some sciencey cushions


Well, I like them anyway - they're in the university chapel, which itself looks really old, but isn't, and which contains a not particularly impressive looking pipe organ, that is (impressive sounding that is). Here's a snapshot of some of the people in the optics group. This was a going-away lunch for me, Ken and Lesley - they both having been in the group for some years. I felt a bit guilty that I was also sharing in their going-away lunch, myself having only been there a short time.

My research activities here haven't been all that successful and may still end up going nowhere, but I've learned a lot and benefited from being in another group, and having some opportunities to talk at a couple of other universities, so I'm judging the trip worthwhile. This week will be a bit weird because most of the group will be off at the Photon08 conference at Heriot-Watt uni. I'll be one of a handful left and my disappearance from the group will likely be surprise to some.

I think all my accommodation and flight organising is almost complete - just a few more things to book and I can say goodbye to that stress. The sun is out today for about the fourth day in a row - the longest stretch since I've been here, but I've been stuck inside again - I needed to pack and weigh my stuff because my flights to Ireland have stricter allowances. I may still run over-weight. I guess that's all for now.

Side trip to England

Apparently I neglected to mention that my BEC paper was published in Phys. Rev. A. Although I missed it, it also made the front page of the ScienceNews website for a day, although like myself I'm not sure that anyone noticed.

I visited Bristol U. last Wednesday and did a talk for the gurus of phase vortices. Mark Dennis whom I was visiting took me over to the Clifton bridge as was recommended as the place to go in Bristol. It stopped raining long enough for this activity.

The bridge and view were worth the reasonably short walk.
Then I made my way to the station and took the 15 minute train ride to Bath, spent the night there, and played tourist for a day on Thursday.
This is Bath Abbey photographed from the Roman Baths.

People don't get to use these baths anymore, but some creatures still do



I did two walking tours of Bath - on the night I arrived I did the Bizarre Bath comedy walking tour, which was pretty good. It's basically a comedian/magician guy doing a one-man (and one mysterious hidden helper) show involving no actual history. I also did the free Mayor's guides tour after seeing the Roman Baths - this is the history one and our guide really knew his stuff.


I had a pasty for lunch and some decent coffee too before making my way back to Bristol. Apparently the other thing to do in Bristol is to see the ss Great Britain. On my return, before catching the plane back to Glasgow, I didn't do this ... but I did have a nice ice cream because the weather was nice, and I visited the St Mary Redcliffe church, which contains a very impressive pipe organ. I would like to have heard it - It looked like it should sound really good.


So, now I'm back in Glasgow, it's back to trying to get some physics done. I haven't been terribly successful on this front so far, but there's still a tiny amount of time. I've booked my flight to Ireland, booked a 3-day tour there and organised to talk about my BEC stuff at Strathclyde U. and Imperial college before I return to Melbourne. Still more accommodation and flight organising to do but it's reasonably set now.

Oh, and the wolf cryer cried again last night, but it was only 11pmish, so no sleep was lost.

Back in the swing ... tomorrow

A bit of a gap in the posting there. During the gap I went to the Glasgow show on the 27th. This seemed to involve lots of people doing motorcycle tricks, some impressive horse riding, some people showing cows, others showing their wares in marquees and a section for kids to bounce around on various inflatable castles and animals. I didn't take my proper camera and the pics from my phone camera are of laughable quality.

Then, last weekend lasted from Friday until Monday because Barry and Alasdair from the group took a long weekend off with me and headed up North. I rented a car and drove, with Alasdair as passenger. Barry borrowed a car and brought his friend Ewan. Three other potential long-weekenders pulled out so we ended up having lots of space, and it ended up costing more than would have been ideal, but I think it was worth it.

We headed northwest to Fort William so Barry could meet up with his female German friends who were backpacking around. Here's a weird stone dome near Glencoe - we couldn't agree on what this was for - there's no entrance - I think it's for making charcoal in. Any ideas?

We started walking up Ben Nevis at 5pm and ran out of time to reach the summit. We did reach the cloud level though and there was reportedly no visibility from the peak anyway. We got as far as this waterfall.

Then we camped in the "Braveheart carpark" near Ben Nevis. We returned to Glencoe with the girls, Ute and Marieke, to do the walk to the "hidden/lost valley" also to act as meals for the many starving midges there. There was water cascading down the mountains everywhere. Just left of here is the walk through to the valley.
Which contained yet more water and midges

but also contained nicer wildlife

After this morning activity we drove up to Ullapool via Loch Ness and Inverness without stopping at any touristy Nessie sites.
This was quite a bit of driving. We camped at Ullapool, had a late BBQ and midge feeding session before the next day. This was mainly a walk up Stac Polly, which has great views. Here are a few - the real views are better.

After this, plans went a bit astray. Barry, Ewan and Ute had gone back to Ullapool to collect Marieke, who wasn't feeling up to Stac Polly to take her and Ute up north. Alasdair and I made our own way up, detouring to see some random sites such as this 4-6000 year old burial site,
which was home to several sheep
and missed the others whose plans changed, coinciding with mobile phone batteries going flat and some loss of communications. Anyway, they ended up in a different town so Alasdair and I camped in Talmine,
near Tongue on the northwest coast

Finally, on Monday we drove back down to Glasgow meeting up with Barry and Ewan (who had delivered the girls to Thurso to catch a ferry) at Dunrobin castle on the west coast


then via Pitlochrie and Perth, where we ate before finally arriving home.
Today I got no work done.

Recovery day

On Saturday, we (Bhuvanesh and I) went to the Loch Lomond highland games at Balloch. These guys wear shorts under their kilts.

Many a cabre was toss'd. It's kind of impressive.

And boys wrestling girls inevitably leads to tears (at least it did in this case, which was a bit unfortunate). No permanent injuries though.

However, there's only so much of the sorts of things that go on at highland games that one can tolerate, so we went off for a walk along the opposite shore of Loch Lomond, which turned into a bit of a trek...

... but that was probably good preparation for yesterday's walk up goatfell on the Isle of Arran, which involves a dash to the train station, a fast train to the coast, a leisurely ferry trip and then a reality check about how unfit I am at the moment.

We ran into Alasdair from uni - he was visiting his parents on Arran.
The views on the way up are great
There's a deer in there...
The views from the top are pretty spectacular, as all the guidebooks tell you, so it's worth the pain I'm feeling today.
And when we got down we had time for some sheep-watching

and a look at some old pagan standing stones - can't find these mentioned on any websites, but they were probably erected about 4000 years ago like the others on the island.

Then, a ferry and train trip later I arrived back pretty tired.

After a shower, I discovered that some joker tried to set off the fire alarm, because when I walked past the kitchen I smelled something burning - someone had put bread (charcoal when I found it) in the stove and left it on. I think it was my bread too. Anyway, I was prepared for another awakening in the night, but it didn't happen.

Today is Glasgow Fair Monday - it's a public holiday dating from the 12th century or something, so I slept in, recovering from the last couple of days of activity. I might wander over to the fair later - the sun is out. I feel exhausted, but a walk to the fair is probably a good recovery idea to stop me from seizing up.

I had a productive weekend... in sightseeing terms.
Saturday the sights were obtained in Stirling. The first thing I noticed was that, in stark contrast with Glasgow, the streets were actually clean. It seemed to me to have more old nice buildings than Edinburgh, and the castle was more "castley" too. I went with Bhuvanesh again, but I ran into Josep who is a Croatian guy also visiting U. Glasgow who was in Cairncross House for a few days when I first arrived, so we all grouped up for the day.

There was some sort of falconry demonstration going on - why there was an owl there I don't know.


After the castle we walked to the Wallace monument


This dragon

lay at one end of the Bridge of Allan, along the way.
That was Saturday. Then, today I walked around town - went to the Gallery of modern art, which has what I assume is one of the few native parrots in Scotland

and then I went over to Glasgow cathedral,


St. Mungo's museum, the necropolis and wandered back through U. Strathclyde campus in anticipation of a visit there to talk about my BEC physics.
I took about 290 photos this weekend, which is a lot more than I have been taking.

Wolf crying championship training

I haven't heard the excuse yet, but last night's fire evacuation was at 4:30am, which seems to be during the non-REM part of my sleep cycle. By the time I leave here, I expect to have a complete sleep cycle map based on random sampling at various times of night. Off to Stirling to see the castle and Wallace monument tomorrow. I'm finally making some progress with my physics too, which is a relief.

A break in the rain

The rain left us alone on Friday, so a few of us decided to have a BBQ after work rather than go to a pub. This photo is taken at 9:45pm, so it's still light very late, and annoyingly very early too. I've never used a disposable BBQ before - I assume you can get them in Oz, although I've never noticed. Anyway it worked well enough. We thought we probably weren't supposed to use it in the park, but the police and council vehicles cruised by, took a look at us, and ignored us. Left-to-right: Barry, Alasdair and Daryl.

Saturday promised poor weather ... and delivered. So I went to see the Burrell collection, which was a nice day out - it's small, high quality and free (a museum/gallery by the way) that can be seen in an afternoon.

And on Sunday I became a couch potato and watched the very wet British F1 GP and the slightly wet Wimbledon men's final, whilst avoiding getting wet myself by cleverly not going outside.

Cry wolf part 2

This is what the local fire trucks (2 of them) look like outside the place I'm staying.
No, I didn't take this photo on the night of the last post -. I took it 10 minutes ago. At least the idiot smoking in their room had the decency to do so at a reasonable hour this time.