detect_threshold