-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimings.py
94 lines (67 loc) · 1.82 KB
/
timings.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
"""
Code to summarize the timings for writing the ATBD
"""
import numpy as np
import pandas as pd
sam = 4
if sam == 1:
file1 = 'DSCOVR_MAG_4-4_4317541.csv'
file2 = 'DSCOVR_MAG_4-8_4317541.csv'
ns = 4317541
nw = 4
elif sam == 2:
file1 = 'DSCOVR_MAG_8-8_4317541.csv'
file2 = 'DSCOVR_MAG_8-16_4317541.csv'
ns = 4317541
nw = 8
elif sam == 3:
file1 = 'DSCOVR_MAG_30-30_4317541.csv'
file2 = 'DSCOVR_MAG_30-60_4317541.csv'
ns = 4317541
nw = 30
elif sam == 4:
file1 = 'DSCOVR_MAG_480-480_4317541.csv'
file2 = 'DSCOVR_MAG_480-960_4317541.csv'
ns = 172800
nw = 480
# na is the length of the averaged variable
if np.mod(ns,nw) == 0:
na = np.int64(ns / nw)
else:
na = np.int64(ns / nw) + 1
print(f"Na = {na}")
file1 = 'timings/'+file1
file2 = 'timings/'+file2
# time in seconds to compute a 6-hr internal with 1 min windows
# (360 window)
norm = 360.0 / (float(na))
#-------------------------
df1 = pd.read_csv(file1, header=None)
df1[3] = df1[1] * norm
df1[4] = df1[2] * norm
df1[5] = df1[1]/df1[0]
df1[6] = df1[2]/df1[0]
print(80*'*')
print(file1)
print(df1)
#-------------------------
df2 = pd.read_csv(file2, header=None)
df2[3] = df2[1] * norm
df2[4] = df2[2] * norm
df2[5] = df2[1]/df2[0]
df2[6] = df2[2]/df2[0]
print(80*'*')
print(file2)
print(df2)
#-------------------------
# overhead of overlapping windwo
print(80*'*')
print(df2.iloc[-1,1]/df1.iloc[-1,1])
print(df2.iloc[-1,2]/df1.iloc[-1,2])
#-------------------------
print(80*'*')
print("HL: {ts:18.2f} {tb:18.2f}".format(ts=df1.iloc[-1,3],tb=df1.iloc[-1,5]))
print(" M: {ts:18.2f} {tb:18.2f}".format(ts=df1.iloc[-1,4],tb=df1.iloc[-1,6]))
print("HL: {ts:18.2f} {tb:18.2f}".format(ts=df2.iloc[-1,3],tb=df2.iloc[-1,5]))
print(" M: {ts:18.2f} {tb:18.2f}".format(ts=df2.iloc[-1,4],tb=df2.iloc[-1,6]))
print(80*'*')