Archive for the 'physics' Category

Physics report with LyX + JabRef + Inkscape

Tuesday, August 18th, 2009

To anyone doing an undergraduate degree in physics – download and learn to use these three programs:

  • LyX: A frontend for LaTeX,  specially designed for people who don’t like LaTeX. You could consider it “training wheels for LaTeX”, but if you learn it well you’ll probably never need to learn full-on LaTeX.
  • JabREF: A reference manager for making Bibtex bibliographies. It plays nice with LyX, and you can use it to organise all those papers you read just for fun.
  • Inkscape: A vector graphics program (SVG). Super useful for making diagrams to put into LaTeX. If you’re using LyX, the best option is to save your files as PDF when you want to insert them into LyX.

These are all free, and cross-platform. Note that for LyX, you’ll need to download TeX as well. Just follow the instructions on the lyx download page and you should be fine. The only other thing you’ll need is a graphing program: I’d recommend Mathematica, MATLAB and OriginPro (note: not free).

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 .