def correct_rytov_output(radius, sphere_index, medium_index, radius_sampling):
    r"""Error-correction of refractive index and radius for Rytov

    This method corrects the fitting results for `radius`
    :math:`r_\text{Ryt}` and `sphere_index` :math:`n_\text{Ryt}`
    obtained using :func:`qpsphere.models.rytov` using
    the approach described in :cite:`Mueller2018` (eqns. 3,4, and 5).

    .. math::

        n_\text{Ryt-SC} &= n_\text{Ryt} + n_\text{med} \cdot
                           \left( a_n x^2 + b_n x + c_n \right)

        r_\text{Ryt-SC} &= r_\text{Ryt} \cdot
                           \left( a_r x^2 +b_r x + c_r \right)

        &\text{with} x = \frac{n_\text{Ryt}}{n_\text{med}} - 1

    The correction factors are given in
    :data:`qpsphere.models.mod_rytov_sc.RSC_PARAMS`.

    Parameters
    ----------
    radius: float
        Fitted radius of the sphere :math:`r_\text{Ryt}` [m]
    sphere_index: float
        Fitted refractive index of the sphere :math:`n_\text{Ryt}`
    medium_index: float
        Refractive index of the surrounding medium :math:`n_\text{med}`
    radius_sampling: int
        Number of pixels used to sample the sphere radius when
        computing the Rytov field.

    Returns
    -------
    radius_sc: float
        Systematically corrected radius of the sphere
        :math:`r_\text{Ryt-SC}` [m]
    sphere_index_sc: float
        Systematically corrected refractive index of the sphere
        :math:`n_\text{Ryt-SC}`

    See Also
    --------
    correct_rytov_sc_input: the inverse of this method
    """
    params = get_params(radius_sampling)

    x = sphere_index / medium_index - 1

    radius_sc = radius * (params["ra"] * x**2
                          + params["rb"] * x
                          + params["rc"])

    sphere_index_sc = sphere_index + medium_index * (params["na"] * x**2
                                                     + params["nb"] * x)

    return radius_sc, sphere_index_sc
r"""Error-correction of refractive index and radius for Rytov

    This method corrects the fitting results for `radius`
    :math:`r_\text{Ryt}` and `sphere_index` :math:`n_\text{Ryt}`
    obtained using :func:`qpsphere.models.rytov` using
    the approach described in :cite:`Mueller2018` (eqns. 3,4, and 5).

    .. math::

        n_\text{Ryt-SC} &= n_\text{Ryt} + n_\text{med} \cdot
                           \left( a_n x^2 + b_n x + c_n \right)

        r_\text{Ryt-SC} &= r_\text{Ryt} \cdot
                           \left( a_r x^2 +b_r x + c_r \right)

        &\text{with} x = \frac{n_\text{Ryt}}{n_\text{med}} - 1

    The correction factors are given in
    :data:`qpsphere.models.mod_rytov_sc.RSC_PARAMS`.

    Parameters
    ----------
    radius: float
        Fitted radius of the sphere :math:`r_\text{Ryt}` [m]
    sphere_index: float
        Fitted refractive index of the sphere :math:`n_\text{Ryt}`
    medium_index: float
        Refractive index of the surrounding medium :math:`n_\text{med}`
    radius_sampling: int
        Number of pixels used to sample the sphere radius when
        computing the Rytov field.

    Returns
    -------
    radius_sc: float
        Systematically corrected radius of the sphere
        :math:`r_\text{Ryt-SC}` [m]
    sphere_index_sc: float
        Systematically corrected refractive index of the sphere
        :math:`n_\text{Ryt-SC}`

    See Also
    --------
    correct_rytov_sc_input: the inverse of this method