How to use the larray.sequence function in larray

To help you get started, we’ve selected a few larray examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github liam2 / liam2 / liam2 / larray_monkey.py View on Github external
def slice_to_sequence(axis, axis_key):
        if isinstance(axis_key, slice) and axis in la_key_axes:
            # TODO: sequence assumes the axis in the la_key is in the same order. It will be easier to solve when
            # make_numpy_broadcastable automatically aligns all arrays
            start, stop, step = axis_key.indices(len(axis))
            return la.sequence(axis.subaxis(axis_key), initial=start, inc=step)
        else:
            return axis_key