Acoular 25.04 documentation

RectGrid

«  Grid   ::   grids   ::   RectGrid3D  »

RectGrid

class acoular.grids.RectGrid

Bases: Grid

Provides a 2D Cartesian grid for beamforming results.

This grid is composed of square or nearly square cells and lies on a plane perpendicular to the z-axis. It is defined by the lower and upper x- and y-limits and a constant z-coordinate.

x_min = Float(-1.0, desc='minimum  x-value')

The lower x-limit that defines the grid. Default is -1.

x_max = Float(1.0, desc='maximum  x-value')

The upper x-limit that defines the grid. Default is 1.

y_min = Float(-1.0, desc='minimum  y-value')

The lower y-limit that defines the grid. Default is -1.

y_max = Float(1.0, desc='maximum  y-value')

The upper y-limit that defines the grid. Default is 1.

z = Float(1.0, desc='position on z-axis')

The constant z-coordinate of the grid plane. Default is 1.0.

increment = Float(0.1, desc='step size')

The side length of each cell. Default is 0.1.

nxsteps = Property(desc='number of grid points along x-axis')

Number of grid points along x-axis. (read-only)

nysteps = Property(desc='number of grid points along y-axis')

Number of grid points along y-axis. (read-only)

digest = Property(

A unique identifier for the grid, based on its properties. (read-only)

index(x, y)

Find the indices of a grid point near a given coordinate.

Parameters:
xfloat

The x coordinate of interest.

yfloat

The y coordinate of interest.

Returns:
tuple of ints

Indices corresponding to the nearest grid point.

Raises:
ValueError

If the coordinates are outside the grid boundaries.

indices(*r)

Find the indices of a subdomain in the grid.

Supports rectangular, circular, and polygonal subdomains.

Parameters:
rtuple of floats
Defines the subdomain shape and dimensions:
  • If 3 values are provided: center (x1, y1) and radius r2 define a circle.

  • If 4 values are provided: corners (x1, y1) and (x2, y2) define a rectangle.

  • If more than 4 values are provided: vertices (xn, yn) define a polygon.

Returns:
tuple

A 2-tuple of indices or slices corresponding to the subdomain.

extend()

Return the grid’s extension in matplotlib.pyplot.imshow compatible form.

Returns:
tuple of floats

(x_min, x_max, y_min, y_max) representing the grid’s extent.

Notes

Examples

>>> from acoular import RectGrid
>>> grid = RectGrid()
>>> grid.y_min = -5
>>> grid.y_max = 5
>>> grid.extend()
(-1.0, 1.0, -5.0, 5.0)

«  Grid   ::   grids   ::   RectGrid3D  »