-
Notifications
You must be signed in to change notification settings - Fork 0
/
QC2_Fast_Data.py
64 lines (59 loc) · 2.31 KB
/
QC2_Fast_Data.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
#!/usr/bin/env python
from datetime import datetime,date,time
from time import sleep
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
#import serial
import time
import xlrd
from xlrd import xldate
import re
import sys
#import statistics
from xmlConversion import generateXMLHeader, generateDataSet, writeToFile,writeToFile1
from xmlConversion import generateXMLDatafastamb,generateXMLDatafast,generateXMLDatalongamb,generateXMLDatalong, generateXMLData3,generateXMLData3a,generateXMLData4,generateXMLData4a,generateXMLData5a,generateXMLData5,generateXMLData4s
#from flask import Flask, render_template
#from flask_sqlalchemy import SQLAlchemy
#from sqlalchemy import create_engine, MetaData, Table, and_
#from sqlalchemy.sql import select
#import cx_Oracle
#QC2
def xml_from_excel2(excel_file):
wb = xlrd.open_workbook(excel_file)
sh = wb.sheet_by_index(0)
tags = [n.replace(" ", "").lower() for n in sh.row_values(0)]
Start=sys.argv[6]
Stop=sys.argv[7]
#foil=sh.cell(0,1).value
foil=sys.argv[9]
Date=sh.cell(1,1).value
#location=sh.cell(3,1).value
location=sys.argv[3]
#comment=raw_input("Make a Comment:")
comment=sys.argv[5]
Comment=sys.argv[8]
#user=sh.cell(6,1).value
user=sys.argv[4]
Run=sys.argv[2]
humidity = sh.cell(2,1).value
root = generateXMLHeader("FOIL_QC2_FAST_AMB_COND","GEM Foil QC2 Fast Test Condition","CERN MPT GEM Foil QC2 Fast Test Data",Run,Start,Stop,comment,location,user)
dataSet = generateDataSet(root,Comment,"1","GEM Foil",foil)
generateXMLDatafastamb(dataSet,humidity)
writeToFile1(testfile, tostring(root))
root = generateXMLHeader("FOIL_QC2_FAST_TEST","GEM Foil QC2 Fast Test Data","GEM Foil QC2 Fast Test Data",Run,Start,Stop,comment,location,user)
dataSet = generateDataSet(root,Comment,"1","GEM Foil",foil)
for row in range(12,sh.nrows):
time=sh.row_values(row)[0]
volt=sh.row_values(row)[1]
impedence=sh.row_values(row)[2]
current=sh.row_values(row)[3]
sparks=sh.row_values(row)[4]
totalspark=sh.row_values(row)[5]
generateXMLDatafast(dataSet,str(time),str(volt),str(impedence),str(current),str(sparks),str(totalspark))
writeToFile(fileName,tostring(root))
if __name__ =="__main__":
#fname=raw_input("Enter excel data file name:")
fname = sys.argv[1]
#fileName=fname+"_fast"+".xml"
fileName=fname+".xml"
testfile=fname+"_amb"+".xml"
xml_from_excel2(fname)