mtspec
mtspec copied to clipboard
Auto-Coherence Error
On occasion I experience the following crash-error: "Auto-coherence not applicable."
Reproduced via the coherence estimation below:
out = mt_coherence(1.0/fs, signal[:, ix], signal[:, iy], NW, k, int(n_sample_win/2), 0.95, iadapt=1,
cohe=True, freq=True)
For most signals the coherence estimate works fine, but on occasion I experience the above crash-error. I'm not sure how to error handle this.
Apologies, I discovered that my data had a dead" channel with zero signal amplitude.
Might still be worth to handle this. Also anybody else hitting this issue might profit from this report. So no need to apologize at all. :)
I just came across this same issue. The code doesn't compute the coherence estimate for two data series with the same amplitude which should normally be 1. I checked in the mt_cohe.f90 subroutine at lines 184-187, there is a condition that prevents the code from computing the auto-coherence estimate.
if (all(xi==xj)) then
write(6,'(a)') 'Auto-coherence not applicable'
stop
I don't understand the reason for such a condition since the autocoherence should be approximately 1. Any clue?