Calculating "bits of accuracy"? There are two arrays o data (reference data and test data), all in the [-1.0,+1.0] range (audio signal).
In order to decide weather the test data are "similar enough" to the reference, the mean absolute difference and max absolute difference is computed, then compared to some pre-defined threshold.
To these two measures, I would like to add the 3rd: bits of accuracy. How would I defined the bits of accuracy in a meaningfull way? Somewhere I came accros the following definition: bits_of_accuracy = -np.round( np.log(max_abs_diff) / np.log(2) ), but I don't see the logic behind it, nor what should be the acceptable threshold value?
 A: I'll try to give a meaning of the formula you have and its meaning. Once you understand what does it mean, I think you can decide if the measure is suitable for you and propose some threshold values for your application.
First, some preliminaries. Without loss of generality, lets work only with positive numbers. Any number $x\in[0,1]$ can be represented as a series
$$
x = \sum_{i = 0}^\infty b_i 2^{-i}
$$
with $b_i\in\{0,1\}$, which we call a binary decomposition. If we work with finite precision, the summation terminates at some $i=N$
$$
x = \sum_{i = 0}^N b_i 2^{-i}
$$
Thus, the binary string $b_0,b_1,\dots,b_N$ represents the number $x$.
Note that the magnitude of $2^{-i}$ decrease as you increase $i$. Hence, some measure of the size of a number $x$ would be the largest power of two, present in the binary decomposition of $x$, in other words, the largest contribution in the binary decomposition.
Assume that the binary expansion of $x$ starts with $b_0=b_1=\cdots=b_{M-1}=0$, $b_M=1$, $M\leq N$. Thus,
$$
x = 2^{-M} + \cdots b_N2^{-N}
$$
And the largest contribution is given by $2^{-M}$. Now, how can we obtain such value of $M$ if we are only given the number $x$? Among one of the many options, one way is the following. Let $y = x2^N$ so that
$$
y = 2^{N-M}+\dots +b_{N-1}2^{N-1} + b_N
$$
thus $y$ is an integer, the largest power of two in $y$ is $N-M$ and can be obtained by the well known relation $\lfloor \log_2(y) \rfloor$. Thus:
$$
M =N- \lfloor \log_2(y) \rfloor = N-\lfloor \log_2(x2^N) \rfloor = N-\lfloor \log_2(x) + N \rfloor =-\lfloor \log_2(x) \rfloor
$$
Finally, convert the base-2 log, to natural base as:
$$
M = -\left\lfloor\frac{\ln(x)}{\ln(2)}\right\rfloor
$$
which is precisely the formula you are using.
Thus, $M = -\left\lfloor\frac{\ln(x)}{\ln(2)}\right\rfloor$ measures the amount of places in the binary representation of $x$ you need to move to the right (towards decreasing powers of two) until you find the first $1$. A larger $M$ means smaller $x$.
All these was to explain what the formula you found means. Now you can think if it is useful for you. What did you expected the measure "bits of accuracy" to capture?
