NoiseGenerator#

class acoular.signals.NoiseGenerator

Bases: SignalGenerator

Abstract base class for noise signal generators.

The NoiseGenerator class defines the common interface for all SignalGenerator classes with noise signals. This class may be used as a base for class handling noise signals that can be characterized by their RMS amplitude.

It should not be used directly as it contains no real functionality.

See also

PNoiseGenerator

For pink noise generation.

WNoiseGenerator

For white noise generation.

UncorrelatedNoiseSource

For per-channel noise generation.

rms

Root mean square (RMS) amplitude of the signal. For a point source, this corresponds to the RMS amplitude at a distance of 1 meter. Default is 1.0.

seed

Seed for random number generator. Default is 0. This parameter should be set differently for different instances to guarantee statistically independent (non-correlated) outputs.

digest

Internal identifier based on generator properties. (read-only)

abstractmethod signal()

Generate and deliver the periodic signal.

usignal(factor)

Resample the signal at a higher sampling frequency.

This method uses Fourier transform-based resampling to deliver the signal at a sampling frequency that is a multiple of the original sample_freq. The resampled signal has a length of factor * num_samples.

Parameters:
factorint

The resampling factor. Defines how many times larger the new sampling frequency is compared to the original sample_freq.

Returns:
numpy.ndarray

The resampled signal as a 1D array of floats.

Notes

This method relies on the scipy.signal.resample() function for resampling.

Examples

Resample a signal by a factor of 4:

>>> from acoular import SineGenerator  # Class extending SignalGenerator
>>> sg = SineGenerator(sample_freq=100.0, num_samples=1000)
>>> resampled_signal = sg.usignal(4)
>>> len(resampled_signal)
4000
sample_freq

Sampling frequency of the signal in Hz. Default is 1.0.

num_samples

The number of samples to generate for the signal.