IntervalProd¶
- class odl.set.domain.IntervalProd(min_pt, max_pt)[source]¶
Bases:
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
(*intvs)Insert
intvs
at the end as a block.approx_contains
(point, atol)Return
True
ifpoint
is "almost" contained in this set.approx_equals
(other, atol)Return
True
ifother
is equal to this set up toatol
.collapse
(indices, values)Partly collapse the interval product to single values.
contains_all
(other[, atol])Return
True
if all points defined byother
are contained.contains_set
(other[, atol])Return
True
ifother
is (almost) contained in this set.corners
([order])Return the corner points as a single array.
dist
(point[, exponent])Return the distance of
point
to this set.element
([inp])Return an element of this interval product.
insert
(index, *intvs)Return a copy with
intvs
inserted beforeindex
.max
()Return the maximum point of this interval product.
measure
([ndim])Return the Lebesgue measure of this interval product.
min
()Return the minimum point of this interval product.
squeeze
()Remove the degenerate dimensions.
- __init__(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. ])