Category Archives: Physics

Energy level ladder plots made trivial

I have written a simple but fairly nice script for generating energy level ladder plots. It uses matplotlib on python.

An energy levels plot

A generic energy levels ladder plot

You feed it a file with some energy parameters and pairs of energy levels and descriptors and get a consistent graph out of it which can be saved as a raster or vector graphic. These plots are sort of hard to do consistently in Excel and the like.

You can grab the files here.

The archives consist of the script, some examples and the manual. You will need python 2.6 and matplotlib. Older versions may work but are untested.

I hope someone finds this useful, as I certainly do.

The package is released under the GPL.

Edit: I have updated the package to fix a bug which interfered with rendering of *.pdf files in Adobe Reader 8

Cosmic rays and RAM

I’m writing up some stuff on tiny numerical discrepancies in some hardware benchmarks I’ve been performing. At the moment I’ve chalked them up to pseudorandom numbers being introduced into the calculations by the algorithm in use or maybe slight differences in floating point arithmetic between the ostensibly identical compute nodes I’m testing.

I have written a little bit on why memory corruption is unlikely to be the culprit, and remembered something I read a while back about cosmic rays being a nontrivial source of – ahem – random bit-flips in RAM without error correction.

This gets me thinking – would horizontal vs. vertical orientation of RAM DIMMs change the likelihood of cosmic ray collision to any significant degree?

It’s my understanding that most cosmic rays / secondary shower particles that reach the ground come in at steep angles (less intervening atmosphere to potentially interact with), so I’m wondering if in the olden days anyone mounted RAM/other components edge on with respect to this preferred direction of attack…

(I recall reading Dan Rutter discussing the cargo cult computer configuration (CCCC!) that went on in days gone by, when people always span up hard disk drives on the same axis (with respect to gravity) they were formatted in. Very interesting, not sure how necessary it actually would have been)

Blackbody Curves

Something I worked on last night. Wrote a program to generate relative radiance curves for ideal blackbodies at different temperatures from Planck’s Law, used Excel to graph them and then embellished in Photoshop. These emission curves explain why very hot objects become incandescent, and the integrals of these curves determine their colour (cooler objects glow dull red, hot objects glow yellow-orange, and very hot objects glow blue-white). The gradient is modified from David Eccles’ normalised linear spectrum, which was released to the public domain. My modifications mean that the spectrum is only qualitatively correct, placing more emphasis on yellow.

Blackbody emission curves for various temperatures

Blackbody emission curves via Planck's Law at 3000, 4000 and 5000 K - cc-by-sa 3.0

This adventure was inspired by an exercise in my ancient copy of Atkins Physical Chemistry, which asks readers to write a program that outputs blackbody spectra and optionally numerically integrates them. There’s also a question involving a glow worm being propelled through space via photon momentum, quite a charming imagination 😀