-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilityHelper.py
More file actions
47 lines (29 loc) · 981 Bytes
/
UtilityHelper.py
File metadata and controls
47 lines (29 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import numpy as np
from enum import Enum
PRIMES = np.array([
3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109,
113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 233, 239
])
class TransportProtocol(Enum):
UDP = 'udp'
TCP = 'tcp'
class IPProtocol(Enum):
IPv4 = 'ip'
IPv6 = 'ipv6'
class TimeUnit(Enum):
SEC = 'sec'
MSEC = 'msec'
NANOSEC = 'nanosec'
def B_to_Mb(val):
return val * 8e-6
def to_pct(val):
return np.around(val * 100, 2)
def create_intervals_list(start, end, step):
intervals = []
for value in np.arange(start, end, step):
intervals.append(np.around([value, value+step], 3))
return intervals
def get_ci_level(alpha=0.95):
return np.round(norm.ppf(alpha + (1-alpha)/2), 2)
def append_to_df(data_df, data_entry):
data_df.loc[len(data_df.index)] = data_entry