MovingPointSource#

class acoular.sources.MovingPointSource

Bases: PointSource

Define a moving point source emitting a signal.

The MovingPointSource class models a sound source that follows a specified trajectory while emitting a signal. This allows for the simulation of dynamic acoustic scenarios, e.g. sources changing position over time such as vehicles in motion.

See also

PointSource

For modeling stationary point sources.

Trajectory

For specifying source motion paths.

conv_amp

Determines whether convective amplification is considered. When True, the amplitude of the signal is adjusted based on the relative motion between the source and microphones. Default is False.

trajectory

Instance of the Trajectory class specifying the source’s motion. The trajectory defines the source’s position and velocity at any given time.

prepadding

Behavior of the signal for negative time indices. Currently only supports 'loop'. Default is 'loop'.

digest

A unique identifier for the current state of the source, based on its properties. (read-only)

get_moving_direction(direction, time=0)

Calculate the moving direction of the source along its trajectory.

This method computes the updated direction vector for the moving source, considering both translation along the trajectory and rotation defined by the reference vector. If the reference vector is (0, 0, 0), only translation is applied. Otherwise, the method incorporates rotation into the calculation.

Parameters:
directionnumpy.ndarray

The initial orientation of the source, specified as a three-dimensional array.

timefloat, optional

The time at which the trajectory position and velocity are evaluated. Defaults to 0.

Returns:
numpy.ndarray

The updated direction vector of the moving source after translation and, if applicable, rotation. The output is a three-dimensional array.

Notes

  • The method computes the translation direction vector based on the trajectory’s velocity at the specified time.

  • If the reference vector is non-zero, the method constructs a rotation matrix to compute the new source direction based on the trajectory’s motion and the reference vector.

  • The rotation matrix ensures that the new orientation adheres to the right-hand rule and remains orthogonal.

result(num=128)

Generate the output signal at microphones in blocks, accounting for source motion.

The result() method provides a generator that yields blocks of the signal received at microphones. It incorporates the source's trajectory, convective amplification (if enabled), and environmental propagation effects.

Parameters:
numint, optional

Number of samples per block to be yielded. Default is 128.

Yields:
numpy.ndarray

A 2D array of shape (num, num_channels) containing the signal detected at the microphones. The last block may have fewer samples if num_samples is not a multiple of num.

Raises:
IndexError

If no more samples are available from the signal source.

Notes

  • The method iteratively solves for the emission times of the signal at each microphone using the Newton-Raphson method.

  • Convective amplification is applied if conv_amp = True, modifying the signal’s amplitude based on the relative motion between the source and microphones.

  • The signal’s emission time is calculated relative to the trajectory’s position and velocity at each step.

signal

Instance of the SignalGenerator class defining the emitted signal.

loc

Coordinates (x, y, z) of the source. Default is np.array([[0.0], [0.0], [1.0]]).

num_channels

Number of output channels, automatically set based on the microphone geometry.

mics

MicGeom object defining the positions of the microphones.

env

An Environment or derived object providing sound propagation details, such as speed of sound in the medium. Default is Environment.

start_t

Start time of the signal in seconds. Default is 0.0.

start

Start time of data acquisition at the microphones in seconds. Default is 0.0.

up

Internal upsampling factor for finer signal resolution. Default is 16.

num_samples

Total number of samples in the emitted signal, derived from the signal generator.

sample_freq

Sampling frequency of the signal, derived from the signal generator.