def optimize_center(points, center, maxfev=1000, verbose=None):
    """Optimize the center by minimizing the sum of square deviations from the mean radial distance.

    Parameters
    ----------
        points : np.ndarray
            The points to which the optimization is done (x,y coords in org image).
        center : np.ndarray or tuple
            Initial center guess.
        maxfev : int
            Max number of iterations forwarded to scipy.optimize.leastsq().
        verbose : bool
            Set to get verbose output.

    Returns
    -------
        : np.ndarray
            The optimized center.

    """

    try:
        # points have to be 2D array with 2 columns
        assert(isinstance(points, np.ndarray))
        assert(points.shape[1] == 2)
        assert(len(points.shape) == 2)