CircSector#

class acoular.grids.CircSector

Bases: SingleSector

Class 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 radius r.

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 and default_nearest is True, 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.

Returns:
numpy.ndarray of bools

A boolean array of shape shape (N,) indicating which of the given positions lie within the circular sector. True if the grid point is inside the circular sector, otherwise False.

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 is True.

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, the contains method (as in RectSector.contains(), RectSector3D.contains(), CircSector.contains(), and PolySector.contains()) returns the nearest grid point if no grid points are inside the sector. Default is True.