Polished analyze_dets.py.