Recently, I was working on an exam for a lab course, and wanted to ask a few questions about basic reaction setups. I had a harder time putting together simple figures than I would have expected. ChemDraw has some half-decent options but they’re useless if you need something they don’t already have and, let’s face it, those 3D flasks with the little logos are just trying to hard. After a few frustrating hours, I gave up, and decided that it wouldn’t be so hard to throw together the basics on my own.
Here I thought I’d go through the script and explain its logic. The idea is that it could be modified to fit whatever format you get your MC output in or to change the information that it returns, hopefully even without a lot of programming experience.
Let me say at the outset that this was one of my first little Python projects. I make no claims that it’s particularly elegant or pythonic; in fact, I have plans for a newer version that will be a bit better organized. Criticisms always appreciated. That said, it does get the job done.
The script is written in Python. I decided to pick it up a few years ago as a way to get back into simple computer programming and haven’t looked back. I use it a lot for little projects like this one and for some simple applications in my group’s publications (like nonlinear curve fitting). Unfortunately, Python’s not a compiled language so you’ll have to have it installed in order to use the script, which is written in Python 3, not Python 2.[1. Right now a slow transition is taking place from Python 2 to 3. There’s still a lot done in 2, but I chose to learn 3 because my need for external packages is limited. Also, Python 3 is the scripting language for Blender, which will be the subject of many future posts.]
In an ideal world, I think we’d all prefer faculty-graded, free-response style exams. Unfortunately, that’s just not really realistic for a chemistry professor teaching large service classes.[1. The largest classes I’ve taught have up to about 200 students.] While we do use online homework for the classes I teach, we’re not really set up to use these sorts of systems as a primary assessment tool. That leaves, of course, machine-graded, multiple choice (MC) as the go-to format for most (but not all) of my exam questions.