Skip to content

Instantly share code, notes, and snippets.

@tspspi
Created June 14, 2022 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tspspi/7988fb97625b4ccf02a870ee12d8d38f to your computer and use it in GitHub Desktop.
Save tspspi/7988fb97625b4ccf02a870ee12d8d38f to your computer and use it in GitHub Desktop.
Simple Allan deviation in time domain
# Simple and direct overlapping Allan deviation
# for stability analysis in time domain (i.e. "phase" samples)
def overlappingAlanDeviationTimeDomain(timestamps, samples, overlapWindowSize = 2):
oadev = []
taus = []
tau0 = (timestamps[len(timestamps)-1] - timestamps[0]) / (len(timestamps))
for nLimit in range(2*overlapWindowSize, len(timestamps)):
tau = tau0 * nLimit
sum = 0
for i in range(nLimit - 2*overlapWindowSize):
sum = sum + (samples[i + 2*overlapWindowSize] - 2 * samples[i + overlapWindowSize] + samples[i])**2.0
sum = sum / (2 * (nLimit - 2*overlapWindowSize) * tau**2)
oadev.append(sum)
taus.append(len(taus) * tau0)
return taus, oadev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment