Implement handling of multiple polarizations... template following this code from Eliot, but is this the best way to do this? something something spherical harmonics?
// use the parallel and perpindicular waves to calculate A (anisotropy) for each polarization, then average as possible to create a single A
if(waveexists(parah) &&waveexists(perph))
make /o/n=1000 $cleanupname(basename+"_Ah",1), $cleanupname(basename+"_Ahx",1)
wave Ah = $cleanupname(basename+"_Ah",1)
wave Ahx = $cleanupname(basename+"_Ahx",1)
minq=max(wavemin(parahx),wavemin(perphx))
maxq = min(wavemax(parahx),wavemax(perphx))
setscale /i x,minq,maxq, Ah, Ahx
Ahx = x
Ah = (interp(Ahx,parahx,parah) - interp(Ahx,perphx,perph))/(interp(Ahx,parahx,parah) + interp(Ahx,perphx,perph))
duplicate /o Ah, $cleanupname(basename+"_A",1)
duplicate /o Ahx, $cleanupname(basename+"_Ax",1)
wave A = $cleanupname(basename+"_A",1)
wave Ax = $cleanupname(basename+"_Ax",1)
endif
if(waveexists(parav) && waveexists(perpv))
make /o/n=1000 $cleanupname(basename+"_Av",1), $cleanupname(basename+"_Avx",1)
wave Av = $cleanupname(basename+"_Av",1)
wave Avx = $cleanupname(basename+"_Avx",1)
minq=max(wavemin(paravx),wavemin(perpvx))
maxq = min(wavemax(paravx),wavemax(perpvx))
setscale /i x,minq,maxq, Av, Avx
Avx = x
Av = (interp(Avx,paravx,parav) - interp(Avx,perpvx,perpv))/(interp(Avx,paravx,parav) + interp(Avx,perpvx,perpv))
if(waveexists(A))
minq=min(wavemin(Avx),wavemin(Ahx))
maxq=max(wavemax(Avx),wavemax(Ahx))
setscale /i x,minq,maxq, A,Ax
Ax=x
A = x>=wavemin(Avx) && x<=wavemax(Avx) ? interp(x,Avx,Av) : 0
A+=x>=wavemin(Ahx) && x<=wavemax(Ahx) ? interp(x,Ahx,Ah) : 0
A /= x>=wavemin(Ahx) && x<=wavemax(Ahx) && x>=wavemin(Avx) && x<=wavemax(Avx) ? 2 : 1
else
duplicate /o Av,$cleanupname(basename+"_A",1)
duplicate /o Avx,$cleanupname(basename+"_Ax",1)
wave A = $cleanupname(basename+"_A",1)
wave Ax = $cleanupname(basename+"_Ax",1)
endif
endif
Implement handling of multiple polarizations... template following this code from Eliot, but is this the best way to do this? something something spherical harmonics?
// use the parallel and perpindicular waves to calculate A (anisotropy) for each polarization, then average as possible to create a single A