Commit 7809a373 authored by ollyl's avatar ollyl

Added experimental coherence weighting

parent 1b2b7af3
image: julia:1.5 # image comes from Docker hub
image: julia:1.3 # image comes from Docker hub
before_script:
- apt-get -qq update; apt-get -y install git hdf5-tools
......
......@@ -21,7 +21,7 @@ Distances = "0.9.0"
LazyArrays = "0.18.1"
NLsolve = "4.4.1"
Parameters = "0.12.1"
julia = "^1"
julia = "^1.4"
[extras]
BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
......
......@@ -25,7 +25,9 @@ export Environment,
octavebands,
narrow2oct,
enbw,
coherence_weights
coherence_weights,
DR!,
DR
include("utils.jl")
......@@ -65,4 +67,36 @@ function narrow2oct(x::FreqArray,n;nomial::Bool=true,psd::Bool=false)
return FreqArray(out,fc)
end
"""
DR!(CSM::FreqArray)
Apply diagonal removal to CSM.
"""
function DR!(CSM::FreqArray)
T = eltype(CSM)
M,M,Nf = size(CSM)
for j = 1:Nf
for i = 1:M
CSM.arr[i,i,j] = zero(T)
end
end
end
"""
DR(CSM::FreqArray)
Apply diagonal removal to CSM and new array.
"""
function DR(CSM::FreqArray)
T = eltype(CSM)
M,M,Nf = size(CSM)
CSMd = copy(CSM)
for j = 1:Nf
for i = 1:M
CSMd[i,i,j] = zero(T)
end
end
return FreqArray(CSMd,CSM.fc)
end
end
\ No newline at end of file
......@@ -35,7 +35,8 @@ setup, constants, and stores the relevant data together. The microphone array is
- `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`: Microphones coherence weighting.
- `wc::Bool=false`: Microphones coherence weighting.
- `dr::Bool=false`: Diagonal removal of CSM
- `w=ones(M,Nf)`: Microphone weights. If `wc=true` it calculates coherence weighting.
- `shear::Bool = false`: Amiet phase correction
- `ampcorr::Bool = shear`: Amiet amplitude correction (only applies when shear = true)
......@@ -59,15 +60,17 @@ setup, constants, and stores the relevant data together. The microphone array is
Ma::Real = 0.0 # Flow Mach speed (in positive x-direction) TODO: Generalize to NTuple{3,Real}
h::Real = 0.0 # Distance from array center to shear layer
### Compute extra parameters
dr::Bool = false
Cinds = (CSM.fc.>=flim[1]) .& (CSM.fc.<=flim[2])
fn = CSM.fc[Cinds]
wv::Vector = ones(size(micgeom,2)) # weights vector
micgeom_s = micgeom[:,Bool.(wv)]
CSM_s = FreqArray(CSM[Bool.(wv),Bool.(wv),Cinds],fn)
CSM_w = FreqArray(CSM[Bool.(wv),Bool.(wv),Cinds],fn)
CSM_s = ifelse(dr,DR(CSM_w),CSM_w)
M::Int = size(micgeom_s,2) #count((!iszero).(wv))
Nf::Int = length(fn)
wc::Bool = false
w = ifelse(wc,coherence_weights(CSM_s),ones(M,Nf))
w = ifelse(wc,coherence_weights(CSM_w),ones(M,Nf))
N = Nx*Ny
rx = range(xlim[1],stop = xlim[2], length = Nx)
ry = range(ylim[1],stop = ylim[2], length = Ny)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment