Underwater acoustics

Underwater acoustics toolbox.

arlpy.uwa.absorption(frequency, distance=1000, temperature=27, salinity=35, depth=10, pH=8.1)

Get the acoustic absorption in water.

Computes acoustic absorption in water using Francois-Garrison model.

Parameters:
  • frequency – frequency in Hz
  • distance – distance in m
  • temperature – temperature in deg C
  • salinity – salinity in ppt
  • depth – depth in m
  • pH – pH of water
Returns:

absorption as a linear multiplier

>>> import arlpy
>>> arlpy.uwa.absorption(50000)
0.2914
>>> arlpy.utils.mag2db(arlpy.uwa.absorption(50000))
-10.71
>>> arlpy.utils.mag2db(arlpy.uwa.absorption(50000, distance=3000))
-32.13
arlpy.uwa.absorption_filter(fs, ntaps=31, nfreqs=64, distance=1000, temperature=27, salinity=35, depth=10)

Design a FIR filter with response based on acoustic absorption in water.

Parameters:
  • fs – sampling frequency in Hz
  • ntaps – number of FIR taps
  • nfreqs – number of frequencies to use for modeling frequency response
  • distance – distance in m
  • temperature – temperature in deg C
  • salinity – salinity in ppt
  • depth – depth in m
Returns:

tap weights for a FIR filter that represents absorption at the given distance

>>> import arlpy
>>> import numpy as np
>>> fs = 250000
>>> b = arlpy.uwa.absorption_filter(fs, distance=500)
>>> x = arlpy.signal.sweep(20000, 40000, 0.5, fs)
>>> y = arlpy.signal.lfilter0(b, 1, x)
>>> y /= 500**2      # apply spreading loss for 500m
arlpy.uwa.bubble_resonance(radius, depth=0.0, gamma=1.4, p0=101300.0, rho_water=1022.476)

Compute resonance frequency of a freely oscillating has bubble in water, using implementation based on Medwin & Clay (1998). This ignores surface-tension, thermal, viscous and acoustic damping effects, and the pressure-volume relationship is taken to be adiabatic. Parameters:

Radius:bubble radius in meters
Depth:depth of bubble in water in meters
Gamma:gas ratio of specific heats. Default 1.4 for air
P0:atmospheric pressure. Default 1.013e5 Pa
Rho_water:Density of water. Default 1022.476 kg/m³
>>> import arlpy
>>> arlpy.uwa.bubble_resonance(100e-6)
32465.56
arlpy.uwa.bubble_soundspeed(void_fraction, c=1539.0866009307247, c_gas=340, relative_density=1000)

Get the speed of sound in a 2-phase bubbly water.

The sound speed is computed based on Wood (1964) or Buckingham (1997).

Parameters:
  • void_fraction – void fraction
  • c – speed of sound in water in m/s
  • c_gas – speed of sound in gas in m/s
  • relative_density – ratio of density of water to gas
Returns:

sound speed in m/s

>>> import arlpy
>>> arlpy.uwa.bubble_soundspeed(1e-5)
1402.133
arlpy.uwa.bubble_surface_loss(windspeed, frequency, angle)

Get the surface loss due to bubbles.

The surface loss is computed based on APL model (1994).

Parameters:
  • windspeed – windspeed in m/s (measured 10 m above the sea surface)
  • frequency – frequency in Hz
  • angle – incidence angle in radians
Returns:

absorption as a linear multiplier

>>> import numpy
>>> import arlpy
>>> arlpy.utils.mag2db(uwa.bubble_surface_loss(3,10000,0))
-1.44
>>> arlpy.utils.mag2db(uwa.bubble_surface_loss(10,10000,0))
-117.6
arlpy.uwa.density(temperature=27, salinity=35)

Get the density of sea water near the surface.

Computes sea water density using Fofonoff (1985 - IES 80).

Parameters:
  • temperature – temperature in deg C
  • salinity – salinity in ppt
Returns:

density in kg/m^3

>>> import arlpy
>>> arlpy.uwa.density()
1022.7
arlpy.uwa.doppler(speed, frequency, c=1539.0866009307247)

Get the Doppler-shifted frequency given relative speed between transmitter and receiver.

The Doppler approximation used is only valid when speed << c. This is usually the case for underwater vehicles.

Parameters:
  • speed – relative speed between transmitter and receiver in m/s
  • frequency – transmission frequency in Hz
  • c – sound speed in m/s
Returns:

the Doppler shifted frequency as perceived by the receiver

>>> import arlpy
>>> arlpy.uwa.doppler(2, 50000)
50064.97
>>> arlpy.uwa.doppler(-1, 50000)
49967.51
arlpy.uwa.pressure(x, sensitivity, gain, volt_params=None)

Convert the real signal x to an acoustic pressure signal in micropascal.

Parameters:
  • x – real signal in voltage or bit depth (number of bits)
  • sensitivity – receiving sensitivity in dB re 1V per micropascal
  • gain – preamplifier gain in dB
  • volt_params – (nbits, v_ref) is used to convert the number of bits to voltage where nbits is the number of bits of each sample and v_ref is the reference voltage, default to None
Returns:

acoustic pressure signal in micropascal

If volt_params is provided, the sample unit of x is in number of bits, else is in voltage.

>>> import arlpy
>>> nbits = 16
>>> V_ref = 1.0
>>> x_volt = V_ref*signal.cw(64, 1, 512)
>>> x_bit = x_volt*(2**(nbits-1))
>>> sensitivity = 0
>>> gain = 0
>>> p1 = arlpy.uwa.pressure(x_volt, sensitivity, gain)
>>> p2 = arlpy.uwa.pressure(x_bit, sensitivity, gain, volt_params=(nbits, V_ref))
arlpy.uwa.reflection_coeff(angle, rho1, c1, alpha=0, rho=1022.7198310217424, c=1539.0866009307247)

Get the Rayleigh reflection coefficient for a given angle.

Parameters:
  • angle – angle of incidence in radians
  • rho1 – density of second medium in kg/m^3
  • c1 – sound speed in second medium in m/s
  • alpha – attenuation
  • rho – density of water in kg/m^3
  • c – sound speed in water in m/s
Returns:

reflection coefficient as a linear multiplier

>>> from numpy import pi
>>> import arlpy
>>> arlpy.uwa.reflection_coeff(pi/4, 1200, 1600)
0.1198
>>> arlpy.uwa.reflection_coeff(0, 1200, 1600)
0.0990
>>> arlpy.utils.mag2db(arlpy.uwa.reflection_coeff(0, 1200, 1600))
-20.1
arlpy.uwa.soundspeed(temperature=27, salinity=35, depth=10)

Get the speed of sound in water.

Uses Mackenzie (1981) to compute sound speed in water.

Parameters:
  • temperature – temperature in deg C
  • salinity – salinity in ppt
  • depth – depth in m
Returns:

sound speed in m/s

>>> import arlpy
>>> arlpy.uwa.soundspeed()
1539.1
>>> arlpy.uwa.soundspeed(temperature=25, depth=20)
1534.6
arlpy.uwa.spl(x, ref=1)

Get Sound Pressure Level (SPL) of the acoustic pressure signal x.

Parameters:
  • x – acoustic pressure signal in micropascal
  • ref – reference acoustic pressure in micropascal, default to 1
Returns:

average SPL in dB re micropascal

In water, the common reference is 1 micropascal. In air, the common reference is 20 micropascal.

>>> import arlpy
>>> p = signal.cw(64, 1, 512)
>>> arlpy.uwa.spl(p)
-3.0103