IntervalProd¶
-
class
odl.set.domain.
IntervalProd
(min_pt, max_pt)[source]¶ Bases:
odl.set.sets.Set
An n-dimensional rectangular box.
An interval product is a Cartesian product of n intervals, i.e. an n-dimensional rectangular box aligned with the coordinate axes as a subset of the n-dimensional Euclidean space.
IntervalProd
objects are immutable, hence all manipulation methods return a new instance.- Attributes
area
Area of this rectangle (valid if
ndim == 2
).examples
Generator creating name-value pairs of set elements.
extent
Return the vector of interval lengths per axis.
length
Length of this interval (valid for
ndim == 1
).max_pt
Right interval boundaries of this interval product.
mid_pt
Midpoint of this interval product.
min_pt
Left interval boundaries of this interval product.
ndim
Number of intervals in the product.
nondegen_byaxis
Boolean array with
True
entries for non-degenerate axes.true_ndim
Number of non-degenerate (positive-length) intervals.
volume
ndim
-dimensional volume of this interval product.
Methods
append
(self, \*intvs)Insert
intvs
at the end as a block.approx_contains
(self, point, atol)Return
True
ifpoint
is “almost” contained in this set.approx_equals
(self, other, atol)Return
True
ifother
is equal to this set up toatol
.collapse
(self, indices, values)Partly collapse the interval product to single values.
contains_all
(self, other[, atol])Return
True
if all points defined byother
are contained.contains_set
(self, other[, atol])Return
True
ifother
is (almost) contained in this set.corners
(self[, order])Return the corner points as a single array.
dist
(self, point[, exponent])Return the distance of
point
to this set.element
(self[, inp])Return an element of this interval product.
insert
(self, index, \*intvs)Return a copy with
intvs
inserted beforeindex
.max
(self)Return the maximum point of this interval product.
measure
(self[, ndim])Return the Lebesgue measure of this interval product.
min
(self)Return the minimum point of this interval product.
squeeze
(self)Remove the degenerate dimensions.
-
__init__
(self, min_pt, max_pt)[source]¶ Initialize a new instance.
- Parameters
- min_pt, max_ptfloat or
array-like
Vectors of lower/upper ends of the intervals in the product.
- min_pt, max_ptfloat or
Examples
>>> min_pt, max_pt = [-1, 2.5, 70], [-0.5, 10, 75] >>> rbox = odl.IntervalProd(min_pt, max_pt) >>> rbox IntervalProd([ -1. , 2.5, 70. ], [ -0.5, 10. , 75. ])