calibrate.py streamline

streamlined code according to David's suggestions