Commit fbd95e94 authored by Jait Dixit's avatar Jait Dixit
Browse files

Fix docstring

parent df910a75
Pipeline #3174 skipped
...@@ -7,23 +7,38 @@ from itertools import product ...@@ -7,23 +7,38 @@ from itertools import product
def get_slice_list(shape, axes): def get_slice_list(shape, axes):
""" """
Yields a slice list which can be passed directly to d2o object or Helper function which generate slice list(s) to traverse over all
numpy.ndarray to extract that slice of data. combinations of axes, other than the selected axes. This is used in
conjunction with outer-product spaces. The generated slice list can
:shape: Tuple passed to the target outer-product space to extract the selected
Shape of the target d2o object or numpy.ndarray data. The target outer-product space can be either a d2o object or
:axes: Tuple a numpy.ndarray.
Axes which are to be extracted
:returns: List Parameters
List of indices and/or slice objects ----------
shape: tuple
Shape of the target d2o object or numpy.ndarray.
axes: tuple
Axes along which data needs to be extracted.
Yields
-------
list
The next list of indices and/or slice objects for each dimension.
Raises
------
ValueError
If shape is empty.
ValueError
If axes(axis) does not match shape.
""" """
if not shape: if not shape:
raise ValueError(about._errors.cstring("ERROR: shape cannot be None.")) raise ValueError(about._errors.cstring("ERROR: shape cannot be None."))
if not all(axis < len(shape) for axis in axes): if not all(axis < len(shape) for axis in axes):
raise ValueError( raise ValueError(
about._errors.cstring("ERROR: axes(axis) do not match shape.") about._errors.cstring("ERROR: axes(axis) does not match shape.")
) )
axes_select = [0 if x in axes else 1 for x, y in enumerate(shape)] axes_select = [0 if x in axes else 1 for x, y in enumerate(shape)]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment