CircSector#
- class acoular.grids.CircSector
Bases:
SingleSectorClass for defining a circular sector.
Defines a circular sector, which can be used for both 2D grids (as a circle in the XY-plane) or for 3D grids (as a cylindrical sector parallel to the z-axis). The sector is defined by its center position (
x,y) and its radiusr.Examples
Load example data and set diffrent Sectors for intergration in the sector integration example.
- x
The x position of the circle center. Default is
0.0.
- y
The y position of the circle center. Default is
0.0.
- r
Radius of the circle. Default is
1.0.
- contains(pos)
Check if the coordinates in a given array lie within the circular sector.
The method calculates the squared distance of each point from the center of the circle and checks if it lies within the sector, considering the sector’s radius
r. If no point is inside anddefault_nearestisTrue, the nearest point outside the sector will be returned.- Parameters:
- posarray of
floats A (3, N) array containing the positions of N grid points, where each point is represented by its x, y, and z coordinates.
- posarray of
- Returns:
numpy.ndarrayofboolsA boolean array of shape shape (N,) indicating which of the given positions lie within the circular sector.
Trueif the grid point is inside the circular sector, otherwiseFalse.
Examples
>>> import acoular as ac >>> grid = ac.RectGrid(increment=1) >>> grid.pos array([[-1., -1., -1., 0., 0., 0., 1., 1., 1.], [-1., 0., 1., -1., 0., 1., -1., 0., 1.], [ 1., 1., 1., 1., 1., 1., 1., 1., 1.]]) >>> sec = ac.CircSector(x=1, y=1, r=0.5) >>> sec.contains(grid.pos) array([False, False, False, False, False, 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.