Skip to content

Instantly share code, notes, and snippets.

@aewallin
Created June 12, 2023 06:43
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 aewallin/8caf2dbdeba4e0008ae697c6aeafffa5 to your computer and use it in GitHub Desktop.
Save aewallin/8caf2dbdeba4e0008ae697c6aeafffa5 to your computer and use it in GitHub Desktop.
Minimal demo of AllanTools realtime use
import allantools as at
import numpy as np
decades = 3
x_all = np.random.randn(pow(10, decades)) # test time-series
dev_rt = at.realtime.oadev_realtime(auto_afs=True,tau0=1.0)
n=0
for x in x_all:
dev_rt.add_phase(x)
n=n+1
if n%100==0: # print out taus, devs every 100 samples added
print(n, dev_rt.taus(), dev_rt.devs())
""" output
100 [ 1. 2. 3. 6. 10. 18. 32.] [1.82945958 0.86446256 0.61579566 0.30911865 0.20048262 0.1011053
0.06169031]
200 [ 1. 2. 3. 6. 10. 18. 32. 56.] [1.79701015 0.82587503 0.59989677 0.28566837 0.17247098 0.09926979
0.05794194 0.03403297]
300 [ 1. 2. 3. 6. 10. 18. 32. 56. 100.] [1.77708388 0.84671188 0.60677001 0.27978805 0.17850957 0.10156645
0.05381443 0.03283014 0.01776692]
400 [ 1. 2. 3. 6. 10. 18. 32. 56. 100. 178.] [1.84149586 0.87525721 0.62581232 0.29780473 0.18450432 0.09945422
0.05289148 0.03291331 0.01808446 0.00935772]
500 [ 1. 2. 3. 6. 10. 18. 32. 56. 100. 178.] [1.84012405 0.91744209 0.6190796 0.30511218 0.18811762 0.10295389
0.05484504 0.03430562 0.01848204 0.01044327]
600 [ 1. 2. 3. 6. 10. 18. 32. 56. 100. 178.] [1.75831917 0.90653858 0.60659755 0.29835204 0.18243773 0.10043421
0.05538162 0.03329266 0.01856016 0.01066665]
700 [ 1. 2. 3. 6. 10. 18. 32. 56. 100. 178. 316.] [1.73259687 0.90253217 0.59562255 0.29727196 0.18293965 0.09973552
0.05452752 0.03325574 0.01827361 0.0104459 0.00538115]
800 [ 1. 2. 3. 6. 10. 18. 32. 56. 100. 178. 316.] [1.72933057 0.89326275 0.58870074 0.2964609 0.18153526 0.09979639
0.05532126 0.03278551 0.01803727 0.01017652 0.00602375]
900 [ 1. 2. 3. 6. 10. 18. 32. 56. 100. 178. 316.] [1.71382538 0.89606599 0.58630677 0.29370196 0.17976715 0.10045458
0.05542443 0.03248735 0.01793483 0.00999699 0.00573001]
1000 [ 1. 2. 3. 6. 10. 18. 32. 56. 100. 178. 316.] [1.68963069 0.88265065 0.58549858 0.29017268 0.17814069 0.09942849
0.05484949 0.03223238 0.01789586 0.00987196 0.00553032]
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment