-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
164 lines (111 loc) · 3.63 KB
/
test.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import time
import timeit
import numpy as np
import pandas as pd
import sys
def startacqu(index):
if index == 0:
time.sleep(1.5)
if index == 1:
time.sleep(3)
if index == 2:
time.sleep(6)
if index == 3:
time.sleep(89)
def getdat():
time.sleep(np.random.randint(1,3))
def savefits():
time.sleep(np.random.randint(1,3))
def getformattedtime():
#formatted_time = float(f'{time.time():.1f}')
formatted_time = np.round(time.time())
return formatted_time
def format_output(val1, val2):
output = float(f'{val2-val1:.3f}')
return output
def printProgressBar(i,max,postText):
n_bar =100 #size of progress bar
j= i/max
sys.stdout.write('\r')
sys.stdout.write(f"[{'|' * int(n_bar * j):{n_bar}s}] {int(100 * j)}% {postText}")
sys.stdout.flush()
def getreadtimes():
pag_dict = {0: 1.00,
1: 2.00,
2: 4.00
}
vss_dict = {0: 38.0,
1: 76.0
}
hss_dict = {0: 5.00,
1: 3.00,
2: 1.00,
3: 0.05
}
d = {'Indices': [],
'PAG': [],
'VSS (um)': [],
'HSS (MHz)': [],
't_01': [],
't_02': [],
't_03': [],
't_12': [],
't_13': [],
't_23': []
}
readtime_data = []
counter = 1
steps = 5
for pag_index in range(3):
for vs_index in range(2):
for hs_index in range(4):
print(f'{pag_index},{vs_index},{hs_index} [{counter} of 24]')
printProgressBar(0, steps, 'Starting Acquisition')
t_0 = getformattedtime()
startacqu(index=hs_index)
printProgressBar(1, steps, 'Getting Acquired Data')
t_1 = getformattedtime()
getdat()
t_2 = getformattedtime()
printProgressBar(2, steps, 'Writing to FITS')
savefits()
t_3 = getformattedtime()
printProgressBar(3, steps, 'Calculating Readout Times')
t_01 = format_output(t_0, t_1)
t_02 = format_output(t_0, t_2)
t_03 = format_output(t_0, t_3)
'''
print(f't_01: {t_01}')
print(f't_02: {t_02}')
print(f't_03: {t_03}')
'''
t_12 = format_output(t_1, t_2)
t_13 = format_output(t_1, t_3)
'''
print(f't_12: {t_12}')
print(f't_13: {t_13}')
'''
t_23 = format_output(t_2, t_3)
# print(f't_23: {t_23}')
indicies = f'({pag_index},{vs_index},{hs_index})'
printProgressBar(4, steps, 'Creating Data Frame')
d['Indices'].append(indicies)
d['PAG'].append(pag_dict[pag_index])
d['VSS (um)'].append(vss_dict[vs_index])
d['HSS (MHz)'].append(hss_dict[hs_index])
d['t_01'].append(t_01)
d['t_02'].append(t_02)
d['t_03'].append(t_03)
d['t_12'].append(t_12)
d['t_13'].append(t_13)
d['t_23'].append(t_23)
printProgressBar(5, steps, 'Complete')
counter = counter + 1
print('\n')
readtime_df = pd.DataFrame(data=d)
print(readtime_df)
print('Beginning Cool Down')
for i in range(15):
print(f'[time/temp/status]: {i+1} sec / {np.random.randint(25,35)} C / DRV_TEMP_NOT_REACHED')
time.sleep(1)
print('Camera Cooled')