RectSector#
- class acoular.grids.RectSector
Bases:
SingleSectorClass 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_maxpositions, 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
The minimum x position of the rectangle. Default is
-1.0.
- x_max
The maximum x position of the rectangle. Default is
1.0.
- y_min
The minimum y position of the rectangle. Default is
-1.0.
- y_max
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_nearestisTrue.- Parameters:
- posarray of
floats A (3, N) array containing the positions of N grid points.
- posarray of
- Returns:
numpy.ndarrayofboolsAn 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])
- include_border
If
True, grid points lying on the sector border are included in the sector. Default isTrue.
- abs_tol
The absolute tolerance to apply when determining if a grid point lies on the sector border. Default is
1e-12.
- default_nearest
If
True, thecontainsmethod (as inRectSector.contains(),RectSector3D.contains(),CircSector.contains(), andPolySector.contains()) returns the nearest grid point if no grid points are inside the sector. Default isTrue.