mesh2scattering.process#

Write output for NumCalc.

Functions:

calculate_scattering(sample_path, ...)

Read pattern data sample_path and reference_path and calculate and export the scattering coefficient for each incident angle to project_name.scattering.sofa.

scattering_freefield(sample_pressure, ...)

Calculate the direction dependent free-field scattering coefficient.

mesh2scattering.process.calculate_scattering(sample_path, reference_path, project_name)[source]#

Read pattern data sample_path and reference_path and calculate and export the scattering coefficient for each incident angle to project_name.scattering.sofa.

Parameters:
  • sample_path (str, path) – path to the sofa file with the sample data

  • reference_path (str, path) – path to the sofa file with the reference data

  • project_name (str) – name of the project, the scattering coefficient will be written into# the same directory as sample_path with the given name here: project_name.scattering.sofa. The meta data are taken from the sample file.

mesh2scattering.process.scattering_freefield(sample_pressure, reference_pressure, microphone_weights)[source]#

Calculate the direction dependent free-field scattering coefficient.

Uses the Mommertz correlation method [1] to calculate the scattering coefficient of the input data:

\[s = 1 - \frac{|\sum_w \underline{p}_{\text{sample}}(\vartheta,\varphi) \cdot \underline{p}_{\text{reference}}^*(\vartheta,\varphi) \cdot w(\vartheta,\varphi)|^2} {\sum_w |\underline{p}_{\text{sample}}(\vartheta,\varphi)|^2 \cdot w(\vartheta,\varphi) \cdot \sum_w |\underline{p}_{\text{reference}}(\vartheta,\varphi)|^2 \cdot w(\vartheta,\varphi) }\]

with the reflected sound pressure of the the sample under investigation \(\underline{p}_{\text{sample}}\), the reflected sound pressure from the reference sample (same dimension as the sample under investigation, but with flat surface) \(\underline{p}_{\text{reference}}\), the area weights of the sampling \(w\), and \(\vartheta\) and \(\varphi\) are the colatitude angle and azimuth angles from the Coordinates object. In other words, the test sample lies in the x-y-plane.

Parameters:
  • sample_pressure (FrequencyData) – Reflected sound pressure or directivity of the test sample. Its cshape needs to be (…, microphone_weights.size).

  • reference_pressure (FrequencyData) – Reflected sound pressure or directivity of the reference sample. Needs to have the same cshape and frequencies as sample_pressure.

  • microphone_weights (numpy.ndarray) – Array containing the area weights for the microphone positions, no normalization required. Its shape needs to match the last dimension in the cshape of sample_pressure and reference_pressure.

Returns:

scattering_coefficients – The scattering coefficient for each incident direction depending on frequency.

Return type:

FrequencyData

References