RectGrid.insert

RectGrid.insert(index, *grids)[source]

Return a copy with grids inserted before index.

The given grids are inserted (as a block) into self, yielding a new grid whose number of dimensions is the sum of the numbers of dimensions of all involved grids. Note that no changes are made in-place.

Parameters:
indexint

The index of the dimension before which grids are to be inserted. Negative indices count backwards from self.ndim.

grid1, ..., gridNRectGrid

The grids to be inserted into self.

Returns:
newgridRectGrid

The enlarged grid.

See also

append

Examples

>>> g1 = RectGrid([0, 1], [-1, 0, 2])
>>> g2 = RectGrid([1], [-6, 15])
>>> g1.insert(1, g2)
RectGrid(
    [ 0.,  1.],
    [ 1.],
    [ -6.,  15.],
    [-1.,  0.,  2.]
)
>>> g1.insert(1, g2, g2)
RectGrid(
    [ 0.,  1.],
    [ 1.],
    [ -6.,  15.],
    [ 1.],
    [ -6.,  15.],
    [-1.,  0.,  2.]
)