Generalized Residual Ratio Thresholding