Acoular 25.03 documentation

CircSector

«  RectSector3D   ::   grids   ::   PolySector  »

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 = Float(0.0, desc='x position of the circle center')

The x position of the circle center. Default is 0.0.

y = Float(0.0, desc='y position of the circle center')

The y position of the circle center. Default is 0.0.

r = Float(1.0, desc='radius of the circle')

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])

«  RectSector3D   ::   grids   ::   PolySector  »