How to use the larray.AxisCollection._key_to_raw_and_axes 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
# the advanced indexing subspace keep its position (insert at position of first concerned axis)
            adv_key_subspace_pos = adv_axes_indices[0]

        # scalar/slice keys are ignored by make_numpy_broadcastable, which is exactly what we need
        bcasted_adv_keys, adv_key_dest_axes = make_numpy_broadcastable(key)

        # insert advanced indexing subspace
        res_axes[adv_key_subspace_pos:adv_key_subspace_pos] = adv_key_dest_axes

    # transform to raw numpy arrays
    raw_broadcasted_key = tuple(k.data if isinstance(k, la.Array) else k
                                for k in bcasted_adv_keys)
    return raw_broadcasted_key, res_axes, transpose_indices


la.AxisCollection._key_to_raw_and_axes = _key_to_raw_and_axes