tierms_phase deverr
Looking at the code for tierms_phase, it looks like the deverr output is always zero. I think line 464 should be
deverrs.append(tie / math.sqrt(ncount))
instead of
deverrs.append(dev / math.sqrt(ncount))
As the dev variable is never used. The new method would be
def tierms_phase(phase, rate, taus):
""" TIE rms """
rate = float(rate)
(m, taus_used) = tau_m(phase, rate, taus)
count = len(phase)
devs = []
deverrs = []
ns = []
for mj in m:
ncount = 0
tie = []
for i in range(count - mj):
phases = [phase[i], phase[i + mj]] # pair of phases at distance mj from eachother
tie.append(max(phases) - min(phases)) # phase error
ncount += 1
# RMS of tie vector
tie = [pow(x, 2) for x in tie] # square
tie = numpy.mean(tie) # mean
tie = math.sqrt(tie) # root
devs.append(tie)
deverrs.append(tie / math.sqrt(ncount))
ns.append(ncount)
return remove_small_ns(taus_used, devs, deverrs, ns)
Looking into this long standing issue...
Code has changed a lot since this report, notably because of switch to numpy-style.
The corresponding line now reads (allantools.py, 1030):
deverrs[idx] = 0 / np.sqrt(ncount) # TODO! I THINK THIS IS WRONG!
Logically I think it should be "tie / np.sqrt(ncount)", as suggested. However Stable32 does not issue any confidence interval for TIE rms stats, maybe there is a good reason for that: do you think it may be misleading to use this zeroth-order estimator ?
Here are the choices:
- Leave it as it is
- Put np.nan instead to make sure nobody uses deverrs for tierms
- put "tie / np.sqrt(ncount)"
- a more sophisticated approach
In any case I can provide a test using a short data sample + expected TIE rms results from stable32 (I think right now there is no test checking that the results are OK, just that the function runs and returns a result).