-
Notifications
You must be signed in to change notification settings - Fork 0
/
save_from_db.py
59 lines (53 loc) · 1.75 KB
/
save_from_db.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
# coding: cp1251
from odbcAccess import expODBC
import xlwt as xls
db = expODBC(r"D:\work\NIIM\db-work2.accdb")
exp_code = 'c649-01'
xls_file_name = exp_code+'.xls'
experiment = db.getExperimentData(exp_code)
wb = xls.Workbook()
ws = wb.add_sheet(exp_code)
ws.write(0, 0, 'Óñòàíîâêà')
ws.write(1, 0, 'Íàãðóæàþùèé ìåðíûé ñòåðæåíü')
b1 = db.getBarData(experiment.bars[0])
ws.write(2, 0, 'E, ÌÏà')
ws.write(2, 1, b1.E)
ws.write(3, 0, 'c, ì/c')
ws.write(3, 1, b1.c)
ws.write(4, 0, 'D, ìì')
ws.write(4, 1, b1.d)
ws.write(5, 0, 'òàðèðîâî÷íûé êîýôôèöèåíò, 1/Â')
ws.write(5, 1, experiment.tarir[0])
ws.write(6, 0, 'ðàññòîÿíèå îò îáðàçöà äî äàò÷èêîâ, ìì')
ws.write(6, 1, experiment.datPosition[0])
ws.write(7, 0, 'Îïîðíûé ìåðíûé ñòåðæåíü')
b1 = db.getBarData(experiment.bars[1])
ws.write(8, 0, 'E, ÌÏà')
ws.write(8, 1, b1.E)
ws.write(9, 0, 'c, ì/c')
ws.write(9, 1, b1.c)
ws.write(10, 0, 'D, ìì')
ws.write(10, 1, b1.d)
ws.write(11, 0, 'òàðèðîâî÷íûé êîýôôèöèåíò, 1/Â')
ws.write(11, 1, experiment.tarir[1])
ws.write(12, 0, 'ðàññòîÿíèå îò îáðàçöà äî äàò÷èêîâ, ìì')
ws.write(12, 1, experiment.datPosition[1])
ws.write(13, 0, 'Îáðàçåö')
ws.write(14, 0, 'Äëèíà, ìì')
ws.write(14, 1, experiment.l0)
ws.write(15, 0, 'Äèàìåòð, ìì')
ws.write(15, 1, experiment.d0)
ws.write(16, 0, 'Óäàðíèê')
ws.write(17, 0, 'Äëèíà, ìì')
ws.write(17, 1, db.getStrickerData(experiment.striker).l)
ws.write(18, 0, 'Ñêîðîñòü, ì/c')
ws.write(18, 1, experiment.V)
ws.write(0, 5, 'Ñèãíàëû ñ ìåðíûõ ñòåðæíåé')
ws.write(0, 6, 'âðåìÿ, ìêñ')
ws.write(0, 7, 'íàãðóæàþùèé ñòåðæåíü, Â')
ws.write(0, 8, 'îïîðíûé ñòåðæåíü, Â')
for i in range(len(experiment.osc['t'])):
ws.write(1+i, 6, experiment.osc['t'][i]*1e6)
ws.write(1+i, 7, experiment.osc['rays'][0][i])
ws.write(1+i, 8, experiment.osc['rays'][1][i])
wb.save(xls_file_name)