def fit_shifts(xy, uv, wxy=None, wuv=None):
    " Fits (non-iteratively and without sigma-clipping) a displacement\n    transformation only between input lists of positions ``xy`` and ``uv``.\n    When weights are provided, a weighted fit is performed. Parameter\n    descriptions and return values are identical to those in `iter_linear_fit`,\n    except returned ``fit`` dictionary does not contain the following\n    keys irrelevant to this function: ``'center'``, ``'fitmask'``, and\n    ``'eff_nclip'``.\n\n    "
    if (xy.size == 0):
        raise NotEnoughPointsError('At least one point is required to find shifts.')
    diff_pts = np.subtract(xy, uv, dtype=np.longdouble)
    if ((wxy is None) and (wuv is None)):
        w = None
        meanx = diff_pts[:, 0].mean(dtype=np.longdouble)
        meany = diff_pts[:, 1].mean(dtype=np.longdouble)
    else:
        if (wxy is None):
            w = np.array(wuv, dtype=np.longdouble)
        elif (wuv is None):
            w = np.array(wxy, dtype=np.longdouble)
        else:
            wuv = np.array(wuv, dtype=np.longdouble)
            wxy = np.array(wxy, dtype=np.longdouble)
            m = np.logical_and((wuv > 0), (wxy > 0))
            w = np.zeros_like(wuv)
            w[m] = ((wxy[m] * wuv[m]) / (wxy[m] + wuv[m]))
        if np.any((w < 0.0)):
            raise ValueError('Invalid weights: weights must be non-negative.')
        if (not np.sum((w > 0), dtype=np.int)):
            raise ValueError("Not enough valid data for 'shift' fit: too many weights are zero!")
        w /= np.sum(w, dtype=np.longdouble)
        meanx = np.dot(w, diff_pts[:, 0])
        meany = np.dot(w, diff_pts[:, 1])
    p = np.array([1.0, 0.0, meanx], dtype=np.longdouble)
    q = np.array([0.0, 1.0, meany], dtype=np.longdouble)
    fit = _build_fit(p, q, 'shift')
    resids = (diff_pts - fit['shift'])
    fit['resids'] = resids.astype(np.double)
    _compute_stat(fit, residuals=resids, weights=w)
    return fit
Fits (non-iteratively and without sigma-clipping) a displacement
transformation only between input lists of positions ``xy`` and ``uv``.
When weights are provided, a weighted fit is performed. Parameter
descriptions and return values are identical to those in `iter_linear_fit`,
except returned ``fit`` dictionary does not contain the following
keys irrelevant to this function: ``'center'``, ``'fitmask'``, and
``'eff_nclip'``.
def fit_shifts(xy, uv, wxy=None, wuv=None):
    " Fits (non-iteratively and without sigma-clipping) a displacement\n    transformation only between input lists of positions ``xy`` and ``uv``.\n    When weights are provided, a weighted fit is performed. Parameter\n    descriptions and return values are identical to those in `iter_linear_fit`,\n    except returned ``fit`` dictionary does not contain the following\n    keys irrelevant to this function: ``'center'``, ``'fitmask'``, and\n    ``'eff_nclip'``.\n\n    "
    if (xy.size == 0):
        raise NotEnoughPointsError('At least one point is required to find shifts.')
    diff_pts = np.subtract(xy, uv, dtype=np.longdouble)
    if ((wxy is None) and (wuv is None)):
        w = None
        meanx = diff_pts[:, 0].mean(dtype=np.longdouble)
        meany = diff_pts[:, 1].mean(dtype=np.longdouble)
    else:
        if (wxy is None):
            w = np.array(wuv, dtype=np.longdouble)
        elif (wuv is None):
            w = np.array(wxy, dtype=np.longdouble)
        else:
            wuv = np.array(wuv, dtype=np.longdouble)
            wxy = np.array(wxy, dtype=np.longdouble)
            m = np.logical_and((wuv > 0), (wxy > 0))
            w = np.zeros_like(wuv)
            w[m] = ((wxy[m] * wuv[m]) / (wxy[m] + wuv[m]))
        if np.any((w < 0.0)):
            raise ValueError('Invalid weights: weights must be non-negative.')
        if (not np.sum((w > 0), dtype=np.int)):
            raise ValueError("Not enough valid data for 'shift' fit: too many weights are zero!")
        w /= np.sum(w, dtype=np.longdouble)
        meanx = np.dot(w, diff_pts[:, 0])
        meany = np.dot(w, diff_pts[:, 1])
    p = np.array([1.0, 0.0, meanx], dtype=np.longdouble)
    q = np.array([0.0, 1.0, meany], dtype=np.longdouble)
    fit = _build_fit(p, q, 'shift')
    resids = (diff_pts - fit['shift'])
    fit['resids'] = resids.astype(np.double)
    _compute_stat(fit, residuals=resids, weights=w)
    return fit