Archive for the 'scripts' Category

UWA Physics LyX Thesis template

Tuesday, August 18th, 2009

In my honours at UWA (2008), I was the lone cowboy who decided to LyX instead of LaTeX. It saved me a shitload of time and LaTeX related anguish. As such, I thought I’d offer a UWA Thesis Template up to give a helping hand to anyone else who wants to give LyX  a stab. In retrospect, there’s a few things I did dodgy along the way (I was pretty stressed out though, in my defense). Even so, I reckon it’ll be useful for some.

A few hot tips:

  • Press Ctrl + L to manually enter LaTeX, whenever you can’t do it out-of-the-box
  • Press Ctrl + M to enter maths mode
  • Learn all the maths shortcut key combinations (e.g. press Alt + M, then F to input a fraction)
  • Watch some youtube videos, like this one, to help you get up to speed

Good luck…

Download LyX template »

Anritsu VNA Python Script

Wednesday, May 27th, 2009

I spent a lot of time in the lab last month, taking measurements with an Anritsu 37xxxC series VNA. It would’ve taken me even longer if I hadn’t made this little python script to control the VNA over GPIB. All it does it open a connection, grab the data off and then write it to a CSV file. The magic lines you need to know:

## Open a connection to the VNA
VNA = visa.instrument("GPIB::06")

## Select a channel
VNA.write("CH1")

## Get frequency data
freq = VNA.ask_for_values("OFV")

## Get channel data
S11 = VNA.ask_for_values("OFD")

If you’re lazy just run the grabData script and voila. If you’re not, try editing the grabData() function to your needs and script away.

To get this to work, you’ll need Python 2.5, pyVisa and the relevant NI drivers (488.2 and for me the ones for the UBS-GPIB thing). There’s some useful documentation on the Anritsu site here. Kudos to Oliver King for his help .