def residuals_dis(param, points, ns):
    """Residual function for distortions.

    Parameters
    ----------
        param : np.ndarray
            Parameters for distortion.
        points : np.ndarray
            Points to fit to.
        ns : tuple
            List of orders to account for.

    Returns
    -------
        : np.ndarray
           Residuals.
    """

    est = param[0]*np.ones(points[:, 1].shape)
    for i in range(len(ns)):
        est *=rad_dis(points[:, 1], param[i*2+1], param[i*2+2], ns[i])