Acoular 25.07 documentation

SpatialInterpolator

«  ChannelMixer   ::   tprocess   ::   SpatialInterpolatorRotation  »

SpatialInterpolator

class acoular.tprocess.SpatialInterpolator

Bases: TimeOut

Base class for spatial interpolation of microphone data.

This class retrieves samples from a specified source and performs spatial interpolation to generate output at virtual microphone positions. The interpolation is executed using various methods such as linear, spline, radial basis function (RBF), and inverse distance weighting (IDW).

See also

SpatialInterpolatorRotation

Spatial interpolation class for rotating sound sources.

SpatialInterpolatorConstantRotation

Performs spatial linear interpolation for sources undergoing constant rotation.

source = Instance(SamplesGenerator)

The input data source. It must be an instance of a SamplesGenerator-derived class. It provides the time-domain pressure samples from microphones.

mics = Instance(MicGeom(), desc='microphone geometry')

The physical microphone geometry. An instance of MicGeom that defines the positions of the real microphones used for measurement.

mics_virtual = Property(desc='microphone geometry')

The virtual microphone geometry. This property defines the positions of virtual microphones where interpolated pressure values are computed. Default is the physical microphone geometry (mics).

method = Enum(

Interpolation method used for spatial data estimation.

Options:

  • 'linear': Uses NumPy linear interpolation.

  • 'spline': Uses SciPy’s CubicSpline interpolator

  • 'rbf-multiquadric': Radial basis function (RBF) interpolation with a multiquadric kernel.

  • 'rbf-cubic': RBF interpolation with a cubic kernel.

  • 'IDW': Inverse distance weighting interpolation.

  • 'custom': Allows user-defined interpolation methods.

  • 'sinc': Uses sinc-based interpolation for signal reconstruction.

array_dimension = Enum('1D', '2D', 'ring', '3D', 'custom', desc='spatial dimensionality of the array geometry')

Defines the spatial dimensionality of the microphone array.

Possible values:

  • '1D': Linear microphone arrays.

  • '2D': Planar microphone arrays.

  • 'ring': Circular arrays where rotation needs to be considered.

  • '3D': Three-dimensional microphone distributions.

  • 'custom': User-defined microphone arrangements.

sample_freq = Delegate('source', 'sample_freq')

Sampling frequency of the output signal, inherited from the source. This defines the rate at which microphone pressure samples are acquired and processed.

num_channels = Property()

Number of channels in the output data. This corresponds to the number of virtual microphone positions where interpolated pressure values are computed. The value is ´determined based on the mics_virtual geometry.

num_samples = Delegate('source', 'num_samples')

Number of time-domain samples in the output signal, inherited from the source.

interp_at_zero = Bool(False)

Whether to interpolate a virtual microphone at the origin. If set to True, an additional virtual microphone position at the coordinate origin \((0,0,0)\) will be interpolated.

Q = CArray(dtype=float64, shape=(3, 3), value=identity(3))

Transformation matrix for coordinate system alignment.

This 3x3 orthogonal matrix is used to align the microphone coordinates such that rotations occur around the z-axis. If the original coordinates do not conform to the expected alignment (where the x-axis transitions into the y-axis upon rotation), applying this matrix modifies the coordinates accordingly. The transformation is defined as

\[\begin{split}\begin{bmatrix}x'\\y'\\z'\end{bmatrix} = Q \cdot \begin{bmatrix}x\\y\\z\end{bmatrix}\end{split}\]

where \(Q\) is the transformation matrix and \((x', y', z')\) are the modified coordinates. If no transformation is needed, \(Q\) defaults to the identity matrix.

num_IDW = Int(3, desc='number of neighboring microphones, DEFAULT=3')  # noqa: N815

Number of neighboring microphones used in IDW interpolation. This parameter determines how many physical microphones contribute to the weighted sum in inverse distance weighting (IDW) interpolation.

p_weight = Float(

Weighting exponent for IDW interpolation. This parameter controls the influence of distance in inverse distance weighting (IDW). A higher value gives more weight to closer microphones.

digest = Property(

Unique identifier for the current configuration of the interpolator. (read-only)

sinc_mic(r)

Compute a modified sinc function for use in Radial Basis Function (RBF) approximation.

This function is used as a kernel in sinc-based interpolation methods, where the sinc function serves as a basis function for reconstructing signals based on spatially distributed microphone data. The function is scaled according to the number of virtual microphone positions, ensuring accurate signal approximation.

Parameters:
rfloat or list of floats

The radial distance(s) at which to evaluate the sinc function, typically representing the spatial separation between real and virtual microphone positions.

Returns:
numpy.ndarray

Evaluated sinc function values at the given radial distances.

result(num)

Generate interpolated microphone data over time.

This method retrieves pressure samples from the physical microphones and applies spatial interpolation to estimate the pressure at virtual microphone locations. The interpolation method is determined by method.

Parameters:
numint

Number of samples per block.

Yields:
numpy.ndarray

An array of shape (num, n), where n is the number of virtual microphones, containing interpolated pressure values for the virtual microphones at each time step. The last block may contain fewer samples if the total number of samples is not a multiple of num.

«  ChannelMixer   ::   tprocess   ::   SpatialInterpolatorRotation  »