API Reference
General
AeroAcoustics.DR!
— MethodDR!(CSM::FreqArray)
Apply diagonal removal to CSM.
AeroAcoustics.DR
— MethodDR(CSM::FreqArray)
Apply diagonal removal to CSM and new array.
AeroAcoustics.narrow2oct
— Methodnarrow2oct(x::FreqArray,n,nomial::Bool=true;psd=false)
Sum narrow band spectrum to 1/n octave bands given narrow band frequencies f
in x.
AeroAcoustics.Environment
— TypeEnvironment
The Environment struct is required for most methods and defines the geometrical setup, constants, and stores the relevant data together. The microphone array is assumed to be at the center of the coordinate system. The fields are
Arguments
Required:
micgeom::Array{T,2}
: (x,y,z) coordinates for microhone array.z0::Real
: distance to source plane from microphone array.CSM::FreqArray
: Cross-spectral matrix, sizeM x M x Nf
, whereM
is the number of microphones andNf
is the number of frequency bins.
Optional:
flim::Tuple=extrema(CSM.fc)
: Frequency limits (fmin,fmax).Nx::Integer=21
: Number of computational gridpoint in x direction.Ny::Integer=21
: Number of computational gridpoint in y direction.xlim::Tuple=(-1.,1.)
: Cartesian x-coordinate limits.ylim::Tuple=(-1.,1.)
: Cartesian y-coordinate limits.wv=ones(size(micgeom,2))
: Microphones on/off.wc::Bool=false
: Microphones coherence weighting.dr::Bool=false
: Diagonal removal of CSMw=ones(M,Nf)
: Microphone weights. Ifwc=true
it calculates coherence weighting.shear::Bool = false
: Amiet phase correctionampcorr::Bool = shear
: Amiet amplitude correction (only applies when shear = true)c::Real=343.
: Speed of sound [m/s].Ma::Real=0.0
: Mach number (sign determines flow direction)h::Real=0.0
: Distance from array center to shear layer (Amiet correction) should be supplied whenMa != 0
.multi_thread::Bool = false
: Enable multi-threading via the ThreadsX package.
AeroAcoustics.coherence_weights
— Methodcoherence_weights(CSM)
Calculate microphone weights according to mean mututal-coherence.
Amaral et al. “Slat Noise from an MD30P30N Airfoil at Extreme Angles of Attack,” AIAA Journal, vol. 56, no. 3, pp. 964–978, Mar. 2018.
AeroAcoustics.enbw
— Methodenbw(fs,win)
Equivalent Noise Band Width. Use to convert power spectrum to power spectral density and reverse. PS = PSD*ENBW
AeroAcoustics.octavebandlimits
— Methodoctavebandlimits(fc,n)
Compute 1/n octave band limits given center frequencies fc.
AeroAcoustics.octavebands
— Functionoctavebands(n,flim=(16.,40000.),nomial::Bool=false)
Compute 1/n octave band center frequencies.
Basic methods
AeroAcoustics.beamforming
— Methodbeamforming(Environment)
Calculate frequency-domain beamforming using cross-spectral matrix csm
and steering vector v
stored in Environment struct
AeroAcoustics.beamforming
— Methodbeamforming(csm,v)
Calculate frequency-domain beamforming using cross-spectral matrix csm
and steering vector v
. csm
must be a square (Hermitian) matrix optionally with a third (frequency) dimension. First dimension of v
and csm
must be equal.
AeroAcoustics.csm
— Methodcsm(t;n=1024,noverlap=div(n,2),fs=1,win=DSP.hanning(n),scaling="spectrum")
Calculate cross-spectral matrix from time series t
which is S x M
dimensional, where S
is the number of samples and M
the number of microphones.
AeroAcoustics.psf
— Functionpsf(Environment[,cent])
Calculate frequency-domain point spread function using the Environment struct to access steeringvectors. Optionally, supply the index where the psf is centered, default is (N/2)+1.
AeroAcoustics.SPI
— MethodSPI(b::FreqArray,E::Environment,dxdy,limits)
Convenience function to normalize source integration of a beamforming result.
AeroAcoustics.sourceintegration
— Methodsourceintegration(x::Vector,env::Environment,limits::Vector{T}) where T
sourceintegration(x::Vector,env::Environment,limits::Vector{Vector{T}}) where T
sourceintegration(x::FreqArray,env::Environment,limits::Vector{T}) where T
sourceintegration(x::FreqArray,env::Environment,limits::Vector{Vector{T}}) where T
Source integration of x
from limits
given in cartesian coordinates [xmin,xmax,ymin,ymax]
.
src1 = [-0.1,0.1,-0.1,0.1]
src2 = [-0.2,0.0,-0.1,0.1]
limits = [src1,src2]
srcint = sourceintegration(x,env,limits)
Optionally supply keyword int_thres
to set a threshold on source integration. Default is set to Inf
which sum all values within integration region.
AeroAcoustics.steeringvectors
— Methodsteeringvectors(E::Environment)
Pre-compute steeringvectors for beamforming using an Environment
with the needed parameters.
AeroAcoustics.csm_slow
— Methodcsm_slow(t;n=1024,noverlap=div(n,2),fs=1,win=DSP.hanning(n),scaling="spectrum")
Calculate cross-spectral matrix from time series t
which is S x M
dimensional, where S
is the number of samples and M
the number of microphones. This version is slower than csm
but allocates much less (in some cases), therefore csm_slow
could be used for long time signals.
AeroAcoustics.psf_col!
— Methodpsf_col!(p,steeringvec,cent)
Calculate single frequency point spread function as a column vector.
AeroAcoustics.point_to_region
— Methodpoint_to_region(src,dxdy)
Helper function to get integration limits from src
coordinates and size of area dxdy
sources = [(0.1,0.1),(-0.1,0.1),(-0.1,-0.1),(0.1,-0.1)]
dxdy = (0.1,0.1)
limits = point_to_region(sources,dxdy)
srcint = sourceintegration(x,env,limits)
AeroAcoustics.refraction_correction
— Functionr,pc_pm = refraction_correction(E::Environment[,h1=1.5,h2=z0-h1])
Compute propagation time correction and amplitude correction for 2D planar jet.
References: - Glegg, S., & Devenport, W. (2017). Aeroacoustics of low mach number flows: Fundamentals, analysis, and measurement. Chap. 10.
AeroAcoustics.refraction_correction
— Methodr,pc_pm = refraction_correction(Δx,Δy,Δz,Ma,h1,h2)
Compute propagation time correction and amplitude correction for 2D planar jet.
References: - Glegg, S., & Devenport, W. (2017). Aeroacoustics of low mach number flows: Fundamentals, analysis, and measurement. Chap. 10.
Advanced methods
AeroAcoustics.cleanSC
— MethodcleanSC(E[;maxiter=50,ϕ=0.5,stopn=10,peak_removal=false,trust_region=nothing])
CLEAN-SC algorithm for source identification and quantification optionally setting maximum iterations maxiter
(default 50), and loop gain ϕ
(default 0.5). Additionally, a stopping criterion max_peak[i] > max_peak[i-stopn]
can be set with parameter stopn
. Subtraction of peak sources in the dirty map is supported by peak_removal=true/false
to remove peak sources outside trust_region
with limits given as [xmin,xmax,ymin,ymax]
e.g. trust_region=[-0.75;1.5;-1.0;1.0]
.
References:
- Sijtsma, P. (2007). CLEAN based on spatial source coherence. International Journal of Aeroacoustics, 6(4), 357–374.
With inspiration from https://github.com/acoular/acoular/blob/66cba3cffb3bc72602c869f99347be76798f4ac1/acoular/fbeamform.py#L1496
AeroAcoustics.damas
— Methoddamas(env::Environment, b [,f<:AbstractArray, ω::Real]; maxiter=10)
Performs exactly maxiter
DAMAS iterations for all frequency bins in env.fn
or frequencies in f
. f
must contain values that match exact a (sub)set of the values in env.fn
. Successive Over Relaxation (SOR) can be set with relaxation parameter ω
. Default is ω=1
corresponding to no relaxation.
References:
Brooks, T. F. et al. (2006). A deconvolution approach for the mapping of acoustic sources (DAMAS) determined from phased microphone arrays. J.Sound.Vib. 294(4), 856–879. https://doi.org/10.1016/j.jsv.2005.12.046
AeroAcoustics.fista
— Methodfista(env::Environment,b ,p [,f<:AbstractArray]; tol=1e-6, maxit=1000)
Performs deconvolution with FISTA with a nonnegativity constraint for all frequency bins in env.fn
or frequencies in f
. f
must contain values that match exact a (sub)set of the values in env.fn
.
Arguments
Required:
env::Environment
: Environment structb::FreqArray
: Beamforming arrayp::FreqArray
: Point spread function array
Optional:
tol
: Convergence tolerance (default: 1e-6)maxit
: Maximum number of iterations (default: 1000)
References:
- Beck, A., & Teboulle, M. (2009). A fast iterative shrinkage-thresholding algorithm for linear inverse problems. SIAM journal on imaging sciences, 2(1), 183-202.
- Lylloff, O., Fernández-Grande, E., Agerkvist, F., Hald, J., Tiana Roig, E., & Andersen, M. S. (2015). Improving the efficiency of deconvolution algorithms for sound source localization. The journal of the acoustical society of America, 138(1), 172-180