Package wiat :: Module util
[hide private]
[frames] | no frames]

Module util

source code

util.py - classes and functions that are not specific to the calculation methods.

Functions [hide private]
 
air_properties(T)
Properties of air as a function of temperature
source code
 
calculate_interval_in_cents(f1, f2)
Calculate the interval in cents between two frequencies.
source code
 
calculate_ratio_in_db(A1, A2)
Calculate the ratio in dB between two values.
source code
 
transform_R2Z(R)
Convert reflection coefficient to normalized impedance
source code
 
transform_Z2R(Z)
Convert normalized impedance to reflection coefficient
source code
 
equivalent_length(R, k)
Return the equivalent length of a complex reflection coefficient R: reflection coefficient k: wavenumber
source code
 
load_or_calculate(filename, func, **args)
Function that will load a backup of the results if available, otherwise it calculates the function and save the results.
source code
 
__create_equal_tempered_scale() source code
Variables [hide private]
  EQUAL_TEMPERED_SCALE = {'A0': 27.5, 'A0 flat': 25.9565435987, ...
Function Details [hide private]

air_properties(T)

source code 

Properties of air as a function of temperature

The formula, valid for ±10 Celcius around 26.85 C, comes from Table 1 of reference 1.

References:

  1. Keefe, D. H. (1984). Acoustical wave propagation in cylindrical ducts: Transmission line parameter approximations for isothermal and nonisothermal boundary conditions. J. Aoucst. Soc. Am., 75(1), 58-62.

TODO: look for a more recent source to double check the validity


Variables Details [hide private]

EQUAL_TEMPERED_SCALE

Value:
{'A0': 27.5,
 'A0 flat': 25.9565435987,
 'A1': 55.0,
 'A1 flat': 51.9130871975,
 'A2': 110.0,
 'A2 flat': 103.826174395,
 'A3': 220.0,
 'A3 flat': 207.65234879,
...