def tk_uv(tau, k):
    """
    Convert the Hudson tau, k parameters to the Hudson u, v parameters

    Args
        tau: float, Hudson tau parameter
        k: float, Hudson k parameter

    Returns
        (float, float): u, v tuple
    """
    try:
        u = tau.copy()
        v = k.copy()
        idx = (tau > 0) * (k > 0) * (tau < 4 * k)
        u[idx] = tau[idx] / (1 - tau[idx] / 2)
        v[idx] = k[idx] / (1 - tau[idx] / 2)
        idx = (tau > 0) * (k > 0) * ~(tau < 4 * k)
        u[idx] = tau[idx] / (1 - 2 * k[idx])
        v[idx] = k[idx] / (1 - 2 * k[idx])
        idx = (tau < 0) * (k < 0) * (tau > 4 * k)
        u[idx] = tau[idx] / (1 + tau[idx] / 2)
        v[idx] = k[idx] / (1 + tau[idx] / 2)
        idx = (tau < 0) * (k < 0) * ~(tau > 4 * k)
        u[idx] = tau[idx] / (1 + 2 * k[idx])
        v[idx] = k[idx] / (1 + 2 * k[idx])
    except Exception:
        if tau > 0 and k > 0:
            if tau < 4 * k:
                u = tau / (1 - tau / 2)
                v = k / (1 - tau / 2)
            else:
                u = tau / (1 - 2 * k)
                v = k / (1 - 2 * k)
        elif tau < 0 and k < 0:
            if tau > 4 * k:
                u = tau / (1 + tau / 2)
                v = k / (1 + tau / 2)
            else:
                u = tau / (1 + 2 * k)
                v = k / (1 + 2 * k)
        else:
            u = tau
            v = k
    return u, v
