Return the 2D field averaged radially w.r.t. the center

def interpolate_grid(cin, cout, data, fillval=0):
    """Return the 2D field averaged radially w.r.t. the center"""
    if np.iscomplexobj(data):
        phase = interpolate_grid(
            cin, cout, unwrap.unwrap_phase(np.angle(data)), fillval=0)
        ampli = interpolate_grid(cin, cout, np.abs(data), fillval=1)
        return ampli * np.exp(1j * phase)

    ipol = spinterp.interp2d(x=cin[0], y=cin[1], z=data,
                             kind="linear",
                             copy=False,
                             bounds_error=False,
                             fill_value=fillval)
    return ipol(cout[0], cout[1])