FIX: move corner detection outside loop in test_num_peaks.