Sector¶
- class acoular.grids.Sector¶
Bases:
ABCHasStrictTraits
Abstract base class for all sector types.
The
Sector
class defines the common interface for all sector implementations. It serves as the base class for creating diverse sector geometries, each capable of determining whether specific grid points fall within its bounds.When used directly, this class represents a sector encompassing the entire grid, meaning all positions are considered valid.
Notes
This class is designed to be subclassed. Derived classes should override the
contains()
method to implement specific sector geometries (e.g., circular, rectangular, or polygon shapes).Examples
Load example data and set different Sectors for integration in the sector integration example.
- contains(pos)¶
Check whether the given coordinates lie within the sector’s bounds.
This method determines if each column of the input array
pos
corresponds to a point that falls within the sector. For this base class, all points are considered within the sector.- Parameters:
- pos
numpy.ndarray
A 2D array with shape (3, N), where N is the number of grid points. Each column represents the
x, y, z
coordinates of a grid point.
- pos
- Returns:
numpy.ndarray
ofbools
A 1D array of length N, where each entry indicates whether the corresponding column in
pos
lies within the sector’s bounds.
Examples
>>> import numpy as np >>> import acoular as ac >>> sector = ac.Sector() >>> positions = np.array([[0, 1], [0, 0], [0, 0]]) # Two grid points >>> sector.contains(positions) array([ True, True])