aewallin/allantools

Is Allan deviation actually Allan Variance?

Closed this issue · 5 comments

Hi! I just was confused with the naming of the functions and corresponding formulas.
What do you really call Allan Deviation? Here is a screenshot of the documentation,
Capture1
and a screenshot from wiki
image

Looking at the code, it is quite difficult to track the exact formulas, but it seems that the *DEV functions, in reality, calculate the variance, do not they?

Best regards!

Hi Werefkin,

The allantools.*dev functions are correctly calculating the deviations. It's just that the docstrings are showing the more standard formulas of the corresponding variances.

So what you get with e.g. allantools.adev is the square root of what is shown in the docstring :)

Hi Werefkin,

The allantools.*dev functions are correctly calculating the deviations. It's just that the docstrings are showing the more standard formulas of the corresponding variances.

So what you get with e.g. allantools.adev is the square root of what is shown in the docstring :)

Thank you for the response, if it is true I would recommend then to highlight it somehow.

Nevertheless, then I observe a very weird discrepancy with the output of the Matlab Function (ALLANVAR - Allan variance)
Here I plot the output of the OADEV, ADEV and Matlab allanvar() functions,
image
First of all, the slopes seem to be the same for all of them (that is why it also made me believe AllanTools calculate AVAR and not ADEV), but the absolute value is quite different. Do you know what can be the reason? Also, it might look like they are related via square(-root) because one is ADEV and another is AVAR -- as you mentioned above, however, it is not true taking the square-root for the Matlab's output, will of course also change the slope.

So are you sure that the DEV and not the VAR is calculated? and if so, what can be the reason for different Allan*** values?
Also, I have to note that another python implementation given here https://github.com/nmayorov/allan-variance returns the result similar to Matlab, here I give it in the simplest form, the argument for all functions is only dataset (i.e. no dt or sampling freqs).
image
and just to finalise, ADEV calculated for the Matlab's AVAR -- to see that ADEVs for these two algorithms are quite different with yours also the slope (if we assume AllanTools returns ADEV)
image

PS Of course, the same data set has been used in all three cases.

Best regards,

Ok, I could reproduce the same curve using both oadev and matlab function (sqrt(allanvar()))
to do that, in the code (actually, I used the abovementioned python algorithm), I replaced
the following line
X = np.cumsum(x, axis=0)

where x is the input array, with
X = x
because I actually could not understand why would it be the cumulative sum, maybe you would have an idea.

And then yes, the results is the same.
image

Best,

Thanks for the comment on the documentation - I agree that it could be made clearer wrt. xDEV and xVAR.

All of the AllanTools function produce deviations, eg. ADEV = sqrt(AVAR) - but the documentation may not be so clear about this.

In a simple case where you have 1 data point per second, you can convert from fractional frequency data (usually named 'y') to phase-data (in units of seconds, usually named 'x') with x=cumsum(y).

AllanTools can take either fractional frequency data or phase data as input, if you use the data_type argument.
I haven't looked at your matlab code, but maybe it takes only fractional frequency as input?

Thanks for the comment on the documentation - I agree that it could be made clearer wrt. xDEV and xVAR.

All of the AllanTools function produce deviations, eg. ADEV = sqrt(AVAR) - but the documentation may not be so clear about this.

In a simple case where you have 1 data point per second, you can convert from fractional frequency data (usually named 'y') to phase-data (in units of seconds, usually named 'x') with x=cumsum(y).

AllanTools can take either fractional frequency data or phase data as input, if you use the data_type argument.
I haven't looked at your matlab code, but maybe it takes only fractional frequency as input?

Hi Anders,

Yes, I resolved the issue, that is true -- Matlab code takes fractional frequency (only), although it is not stated anywhere in the description of the function directly, but here https://de.mathworks.com/help/nav/ug/inertial-sensor-noise-analysis-using-allan-variance.html

The problem is that I am going to use the Allan Variance to analyse the stability of the laser output power (input array is the power levels equidistantly measured each minute), I guess the default is "phase" data type is not really correct here, would you agree?

thank you for the discussion