def _get_legen_lut_fast(x, lut, block=None):
    # map into table vals (works for both vals and deriv tables)
    n_interp = (lut.shape[0] - 1.0)
    # equiv to "(x + 1.0) / 2.0) * n_interp" but faster
    mm = x * (n_interp / 2.0)
    mm += 0.5 * n_interp
    # nearest-neighbor version (could be decent enough...)
    idx = np.round(mm).astype(int)
    if block is None:
        vals = lut[idx]
    else:  # read only one block at a time to minimize memory consumption
        vals = lut[idx, :, block]
    return vals
Test XML rendering.
dataset/ETHPy150Open mne-tools/mne-python/mne/forward/_lead_dots.py/_get_legen_lut_fast--crossover with--dataset/ETHPy150Open jpadilla/django-rest-framework-xml/tests/test_renderers.py/XMLRendererTestCase.test_render_string