Hi all,
I have been playing a bit with the "corr_est_cc" block and I was banging my head to understand the meaning of the parameter "threshold".
In all examples it seems to be a number VERY close to 1.
The documentation is cryptic:
" Threshold of correlator, relative to a 100% correlation (1.0). Default is 0.9."
Upon inspection of the code it is clear that there is a mixup between the
quantities "threshold" and "1-probability of false alarm".
The code defines
d_pfa = -logf(1.0f-threshold);
which is clearly not the intended use: the pfa cannot be the log of something!
In fact, what is meant is that
===> THRESHOLD = -logf(PFA);
The smaller the PFA the larger the threshold should be.
This explains why we need to put a number close to 1 as "threshold" (which is actually 1-PFA).
Further down the code it shows how THRESHOLD is meant to be used:
float detection = 0;
for(int i = 0; i < noutput_items; i++) {
detection += d_corr_mag[i];
}
detection /= static_cast<float>(noutput_items);
detection *= d_pfa; <========================
Clearly, the average magnitude is evaluated and then it is multiplied by "d_pfa"
which is meaningless, unless (as mentioned above) you interpret this as
detection *= THRESHOLD;
To summarize:
-------------------
What is shown as "pfa" in the code is actually a THRESHOLD
What is shown as "threshold" in the code is actually 1-PFA.
The user actually inputs 1-PFA (erroneously named "threshold").
I hope this will help anyone having similar issues understanding how this block works.
best
Achilleas