Category Archives: Tools of the Trade

Tools of the Trade

Advanced Bash Scripting

I have written before about the usefulness of command-line scripting in computational science.

Today, while looking for some information on various file test operators in bash (e.g. to check whether a file or directory exists), I found this amazing guide. As the author puts it,

This tutorial assumes no previous knowledge of scripting or programming, but progresses rapidly toward an intermediate/advanced level of instruction . . . all the while sneaking in little snippets of UNIX® wisdom and lore. It serves as a textbook, a manual for self-study, and a reference and source of knowledge on shell scripting techniques.

For instructional purposes, all along the examples have little comments like, “explain why this is the case…”, to test your knowledge as you go through the manual. This would make it excellent for use as textbook on basic programming ideas. It is even available in PDF format, and was updated March 18th of 2008.

I can assure you that every new member of the lab will be getting a link to this guide from me. Proper knowledge of shell scripting is an amplifier of one’s productivity. An investment of a few hours learning the basics will probably return a hundred-fold savings of time over a few months. More advanced concepts are naturally learned as more difficult scenarios are encountered. I’ll be writing soon about some of the more sophisticated issues I’ve encountered using shell scripting.

CESE Single-Cell Simulator

I recently discovered an interesting piece of open-source software, the CESE single-cell simulator. It’s based on Java and runs on a number of platforms.

The point of this simulator is strictly to run single-cell electrophysiological models. It comes with a few of the staples in the field (like the Luo-Rudy dynamic model), and you can buy more recent/complex models from a company called Simulogic. Alternatively, there are directions on the site for designing your own models.

Unfortunately, the program currently displays the output of all of the selected variables on the same plot, rather than breaking the plot into several panels, one for each current. The latter is the way we typically look at model data. Furthermore, I don’t see a way to import experimental data traces for comparison. I also had some rendering issues with pull-down selectors in Mac OS X’s Java implementation.

We currently have our own single-cell simulator with an ugly but functional GUI, linked to the ionic models in our tissue simulator. However, it might be nice going forward to make our models compatible with CESE, and to work with the CESE developers to improve the view mode. It would be nice to have CESE as a standard platform for model development.

If you want to download it and try it out, you just need a working Java installation, and you can get CESE itself here. Check the built-in help for a tutorial.

Have you used CESE before? What did you think? If you download it and try it out, please post something about your experience here as well (or email me).

How to Cook a Server (Sunny Side Up?)

Last night, just as I was falling asleep, I heard my phone ring out a text message tone. (Incidentally, it’s this sound, a customized version of one found on the Monty Python website. It can be startling.)

I leaned over to look at it. The head node from the cluster was checking in to let me know it was feeling a little warm (80 degrees F). The temperature in our server room keeps creeping up. Today it was blamed on a campus-wide chilled-water problem. The cluster is only using about 1/4 of the cooling capacity in the server room, and is almost the only machine in there. We should not be having these problems.

I use the IPMI capabilities of the head node to check the internal sensor every ten minutes, and it emails and texts me if the temperature exceeds some threshold. It is hard, though, to get a good idea of what’s going on from a single temperature at a single time. Has the temp been slowly rising? Has it jumped from 77 to 95 in ten minutes?

To make this easier to check, I wrote a little script that generates a plot based on the last 24 hours of my temperature log. You can see the results below. The image below is pulled straight from the cluster, so it should be up to date regardless of when you’re viewing this post. If you’re looking at it pretty shortly after this is posted, you can still see the spike that woke me up and the sharper one that got me worried this morning.

temperature plot over the last 24 hours

The temperature is of course not jumping like that — the precision of the sensor is limited. The rightmost edge is “now”, if that’s not clear. I used xmgrace to produce this plot from the command line / script. If you’d like any of the code for this let me know.

What are the best utilities in Mac OS X?

There are whole websites dedicated to answering these kinds of questions. However, for the kind of work I do as a computational scientist, I have found some favorites over the last seven years of using Mac OS X. From now on, my current favorites with brief rationale for each one will be posted on the tools page of this blog. That page has also been added to the navigation bar at the top.

Please let me know if your favorites differ from mine and why — there might be a better program out there that I’m missing out on!