MovingLineSource#
- class acoular.sources.MovingLineSource
Bases:
LineSource,MovingPointSourceA moving
line sourcewith an arbitrary signal.The
MovingLineSourceclass models aline sourcecomposed of multiple monopoles that move along atrajectory. It supportscoherent and incoherentsources and considers Doppler effects due to motion.- Key Features:
Specify the
trajectoryand rotation of theline source.Compute emission times considering motion and source
direction.Generate block-wise microphone output with moving source effects.
See also
LineSourceFor
line sourcesconsisting ofcoherent or incoherentmonopoles.MovingPointSourceFor moving point sources without dipole characteristics.
- digest
A unique identifier for the current state of the source, based on its properties. (read-only)
- rvec
A reference vector, perpendicular to the x and y-axis of moving source, defining the axis of rotation for the line source directivity. If set to
(0, 0, 0), the line source is only translated along thetrajectorywithout rotation. Default is(0, 0, 0).
- get_emission_time(t, direction)
Calculate the emission time for a moving line source based on its trajectory.
This method computes the time at which sound waves are emitted from the line source at a specific point along its
trajectory. It also determines the distances from the source to each microphone and calculates the radial Mach number, which accounts for the Doppler effect due to the motion of the source.- Parameters:
- t
float The current receiving time at the microphones, specified in seconds.
- direction
numpy.ndarray The current direction vector of the line source, specified as a 3-element array representing the orientation of the line.
- t
- Returns:
- te
numpy.ndarray The computed emission times for each microphone, specified as an array of floats.
- rm
numpy.ndarray The distances from the line source to each microphone, represented as an array of absolute distances.
- Mr
numpy.ndarray The radial Mach number, which accounts for the Doppler effect, calculated for each microphone.
- xs
numpy.ndarray The position of the line source at the computed emission time, returned as a 3-element array.
- te
Notes
This method performs Newton-Raphson iteration to find the emission time where the sound wave from the source reaches the microphones.
The distance between the line source and microphones is computed using Euclidean geometry.
The radial Mach number (
Mr) is calculated using the velocity of the source and the speed of sound in the medium (c).The method iterates until the difference between the computed emission time and the current time is sufficiently small (within a defined threshold).
- result(num=128)
Generate the output signal at microphones in blocks.
- Parameters:
- num
int, optional Number of samples per block to yield. Default is
128.
- num
- Yields:
numpy.ndarrayA 2D array of shape (
num,num_channels) containing the signal detected at the microphones. The last block may have fewer samples ifnum_samplesis not a multiple ofnum.
- 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
trajectoryand rotation defined by thereference vector. If thereference vectoris (0, 0, 0), only translation is applied. Otherwise, the method incorporates rotation into the calculation.- Parameters:
- direction
numpy.ndarray The initial orientation of the source, specified as a three-dimensional array.
- time
float, optional The time at which the
trajectoryposition and velocity are evaluated. Defaults to0.
- direction
- Returns:
numpy.ndarrayThe 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 vectoris non-zero, the method constructs a rotation matrix to compute the new source direction based on thetrajectory’s motion and thereference vector.The rotation matrix ensures that the new orientation adheres to the right-hand rule and remains orthogonal.
- direction
Vector to define the orientation of the line source. Default is
(0.0, 0.0, 1.0).
- length
Vector to define the length of the line source in meters. Default is
1.0.
- num_sources
Number of monopole sources in the line source. Default is
1.
- source_strength
Strength coefficients for each monopole source.
- coherence
Coherence mode for the monopoles (
'coherent'or'incoherent').
- 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 isFalse.
- trajectory
Instance of the
Trajectoryclass 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'.
- signal
Instance of the
SignalGeneratorclass defining the emitted signal.
- loc
Coordinates
(x, y, z)of the source. Default isnp.array([[0.0], [0.0], [1.0]]).
- num_channels
Number of output channels, automatically set based on the
microphone geometry.
- mics
MicGeomobject defining the positions of the microphones.
- env
An
Environmentor derived object providing sound propagation details, such asspeed of sound in the medium. Default isEnvironment.
- 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
signalgenerator.
- sample_freq
Sampling frequency of the signal, derived from the
signalgenerator.