Acoular 25.03 documentation

MultiSector

«  ConvexSector   ::   grids   ::   Polygon  »

MultiSector

class acoular.grids.MultiSector

Bases: Sector

Class for defining a sector consisting of multiple sectors.

This class allows the combination of several individual sectors into one.

Examples

Load example data and set diffrent Sectors for intergration in the sector integration example.

sectors = List(Instance(Sector))

List of Sector objects to be mixed, each defining a different sector.

contains(pos)

Check if the coordinates in a given array lie within any of the sub-sectors.

This method iterates over the list of sectors, checking if each point in the given position array lies within any of the defined sectors.

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 (N,) indicating which of the given positions lie within any of the defined sectors. True if the grid point is inside the circular sector, False if otherwise.

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.]])
>>> sec1 = ac.RectSector(x_min=0, y_min=0)
>>> sec2 = ac.CircSector(x=1, y=1, r=0.5)
>>> multi_sec = ac.MultiSector(sectors=[sec1, sec2])
>>> multi_sec.contains(grid.pos)
array([False, False, False, False,  True,  True, False,  True,  True])

«  ConvexSector   ::   grids   ::   Polygon  »