7
7
Version history
8
8
---------------
9
9
10
- **2019.07**
10
+ **2019.07** 2019 August 3
11
11
- move edf-functions and noise-ID functions to ci.py
12
12
- mtotdev() htotdev() speed improvements
13
13
- save dataset results to text file
14
14
- real-time adev/mdev/hdev
15
- - travis testing on Lniux , OSX, and Windows
15
+ - travis testing on Linux , OSX, and Windows
16
16
17
17
**2018.03** 2018 March 27
18
18
- change license to LGPL v3 or later
@@ -718,17 +718,18 @@ def calc_mtotdev_phase(phase, rate, m):
718
718
""" PRELIMINARY - REQUIRES FURTHER TESTING.
719
719
calculation of mtotdev for one averaging factor m
720
720
tau = m*tau0
721
-
721
+
722
722
NIST [SP1065]_ Eqn (27), page 25.
723
-
723
+
724
724
Computed from a set of N - 3m + 1 subsequences of 3m points.
725
- 1. A linear trend (frequency offset) is removed from the subsequence
726
- by averaging the first and last halves of the subsequence and dividing by half the interval.
725
+ 1. A linear trend (frequency offset) is removed from the subsequence
726
+ by averaging the first and last halves of the subsequence and
727
+ dividing by half the interval.
727
728
2. The offset-removed subsequence is extended at both ends
728
729
by uninverted, even reflection.
729
730
730
731
[Howe1999]_
731
- D.A. Howe and F. Vernotte, "Generalization of the Total Variance
732
+ D.A. Howe and F. Vernotte, "Generalization of the Total Variance
732
733
Approach to the Modified Allan Variance," Proc.
733
734
31 st PTTI Meeting, pp. 267-276, Dec. 1999.
734
735
"""
@@ -765,10 +766,10 @@ def calc_mtotdev_phase(phase, rate, m):
765
766
# remove the linear trend
766
767
x0 = [x - slope * idx * tau0 for (idx , x ) in enumerate (xs )]
767
768
x0_flip = x0 [::- 1 ] # left-right flipped version of array
768
-
769
+
769
770
# Step 2.
770
771
# extend sequence, by uninverted even reflection
771
- # extended sequence xstar, of length 9m,
772
+ # extended sequence xstar, of length 9m,
772
773
xstar = np .concatenate ((x0_flip , x0 , x0_flip ))
773
774
assert len (xstar ) == 9 * m
774
775
@@ -778,8 +779,7 @@ def calc_mtotdev_phase(phase, rate, m):
778
779
# one term in the 6m sum: [ x_i - 2 x_i+m + x_i+2m ]^2
779
780
squaresum = 0.0
780
781
#print('m=%d 9m=%d maxj+3*m=%d' %( m, len(xstar), 6*int(m)+3*int(m)) )
781
-
782
-
782
+
783
783
# below we want the following sums (averages, see squaresum where we divide by m)
784
784
# xmean1=np.sum(xstar[j : j+m])
785
785
# xmean2=np.sum(xstar[j+m : j+2*m])
@@ -790,16 +790,16 @@ def calc_mtotdev_phase(phase, rate, m):
790
790
# faster inner sum, based on Stable32 MTC.c code
791
791
if j == 0 :
792
792
# intialize the sum
793
- xmean1 = np .sum ( xstar [0 :m ] )
794
- xmean2 = np .sum ( xstar [m :2 * m ] )
795
- xmean3 = np .sum ( xstar [2 * m :3 * m ] )
793
+ xmean1 = np .sum (xstar [0 :m ])
794
+ xmean2 = np .sum (xstar [m :2 * m ])
795
+ xmean3 = np .sum (xstar [2 * m :3 * m ])
796
796
else :
797
797
# j>=1, subtract old point, add new point
798
798
xmean1 = xmean1 - xstar [j - 1 ] + xstar [j + m - 1 ] #
799
799
xmean2 = xmean2 - xstar [m + j - 1 ] + xstar [j + 2 * m - 1 ] #
800
800
xmean3 = xmean3 - xstar [2 * m + j - 1 ] + xstar [j + 3 * m - 1 ] #
801
801
802
- squaresum += pow ( (xmean1 - 2.0 * xmean2 + xmean3 )/ float (m ), 2 )
802
+ squaresum += pow ((xmean1 - 2.0 * xmean2 + xmean3 )/ float (m ), 2 )
803
803
804
804
squaresum = (1.0 / (6.0 * m )) * squaresum
805
805
dev += squaresum
@@ -817,7 +817,7 @@ def htotdev(data, rate=1.0, data_type="phase", taus=None):
817
817
""" PRELIMINARY - REQUIRES FURTHER TESTING.
818
818
Hadamard Total deviation.
819
819
Better confidence at long averages for Hadamard deviation
820
-
820
+
821
821
Computed for N fractional frequency points y_i with sampling
822
822
period tau0, analyzed at tau = m*tau0
823
823
1. remove linear trend by averaging first and last half and divide by interval
@@ -941,17 +941,17 @@ def calc_htotdev_freq(freq, m):
941
941
# new faster way of doing the sums
942
942
if j == 0 :
943
943
# intialize the sum
944
- xmean1 = np .sum ( xstar [0 :m ] )
945
- xmean2 = np .sum ( xstar [m :2 * m ] )
946
- xmean3 = np .sum ( xstar [2 * m :3 * m ] )
944
+ xmean1 = np .sum (xstar [0 :m ])
945
+ xmean2 = np .sum (xstar [m :2 * m ])
946
+ xmean3 = np .sum (xstar [2 * m :3 * m ])
947
947
else :
948
948
# j>=1, subtract old point, add new point
949
949
xmean1 = xmean1 - xstar [j - 1 ] + xstar [j + m - 1 ] #
950
950
xmean2 = xmean2 - xstar [m + j - 1 ] + xstar [j + 2 * m - 1 ] #
951
951
xmean3 = xmean3 - xstar [2 * m + j - 1 ] + xstar [j + 3 * m - 1 ] #
952
952
953
- squaresum += pow ( (xmean1 - 2.0 * xmean2 + xmean3 )/ float (m ), 2 )
954
-
953
+ squaresum += pow ((xmean1 - 2.0 * xmean2 + xmean3 )/ float (m ), 2 )
954
+
955
955
k = k + 1
956
956
assert k == 6 * m # check number of terms in the sum
957
957
squaresum = (1.0 / (6.0 * k )) * squaresum
@@ -1097,7 +1097,7 @@ def mtie_rolling_window(a, window):
1097
1097
-------
1098
1098
Array that is a view of the original array with a added dimension
1099
1099
of size window.
1100
-
1100
+
1101
1101
Note
1102
1102
----
1103
1103
This may consume large amounts of memory. See discussion:
0 commit comments