Module Import alias identifier FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad If CompareLtE NameLoad NameLoad body Return BinOpMult ListLoad Call NameLoad NameLoad NameLoad Assign NameStore BinOpMult BinOpPow BinOpDiv NameLoad NameLoad BinOpDiv Num NameLoad Call AttributeLoad NameLoad attr NameLoad If Call AttributeLoad CompareLt NameLoad NameLoad attr body For NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice BinOpAdd NameLoad Num Assign SubscriptStore NameLoad Slice BinOpAdd NameLoad Num BinOpPow BinOpDiv NameLoad NameLoad BinOpDiv Num BinOpSub BinOpSub NameLoad NameLoad Num If Call AttributeLoad CompareGtE NameLoad NameLoad attr body Break Assign NameStore Call AttributeLoad BinOpFloorDiv NameLoad Num attr NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr NameLoad Assign NameStore ListComp Call NameLoad NameLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Assign NameStore ListComp SubscriptLoad NameLoad Index NameLoad comprehension NameStore NameLoad Return NameLoad decorator_list
N/A N/A numpy np regular_grid N/A N/A ar_shape n_points N/A N/A N/A Find `n_points` regularly spaced along `ar_shape`.

    The returned points (as slices) should be as close to cubically-spaced as
    possible. Essentially, the points are spaced by the Nth root of the input
    array size, where N is the number of dimensions. However, if an array
    dimension cannot fit a full step size, it is "discarded", and the
    computation is done for only the remaining dimensions.

    Parameters
    ----------
    ar_shape : array-like of ints
        The shape of the space embedding the grid. ``len(ar_shape)`` is the
        number of dimensions.
    n_points : int
        The (approximate) number of points to embed in the space.

    Returns
    -------
    slices : list of slice objects
        A slice along each dimension of `ar_shape`, such that the intersection
        of all the slices give the coordinates of regularly spaced points.

    Examples
    --------
    >>> ar = np.zeros((20, 40))
    >>> g = regular_grid(ar.shape, 8)
    >>> g
    [slice(5, None, 10), slice(5, None, 10)]
    >>> ar[g] = 1
    >>> ar.sum()
    8.0
    >>> ar = np.zeros((20, 40))
    >>> g = regular_grid(ar.shape, 32)
    >>> g
    [slice(2, None, 5), slice(2, None, 5)]
    >>> ar[g] = 1
    >>> ar.sum()
    32.0
    >>> ar = np.zeros((3, 20, 40))
    >>> g = regular_grid(ar.shape, 8)
    >>> g
    [slice(1, None, 3), slice(5, None, 10), slice(5, None, 10)]
    >>> ar[g] = 1
    >>> ar.sum()
    8.0
     N/A ar_shape N/A N/A np asanyarray ar_shape N/A ndim N/A len ar_shape N/A unsort_dim_idxs N/A N/A np argsort N/A N/A np argsort ar_shape N/A sorted_dims N/A N/A np sort ar_shape N/A space_size N/A float N/A N/A np prod ar_shape N/A N/A space_size n_points N/A N/A N/A N/A N/A slice None ndim N/A stepsizes N/A N/A N/A space_size n_points N/A 1.0 ndim N/A N/A np ones ndim N/A N/A N/A N/A sorted_dims stepsizes any N/A N/A dim N/A range ndim N/A N/A N/A stepsizes N/A dim N/A sorted_dims N/A dim N/A space_size N/A float N/A N/A np prod N/A sorted_dims N/A N/A dim 1 N/A N/A stepsizes N/A N/A dim 1 N/A N/A space_size n_points N/A 1.0 N/A N/A ndim dim 1 N/A N/A N/A N/A sorted_dims stepsizes all N/A N/A N/A starts N/A N/A N/A stepsizes 2 astype int N/A stepsizes N/A N/A N/A N/A np round stepsizes astype int N/A slices N/A N/A slice start None step N/A N/A start step N/A zip starts stepsizes N/A slices N/A N/A slices N/A i N/A i unsort_dim_idxs N/A slices N/A