IntervalProd¶
- class odl.set.domain.IntervalProd(min_pt, max_pt)[source]¶
Bases:
SetAn 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.
IntervalProdobjects are immutable, hence all manipulation methods return a new instance.- Attributes:
areaArea of this rectangle (valid if
ndim == 2).examplesGenerator creating name-value pairs of set elements.
extentReturn the vector of interval lengths per axis.
lengthLength of this interval (valid for
ndim == 1).max_ptRight interval boundaries of this interval product.
mid_ptMidpoint of this interval product.
min_ptLeft interval boundaries of this interval product.
ndimNumber of intervals in the product.
nondegen_byaxisBoolean array with
Trueentries for non-degenerate axes.true_ndimNumber of non-degenerate (positive-length) intervals.
volumendim-dimensional volume of this interval product.
Methods
append(*intvs)Insert
intvsat the end as a block.approx_contains(point, atol)Return
Trueifpointis "almost" contained in this set.approx_equals(other, atol)Return
Trueifotheris equal to this set up toatol.collapse(indices, values)Partly collapse the interval product to single values.
contains_all(other[, atol])Return
Trueif all points defined byotherare contained.contains_set(other[, atol])Return
Trueifotheris (almost) contained in this set.corners([order])Return the corner points as a single array.
dist(point[, exponent])Return the distance of
pointto this set.element([inp])Return an element of this interval product.
insert(index, *intvs)Return a copy with
intvsinserted 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. ])