Fixed up apply_cal.py a bit, added some command-line options, and used preferred aipy idioms.