Sunday, June 28, 2009

Cheap Ticket?

I drive like my grandfather, and I am actually proud as I say that. I never go more than 7 miles/hr over the posted speed-limit, always check my blind-spots, and am not easily provoked.

That and other kosher things make my driving unremarkable, boring, safe, and is often enough to drive my wife nuts.

One night, recently, I made the mistake of saying to Priya, "Do you know, in a few months, it'll be 10 years without a single traffic ticket for me!"

The next day, as I was bicycling to work as usual, I got pulled over. This was on-campus at 6:15AM in the morning, when there was not a soul around. The officer stopped by next to me to inform me that I had "slowed down, but not stopped at the stop sign," and was going to write me a $153 ticket + 3 points on my drivers' license.

I kept muttering to myself, "God! Not like this! Not like this! At least give me the pleasure of doing something wrong before I am punished!"

Thankfully (really?) he let me off with just a warning. I've stopped boasting about my record since.

Saturday, June 27, 2009


I have been using Gnuplot as my workhorse plotting program, since the dawn of civilization. It is simple, powerful, can do quick-and-dirty 3D visualizations, can output to a variety of formats, is scriptable, can do nonlinear regressions, and on and on and on.

On the flip side, some would argue that there is a learning curve, and there definitely is. Call me old-fashioned, but nothing worthwhile is easy.

Due to its command-line driven nature, a lot of functionality is hidden behind the curtains, and I frequently find myself turning to Toshihiko Kawano's excellent site on "Gnuplot Not So Frequently-Asked-Questions"

Wednesday, June 24, 2009

How to: create an "inset plot" or subplots with Grace?

Grace is an amazing data-analysis/plotting software that I use all the time, to create "journal" or "presentation" quality pictures.

Gnuplot is my workhorse, Grace is what I use when I want to play polo.

Although it is limited to 2D plotting, the professional quality of the product, the ability to export to a bunch of different formats (eps in particular), and the fact that it is freely available under GPL, make it irresistible.

Every once in a while, I have to make plots with insets. Like the one shown here. Each time I have to do it, I spend 15 minutes figuring out how to do it, 10 minutes to do it, and 5 minute telling myself how I should write it down for next time. So here are step-by-step instructions.
  1. Data -> Import -> ASCII to open the "Grace:Read Sets" dialog box.
  2. Read in data (here I read in three data sets), and clean up, as usual to create Graph 1, which is labeled G[0].
  3. To create Graph 2, open the "Grace:Read Sets" dialog box again.
  4. In the "Read to Graph" portion the "(+) G0" graph is selected by default.
  5. Right click on the "(+) G0" to open up a menu.
  6. Select "Create new"
  7. Read in data that you want in this graph, as in step 2.
  8. At this point everything looks muddled, since both the graphs are superimposed. Later on, you can use mouse to select the appropriate graph, but right now, since they are almost on top of each other we need a different strategy.
  9. Go to "Plot -> Graph Appearence -> Viewport".
  10. Adjust the min and max values until desirable.
  11. Now go on, as before. Remember to check which graph is "active" before making any changes.

Update: Consider using Veusz; it has a much more modern feel. I wrote about how to do inset plots with Veusz here.

Tuesday, June 23, 2009

Without hot air

I've been recently doing some preliminary studies using a Bayesian formulation to tackle a hard inverse problem that had been sitting on my back-burner for a little too long. I'll have more to say about this, since this work is turning out quite nicely at the moment, and I have a really smart undergrad working on it.

One of the useful things about Bayesian methods is that they have an built-in Occam's razor, which naturally prefers simple models over more complex models. I was looking at some work done by David Mackay as part of his PhD thesis in 1991, when out of boredom I just googled his name to find out what he was up to now.

One thing I found was this fabulous resource. So far I have only read the 10-page synopsis and skimmed through the rest of the introduction, and wish I knew about it before. As it turns out, I taught undergrad thermodynamics three years in a row, and initially struggled with what I should assign for the first homework. These days I make them do a survey on recent topics relating to the energy crisis we face. While there are a tons of resources, and a plethora of information, it is nice to have some of that distilled into knowledge and wisdom, which is what this book (freely available as pdf) does.

Monday, June 22, 2009

Taking Stock

These days I find myself browsing a lot of financial websites, hoping to catch the next big slide. No, my intention is not really to avoid it, since I have a full-time job and don't believe in market timing anyway. But really, to do some bottom fishing once the party starts. I thought I'd bookmark some of the sites I visit often, in no particular order.

Yahoo Finance: I started using this a long time ago, when I bought my first few shares on the stock market in 2001. I retain only and was foolish not to take a significant position. Anyway I was (am?) still learning.

Seeking Alpha: Really a anthology of random blogs. It is funny these days I turn to blogs and the comments section of mainstream media articles for more nuanced information (financial or political).

Investopedia: Lots of fundas, written legibly. It also has a nice collection of articles on recent happenings, but like I said - it is best for knowledge, not information.

wikinvest: Wikipedia's little brother. I like the relatively clean interface (not as advertizementless as wikipedia), and contains fairly good information on liquid stocks.

gurufocus: Good place to see what investors I admire are up to.

Motley Fool: Used to be a vastly superior site. Now it reeks of commercialism. They want to sell you something every step of the way. But still, CAPS is a good filter for good ideas.

Other value investing blogs I like are here, here and here.