RectPartition.insert

RectPartition.insert(self, index, \*parts)[source]

Return a copy with parts inserted before index.

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

Parameters
indexint

Index of the dimension before which other is to be inserted. Negative indices count backwards from self.ndim.

part1, …, partNRectPartition

Partitions to be inserted into self.

Returns
newpartRectPartition

The enlarged partition.

See also

append

Examples

>>> part1 = odl.uniform_partition([0, -1], [1, 2], (3, 3))
>>> part2 = odl.uniform_partition(0, 1, 5)
>>> part1.insert(1, part2)
uniform_partition([ 0.,  0., -1.], [ 1.,  1.,  2.], (3, 5, 3))