• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aewallin / allantools / 6997134815

26 Nov 2023 05:57PM UTC coverage: 74.663% (-10.1%) from 84.742%
6997134815

push

github

aewallin
coverage workflow

1273 of 1705 relevant lines covered (74.66%)

2.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.85
/allantools/mask.py
1
"""
2
    This file is part of AllanTools
3
    https://github.com/aewallin/allantools
4

5
    TDEV and MTIE masks for ITU Standards
6
    AW2017-2018
7

8
    ITU Primary Reference Clock
9
    https://www.itu.int/rec/T-REC-G.811/en
10

11
    ITU Primary Reference Time Clock
12
    https://www.itu.int/rec/T-REC-G.8272/en
13

14
    ITU Enhanced Primary Reference Time Clock
15
    https://www.itu.int/rec/T-REC-G.8272.1/en
16
"""
17

18

19
def prc_tdev(tau):
2✔
20
    """ Time Deviation, ITU Primary Reference Clock
21
        https://www.itu.int/rec/T-REC-G.811/en
22
        Recommendation G.811 (1997) Amendment 1 (04/16)
23
        Approved in 2016-04-13
24
    """
25
    if tau < 100:
3✔
26
        return 3e-9
3✔
27
    if tau < 1000:
3✔
28
        return 0.03*1.0e-9*tau
3✔
29
    else:
×
30
        return 30e-9
3✔
31

32

33
def prc_mtie(tau):
3✔
34
    """ MTIE, ITU Primary Reference Clock
35
        https://www.itu.int/rec/T-REC-G.811/en
36
        Recommendation G.811 (1997) Amendment 1 (04/16)
37
        Approved in 2016-04-13
38
    """
39
    if tau < 1000:
3✔
40
        return 1e-6 * (tau*0.275e-3 + 0.025)
3✔
41
    else:
×
42
        return 1e-6 * (tau*1.0e-5 + 0.29)
3✔
43

44

45
def eprtc_tdev(tau):
3✔
46
    """ Time Deviation, ITU Enhanced Primary Reference Time Clock
47
        https://www.itu.int/rec/T-REC-G.8272.1/en
48
        Recommendation G.8272.1/Y.1367.1 (2016) Amendment 1 (08/17)
49
        Approved in 2017-08-13
50

51
        Table 2 TDEV, page 4
52
    """
53
    if tau < 30e3:
3✔
54
        return 1e-9
3✔
55
    if tau < 300e3:
×
56
        return 3.33333e-5*1.0e-9*tau
×
57
    else:
×
58
        return 10e-9
×
59

60

61
def eprtc_mtie(tau):
3✔
62
    """ MTIE
63
        ITU Enhanced Primary Reference Time Clock
64
        https://www.itu.int/rec/T-REC-G.8272.1/en
65
        Recommendation G.8272.1/Y.1367.1 (2016) Amendment 1 (08/17)
66
        Approved in 2017-08-13
67

68
        Table 1, page 3
69
    """
70
    if tau <= 1:
3✔
71
        return 4e-9
3✔
72
    if tau <= 100:
3✔
73
        return 1e-9*(0.11114*tau+3.89)
3✔
74
    if tau <= 400000:
3✔
75
        return 1e-9*(0.0375e-3*tau+15)
3✔
76
    else:
×
77
        return 1e-9*30  # 30 ns
3✔
78

79

80
def prtcA_tdev(tau):
3✔
81
    """ Time Deviation
82
        ITU Primary Reference Time Clock
83
        https://www.itu.int/rec/T-REC-G.8272/en
84
        Recommendation G.8272/Y.1367 (11/18)
85
        Approved in 2018-11-29
86

87
        Table 3
88
    """
89
    if tau < 100:
3✔
90
        return 3e-9
3✔
91
    if tau < 1000:
3✔
92
        return 0.03e-9*tau
3✔
93
    else:
×
94
        return 30e-9
3✔
95

96

97
def prtcB_tdev(tau):
3✔
98
    """ Time Deviation
99
        ITU Primary Reference Time Clock
100
        https://www.itu.int/rec/T-REC-G.8272/en
101
        Recommendation G.8272/Y.1367 (11/18)
102
        Approved in 2018-11-29
103

104
        Table 4
105
    """
106
    if tau < 100:
3✔
107
        return 1e-9
3✔
108
    if tau < 500:
3✔
109
        return 0.01e-9*tau
3✔
110
    else:
×
111
        return 5e-9
3✔
112

113

114
def prtcA_mtie(tau):
3✔
115
    """ MTIE
116
        ITU Primary Reference Time Clock
117
        https://www.itu.int/rec/T-REC-G.8272/en
118

119
        Table 1
120
    """
121
    if tau < 273:
3✔
122
        return 1e-6 * (0.275e-3*tau + 0.025)
3✔
123
    else:
×
124
        return 1e-6 * 0.1  # 100ns
3✔
125

126

127
def prtcB_mtie(tau):
3✔
128
    """ MTIE
129
        ITU Primary Reference Time Clock
130
        https://www.itu.int/rec/T-REC-G.8272/en
131

132
        Table 2
133
    """
134
    if tau < 54.5:
3✔
135
        return 1e-6 * (0.275e-3*tau + 0.025)
3✔
136
    else:
×
137
        return 1e-6 * 0.04  # 40ns
3✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc