def circle_residual(params, xedge, yedge):
    """Residuals for circle fitting

    Parameters
    ----------
    params: lmfit.Parameters
        Must contain the keys:

        - "cx": origin of x coordinate [px]
        - "cy": origin of y coordinate [px]
    xedge: 1D np.ndarray
        Edge coordinates x [px]
    yedge: 1D np.ndarray
        Edge coordinates y [px]

    Returns
    -------
    rad_dev: 1D np.ndarray
        Deviation of radii from average radius
    """
    radii = circle_radii(params, xedge, yedge)
    return radii - np.mean(radii)
Residuals for circle fitting

    Parameters
    ----------
    params: lmfit.Parameters
        Must contain the keys:

        - "cx": origin of x coordinate [px]
        - "cy": origin of y coordinate [px]
    xedge: 1D np.ndarray
        Edge coordinates x [px]
    yedge: 1D np.ndarray
        Edge coordinates y [px]

    Returns
    -------
    rad_dev: 1D np.ndarray
        Deviation of radii from average radius