RectSector¶
- class acoular.grids.RectSector¶
Bases:
SingleSector
Class for defining a rectangular sector.
Defines a rectangular sector either for 2D grids (rectangle in the XY-plane) or for 3D grids (rectangular cylindrical sector parallel to the z-axis). The sector is bounded by the specified
x_min
,x_max
,y_min
, andy_max
positions, defining the lower and upper bounds of the rectangle along the x and y axes.Examples
Load example data and set diffrent Sectors for intergration in the sector integration example.
- x_min = Float(-1.0, desc='minimum x position of the rectangle')¶
The minimum x position of the rectangle. Default is
-1.0
.
- x_max = Float(1.0, desc='maximum x position of the rectangle')¶
The maximum x position of the rectangle. Default is
1.0
.
- y_min = Float(-1.0, desc='minimum y position of the rectangle')¶
The minimum y position of the rectangle. Default is
-1.0
.
- y_max = Float(1.0, desc='maximum y position of the rectangle')¶
The maximum y position of the rectangle. Default is
1.0
.
- contains(pos)¶
Check if the coordinates in a given array lie within the rectangular sector.
If no coordinate is inside, the nearest one to the rectangle center is returned if
default_nearest
isTrue
.- Parameters:
- posarray of
floats
A (3, N) array containing the positions of N grid points.
- posarray of
- Returns:
numpy.ndarray
ofbools
An array of shape (N,) indicating which of the given positions lie within the given sector.
Examples
>>> import acoular as ac >>> grid = ac.RectGrid(increment=2) >>> sec = ac.RectSector(x_min=0, y_min=0) >>> sec.contains(grid.pos) array([False, False, False, True])