edg_acoustics.postprocessing

This module provides postprocessing functionalities for the edg_acoustics package.

Module Contents

Classes

Monopole_postprocessor

Postprocessor for monopole source simulation results.

Attributes

Sampling_Freq

Default value of the sampling frequency, set as 44100 Hz.

edg_acoustics.postprocessing.Sampling_Freq = 44100[source]

Default value of the sampling frequency, set as 44100 Hz.

Type:

float

class edg_acoustics.postprocessing.Monopole_postprocessor(sim, delta_step, sampling_freq=Sampling_Freq)[source]

Postprocessor for monopole source simulation results.

Monopole_postprocessor is used to postprocess the simulation results of a monopole source, mainly to correct the source spectrum. Furthermore, it collects simulation results to be saved.

Parameters:
sim

The acoustic simulation object instance of edg_acoustics.AcousticsSimulation.

Type:

edg_acoustics.AcousticsSimulation

dt_old

The time step size of the simulation results.

Type:

float

fs_old

The sampling frequency of the simulation results.

Type:

float

sampling_freq

The desired sampling frequency. Default is set to Sampling_Freq = 44100 Hz.

Type:

float

dt_new

The time step size of the desired sampling frequency.

Type:

float

IRold

The impulse response at the receiver locations.

Type:

numpy.ndarray

IRnew

The resampled impulse response at the receiver locations.

Type:

numpy.ndarray

TR_original

The original transfer function at the receiver locations.

Type:

numpy.ndarray

TR_free

The free transfer function at the receiver locations.

Type:

numpy.ndarray

TR

The corrected transfer function at the receiver locations.

Type:

numpy.ndarray

freqs

The frequency vector.

Type:

numpy.ndarray

apply_resample()[source]

Resamples the impulse response to the desired sampling frequency.

Returns:

IRnew (numpy.ndarray) – see IRnew.

apply_correction(next_fast_len=False)[source]

Corrects the source spectrum of the recorded impulse response.

Parameters:

next_fast_len (bool) – If True, the next fast length of input data is used for fft, for zero-padding, etc. Consequently, the singal length is prolonged. Default is False.

Returns:
  • IRnew (numpy.ndarray) – see IRnew.

  • TR (numpy.ndarray) – see TR.

  • freqs (numpy.ndarray) – see freqs.

write_results(filename, file_format)[source]

Writes the simulation results to a file.

Parameters:
  • filename (str) – The name of the file to save the results.

  • file_format (str) – The format of the file to save the results. Can be either ‘mat’ or ‘npy’.