def view_cascade(data, view):
    shp = data.shape
    v2 = list(view)
    logging.debug("image shape: %s, view: %s", shp, view)

    # choose stride length that roughly samples entire image
    # at roughly the same pixel count
    step = max(shp[i - 1] * v.step // max(v.stop - v.start, 1)
               for i, v in enumerate(view) if isinstance(v, slice))
    step = max(step, 1)

    for i, v in enumerate(v2):
        if not(isinstance(v, slice)):
            continue
        v2[i] = slice(0, shp[i - 1], step)

    return tuple(v2), view
The Deferred returned by callRemote can be cancelled while waiting on a
dataset/ETHPy150Open glue-viz/glue/glue/utils/matplotlib.py/view_cascade--crossover with--dataset/ETHPy150Open flowroute/txjason/txjason/tests/test_netstring.py/ClientTestCase.test_callRemote_cancellation_during_request