IntervalProd.contains_all¶
-
IntervalProd.
contains_all
(self, other, atol=0.0)[source]¶ Return
True
if all points defined byother
are contained.- Parameters
- other :
Collection of points to be tested. Can be given as a single point, a
(d, N)
array-like whered
is the number of dimensions, or a length-d
meshgrid
tuple.- atolfloat, optional
The maximum allowed distance in ‘inf’-norm between the other set and this interval product.
- Returns
- containsbool
True
if all points are contained,False
otherwise.
Examples
>>> min_pt, max_pt = [-1, 0, 2], [-0.5, 0, 3] >>> rbox = IntervalProd(min_pt, max_pt)
Arrays are expected in
(ndim, npoints)
shape:>>> arr = np.array([[-1, 0, 2], # defining one point at a time ... [-0.5, 0, 2]]) >>> rbox.contains_all(arr.T) True
Implicit meshgrids defined by coordinate vectors:
>>> from odl.discr.grid import sparse_meshgrid >>> vec1 = (-1, -0.9, -0.7) >>> vec2 = (0, 0, 0) >>> vec3 = (2.5, 2.75, 3) >>> mg = sparse_meshgrid(vec1, vec2, vec3) >>> rbox.contains_all(mg) True
Works also with an arbitrary iterable:
>>> rbox.contains_all([[-1, -0.5], # define points by axis ... [0, 0], ... [2, 2]]) True
Grids are also accepted as input:
>>> agrid = odl.uniform_grid(rbox.min_pt, rbox.max_pt, [3, 1, 3]) >>> rbox.contains_all(agrid) True