def xml_from_excel5(excel_file):
	wb = xlrd.open_workbook(excel_file)
	sh = wb.sheet_by_index(0)
	#user = sh.cell(0,1).value
	user = sys.argv[3]
	#chamber=sh.cell(10,1).value
#	chamber=sys.argv[2]
#	Run=sys.argv[3]
	location=sys.argv[2]
	Start=sys.argv[5]
	Stop=sys.argv[6]
	Date=str(Start[0:10])
	comment=sys.argv[4]
	Elog=sys.argv[7]
	File=sys.argv[8]
	Comment=sys.argv[9]
	Run = sh.cell(0,1).value
	root = generateXMLHeader("GEM_VFAT_STRIP_MASKING","GEM VFAT STRIP MASKING", " GEM Chamber",str(Run),str(Start),str(Stop),str(comment),str(location),str(user))
	dataSet = generateDataSet(root,Comment,"1","GEM Chamber","")
	for row in range(2,sh.nrows):
                sector= sh.row_values(row)[0]
                depth= sh.row_values(row)[1]
                position= sh.row_values(row)[2]
                ch= sh.row_values(row)[3]
                hot_ch= sh.row_values(row)[4]
                fit_failed= sh.row_values(row)[5]
                dead_ch= sh.row_values(row)[6]
                high_noise= sh.row_values(row)[7]
                high_eff= sh.row_values(row)[8]
		generateXMLDataStrips(dataSet,str(sector),str(depth),str(position), str(ch), str(hot_ch),str(fit_failed),str(dead_ch),str(high_noise),str(high_eff))
		writeToFile(fileName, tostring(root))
		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=str(ObtainDate("Test Start Time(with Date like 2017-01-16):","%Y-%m-%d %H:%M:%S"))
			#print "Test Start At:" +str(Start)
			Stop=str(ObtainDate("Test End Time:","%Y-%m-%d %H:%M:%S"))
			#print "Test Stop At:" +str(Stop)
			foil=sh.cell(0,1).value
			Date=sh.cell(1,1).value
			location=sh.cell(3,1).value
			#print "Test Done At:"+str(location)
			comment=raw_input("Make a Comment:")
			user=sh.cell(6,1).value
			#print "Test Performed By:"+str(user)
			humidity = sh.cell(2,1).value
			Run=db.engine.execute("select nvl(max(run.RUN_NUMBER), 0) + 1 from cms_gem_core_cond.cond_data_sets dat join cms_gem_core_cond.kinds_of_conditions koc on dat.KIND_OF_CONDITION_ID = koc.KIND_OF_CONDITION_ID join CMS_GEM_CORE_CONSTRUCT.PARTS par on par.PART_ID = dat.PART_ID join CMS_GEM_CORE_COND.COND_RUNS run on dat.COND_RUN_ID = run.COND_RUN_ID where koc.IS_RECORD_DELETED = 'F' and par.IS_RECORD_DELETED = 'F' and koc.name = '' and par.SERIAL_NUMBER = '"+foil+"'")
			Run = [ t for t, in Run ] 
			#print "Number of Time Test Done:" +str(Run)
			root = generateXMLHeader("FOIL_QC2_FAST_AMB_COND","GEM Foil QC2 Fast Test Ambient Condition","CERN MPT GEM Foil QC2 Fast Test Data",str(Run[0]),Start,Stop,comment,location,user)
			dataSet = generateDataSet(root,"GEM Foil QC2 Fast Test Data ","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[0],Start,Stop,comment,location,user)
			dataSet = generateDataSet(root,"GEM Foil QC2 Fast Test Data ","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(times),str(volt),str(impedence),str(current),str(sparks),str(totalsparks))
				writeToFile(fileName,tostring(root))
Esempio n. 3
0
def xml_from_excel5(excel_file):
    wb = xlrd.open_workbook(excel_file)
    sh = wb.sheet_by_index(0)
    #user = sh.cell(0,1).value
    user = sys.argv[3]
    #chamber=sh.cell(10,1).value
    #	chamber=sys.argv[2]
    #	Run=sys.argv[3]
    location = sys.argv[2]
    Start = sys.argv[5]
    Stop = sys.argv[6]
    Date = str(Start[0:10])
    comment = sys.argv[4]
    #Elog=sys.argv[7]
    #File=sys.argv[8]
    #Comment=sys.argv[9]
    Run = sh.cell(0, 1).value
    root = generateXMLHeader("QC8_GEM_STAND_GEOMETRY_CONF",
                             "GEM STAND GEOMETRY CONFIGURATION QC8",
                             "GEOMETRY STAND CONFIGURATION", str(Run),
                             str(Start), str(Stop), str(comment),
                             str(location), str(user))
    dataSet = generateDataSetMultipleParts(root, comment, "1")
    for row in range(2, sh.nrows):
        ch_serial = sh.row_values(row)[0]
        position = sh.row_values(row)[1]
        flowmeter = sh.row_values(row)[2]
        generateXMLDataStandGeoConf(dataSet, str(ch_serial), str(position),
                                    str(flowmeter))
        writeToFile(fileName, tostring(root))
Esempio n. 4
0
def xml_from_excel3(excel_file):
    wb = xlrd.open_workbook(excel_file)
    sh = wb.sheet_by_index(0)
    user = ''
    location = ''
    Start = sh.cell(2, 1).value
    Stop = str(sh.cell(3, 1).value)
    comment = ''
    chamber = sh.cell(1, 1).value
    Run = sh.cell(0, 1).value
    root = generateXMLHeader("QC8_GEM_CH_VFAT_EFFICIENCY",
                             "GEM CH VFAT EFFICIENCY QC8",
                             "GEM CH VFAT EFFICIENCY", str(Run), str(Start),
                             str(Stop), str(comment), str(location), str(user))
    dataSet = generateDataSet(root, comment, "1", "GEM Chamber", str(chamber))
    for row in range(5, sh.nrows):
        vfat_posn = sh.row_values(row)[0]
        efficiency = sh.row_values(row)[1]
        efficiency_error = sh.row_values(row)[2]
        cluster_size_avg = sh.row_values(row)[3]
        cluster_size_sigma = sh.row_values(row)[4]
        percent_masked = sh.row_values(row)[5]
        generateXMLDataChVfatEfficiency(dataSet, str(vfat_posn),
                                        str(efficiency), str(efficiency_error),
                                        str(cluster_size_avg),
                                        str(cluster_size_sigma),
                                        str(percent_masked))
        print(str(row - 4) + " / " + str(sh.nrows - 5))
    fileName = fname[:-5] + "_Run_" + str(Run) + ".xml"
    writeToFile(fileName, tostring(root))
Esempio n. 5
0
def xml_from_csv(csv_file):
    lines = readFile(csv_file)
    for i in range(len(lines)):
        lines[i] = lines[i].split('\n')[0]
    Run = int(lines[0].split(',')[1])
    Start = '2020-03-14 12:00:00'
    Stop = '2020-03-14 12:00:00'
    comment = ''
    location = ''
    user = ''
    root = generateXMLHeader("QC8_GEM_MASKED_STRIPS_HOT",
                             "GEM QC8 MASKED STRIPS HOT", "GEM HOT STRIPS QC8",
                             str(Run), str(Start), str(Stop), str(comment),
                             str(location), str(user))
    dataSet = generateDataSetMultipleParts(root, comment, "1")
    for line in range(2, len(lines)):
        ch_serial_number = str(lines[line].split(',')[0])
        gem_number = str(lines[line].split(',')[1])
        position = str(lines[line].split(',')[2])
        vfat = int(lines[line].split(',')[3])
        channel = int(lines[line].split(',')[4])
        strip = int(lines[line].split(',')[5])
        generateXMLDataQC8DeadStrips(dataSet, str(ch_serial_number),
                                     str(gem_number), str(position), str(vfat),
                                     str(channel), str(strip))
        print(str(line - 1) + " / " + str(len(lines) - 2))
    fileName = csv_file[:-4] + ".xml"
    writeToFile(fileName, tostring(root))
Esempio n. 6
0
def xml_from_excel5(excel_file):
    wb = xlrd.open_workbook(excel_file)
    sh = wb.sheet_by_index(0)
    #user = sh.cell(0,1).value
    user = sys.argv[3]
    #chamber=sh.cell(10,1).value
    #	chamber=sys.argv[2]
    #	Run=sys.argv[3]
    location = sys.argv[2]
    Start = sys.argv[5]
    Stop = sys.argv[6]
    Date = str(Start[0:10])
    comment = sys.argv[4]
    #Elog=sys.argv[7]
    #File=sys.argv[8]
    #Comment=sys.argv[9]
    Run = sh.cell(0, 1).value
    root = generateXMLHeader("QC8_GEM_ALIGNMENT", "GEM ALIGNMENT QC8",
                             "GEM ALIGNMENT", str(Run), str(Start), str(Stop),
                             str(comment), str(location), str(user))
    dataSet = generateDataSetMultipleParts(root, comment, "1")
    for row in range(2, sh.nrows):
        position = sh.row_values(row)[0]
        dx = sh.row_values(row)[1]
        dy = sh.row_values(row)[2]
        dz = sh.row_values(row)[3]
        rx = sh.row_values(row)[4]
        ry = sh.row_values(row)[5]
        rz = sh.row_values(row)[6]
        generateXMLDataAlignment(dataSet, str(position), str(dx), str(dy),
                                 str(dz), str(rx), str(ry), str(rz))
        writeToFile(fileName, tostring(root))
Esempio n. 7
0
def xml_from_excel3(excel_file):

    wb = xlrd.open_workbook(excel_file)
    sh = wb.sheet_by_index(0)
    #user = sh.cell(0,1).value
    user = sys.argv[3]
    #chamber=sh.cell(10,1).value
    #       chamber=sys.argv[2]
    #       Run=sys.argv[3]
    location = sys.argv[2]
    Start = sys.argv[5]
    Stop = sys.argv[6]
    Date = str(Start[0:10])
    comment = sys.argv[4]
    chamber = sys.argv[7]
    #Elog=sys.argv[7]
    #File=sys.argv[8]
    #Comment=sys.argv[9]
    Run = sh.cell(0, 1).value
    root = generateXMLHeader("QC8_GEM_CH_VFAT_EFFICIENCY",
                             "GEM CH VFAT EFFICIENCY QC8",
                             "GEM CH VFAT EFFICIENCY", str(Run), str(Start),
                             str(Stop), str(comment), str(location), str(user))
    dataSet = generateDataSet(root, comment, "1", "GEM Chamber", chamber)
    for row in range(3, sh.nrows):
        vfat_posn = sh.row_values(row)[0]
        efficiency = sh.row_values(row)[1]
        efficiency_error = sh.row_values(row)[2]
        generateXMLDataChVfatEfficiency(dataSet, str(vfat_posn),
                                        str(efficiency), str(efficiency_error))
        writeToFile(fileName, tostring(root))
Esempio n. 8
0
def xml_from_excel5(excel_file):
    wb = xlrd.open_workbook(excel_file)
    sh = wb.sheet_by_index(0)
    user = ''
    location = ''
    Start = ''
    Stop = ''
    comment = ''
    Run = sh.cell(0, 1).value
    root = generateXMLHeader("QC8_GEM_MASKED_STRIPS_DEAD",
                             "GEM QC8 MASKED STRIPS DEAD",
                             "GEM DEAD STRIPS QC8", str(Run), str(Start),
                             str(Stop), str(comment), str(location), str(user))
    dataSet = generateDataSetMultipleParts(root, comment, "1")
    for row in range(2, sh.nrows):
        ch_serial_number = sh.row_values(row)[0]
        gem_number = sh.row_values(row)[1]
        position = sh.row_values(row)[2]
        vfat = sh.row_values(row)[3]
        channel = sh.row_values(row)[4]
        strip = sh.row_values(row)[5]
        generateXMLDataQC8DeadStrips(dataSet, str(ch_serial_number),
                                     str(gem_number), str(position), str(vfat),
                                     str(channel), str(strip))
        print(str(row - 1) + " / " + str(sh.nrows - 2))
    writeToFile(fileName, tostring(root))
Esempio n. 9
0
def xml_from_excel5(excel_file):
	wb = xlrd.open_workbook(excel_file)
	sh = wb.sheet_by_index(0)
	#user = sh.cell(0,1).value
	user = sys.argv[3]
	#chamber=sh.cell(10,1).value
#	chamber=sys.argv[2]
#	Run=sys.argv[3]
	location=sys.argv[2]
	Start=sys.argv[5]
	Stop=sys.argv[6]
	Date=str(Start[0:10])
	comment=sys.argv[4]
	#Elog=sys.argv[7]
	#File=sys.argv[8]
	#Comment=sys.argv[9]
	Run = sh.cell(0,1).value
	root = generateXMLHeader("QC8_GEM_MASKED_STRIPS_HOT","GEM QC8 MASKED STRIPS HOT", "GEM HOT STRIPS QC8",str(Run),str(Start),str(Stop),str(comment),str(location),str(user))
	dataSet = generateDataSetMultipleParts(root,comment,"1")
	for row in range(2,sh.nrows):
		ch_serial_number= sh.row_values(row)[0]
		gem_number= sh.row_values(row)[1]
		position= sh.row_values(row)[2]
		vfat= sh.row_values(row)[3]
		channel= sh.row_values(row)[4]
		strip= sh.row_values(row)[5]
		generateXMLDataQC8DeadStrips(dataSet,str(ch_serial_number),str(gem_number),str(position), str(vfat), str(channel),str(strip))
		writeToFile(fileName,tostring(root))
Esempio n. 10
0
def xml_from_csv(csv_file):
    lines = readFile(csv_file)
    for i in range(len(lines)):
        lines[i] = lines[i].split('\n')[0]
    Run = int(lines[0].split(',')[1])
    Start = '2020-03-14 12:00:00'
    Stop = '2020-03-14 12:00:00'
    comment = ''
    location = ''
    user = ''
    root = generateXMLHeader("QC8_GEM_ALIGNMENT", "GEM ALIGNMENT QC8",
                             "GEM ALIGNMENT", str(Run), str(Start), str(Stop),
                             str(comment), str(location), str(user))
    dataSet = generateDataSetMultipleParts(root, comment, "1")
    for line in range(2, len(lines)):
        position = str(lines[line].split(',')[0])
        dx = float(lines[line].split(',')[1])
        dy = float(lines[line].split(',')[2])
        dz = float(lines[line].split(',')[3])
        rx = float(lines[line].split(',')[4])
        ry = float(lines[line].split(',')[5])
        rz = float(lines[line].split(',')[6])
        generateXMLDataAlignment(dataSet, str(position), str(dx), str(dy),
                                 str(dz), str(rx), str(ry), str(rz))
        print(str(line - 1) + " / " + str(len(lines) - 2))
    fileName = csv_file[:-4] + ".xml"
    writeToFile(fileName, tostring(root))
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))
	def xml_from_excel5(excel_file):
		wb = xlrd.open_workbook(excel_file)
		sh = wb.sheet_by_index(0)
		user = sh.cell(0,1).value
		chamber=sh.cell(10,1).value
		pre = raw_input("Please Enter Preamplifier Name:")
		amp = sh.cell(3,1).value
		coa = sh.cell(4,1).value
		fine = sh.cell(5,1).value
		itime = sh.cell(6,1).value
		dtime = sh.cell(7,1).value
		disc = sh.cell(26,1).value
		thrs = sh.cell(27,1).value
		walk = sh.cell(28,1).value
		width = sh.cell(29,1).value
		scal = sh.cell(39,1).value
		daq = sh.cell(40,1).value
		pico = sh.cell(32,1).value
		tred = sh.cell(33,1).value
		tblack = sh.cell(34,1).value
		tgreen = sh.cell(35,1).value
		source = sh.cell(43,1).value
		hvlt = sh.cell(44,1).value
		current = sh.cell(45,1).value
		nbpri = "346"
		eta = sh.cell(11,1).value
		gas = sh.cell(12,1).value
		gfac = sh.cell(13,1).value
		flow = sh.cell(14,1).value
		req = sh.cell(15,1).value
		divi = sh.cell(16,1).value
		root = generateXMLHeader("QC5_GAIN_STBLTY_CONFIG","GEM Chamber QC5 Gain Stability","CERN Station A GEM Chamber QC5 Gain Stability",Run,Start,Stop,comment,location,user)
		dataSet = generateDataSet(root,"GEM Chamber QC5 Gain Stability Config","1","GEM Chamber",chamber)
		generateXMLData5a(dataSet,str(user),pre,str(amp),str(coa), str(fine), str(itime),str(dtime),str(disc),str(thrs),str(walk),str(width),str(scal),str(daq),str(pico),str(tred),str(tblack),str(tgreen),str(source),str(hvlt),str(current),str(nbpri),str(eta),str(gas),str(gfac),str(flow),str(req),str(divi))
		writeToFile(fileName, tostring(root))
	
		root = generateXMLHeader("QC5_GAIN_STBLTY_DATA","GEM Chamber QC5 Gain Stability Data","CERN Station A GEM Chamber QC5 Gain Stability",Run,Start,Stop,comment,location,user)
		dataSet = generateDataSet(root,"GEM Chamber QC5 Gain Stability Data","1","GEM Chamber",chamber)
		for row in range(6,sh.nrows):
			if row ==33:
				break
			test_time=str(Start[0:10])
			humidity=raw_input("Please write Humidity Value:")
			vmon= sh.row_values(row)[5]
			imon= sh.row_values(row)[6]
			time= sh.row_values(row)[21]
			pressure= sh.row_values(row)[22]
			temp= sh.row_values(row)[23]
			s_count= sh.row_values(row)[24]
			s_error= sh.row_values(row)[25]
			off_count= sh.row_values(row)[26]
			off_error= sh.row_values(row)[27]
			s_current= sh.row_values(row)[28]
			s_current_error= sh.row_values(row)[29]
			off_current= sh.row_values(row)[30]
			off_current_error= sh.row_values(row)[31]
			generateXMLData5(dataSet,str(test_time),str(temp),str(pressure),str(humidity), str(imon), str(vmon),str(s_count),str(s_error),str(off_count),str(off_error),str(s_current),str(s_current_error),str(off_current))
			writeToFile(datafile, tostring(root))
def xml_from_excel3(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]+ " " + sys.argv[7]
	#Stop=sys.argv[8]+ " " + sys.argv[9]
	Start=sys.argv[6]
	Stop=sys.argv[7]
	#chamber=sh.cell(2,7).value
	chamber=sys.argv[11]
	Date=str(Start[0:10])
	location = sys.argv[3]
	user=sys.argv[4]
	comment = sys.argv[5]
	Comments=sys.argv[10]
	Run =sys.argv[2]
	
	root = generateXMLHeader("QC3_GAS_LEAK_DATA","GEM Chamber QC3 Gas Leak Data",str(location) + " GEM QC3 Gas Leak Data",Run,Start,Stop,comment,location,user)
	dataSet = generateDataSet(root,Comments,"1","GEM Chamber",chamber)	
	for row in range(1,sh.nrows):
			seconds= sh.row_values(row)[1]
			pre= sh.row_values(row)[2]
			temp =sh.row_values(row)[3]
			ambp= sh.row_values(row)[4]
			increment_hr= sh.row_values(row)[5]
			temp_k = sh.row_values(row)[6]	
			times = xlrd.xldate_as_tuple(sh.row_values(row)[0], wb.datemode)
			times=str(times).replace(",",":")
			times = str(times).replace(")","")
			times = str(times).replace("("," ")
			generateXMLData3(dataSet,Date +str(times[9:]),str(seconds),str(pre), str(ambp), str(temp), str(increment_hr), str(temp_k))
			writeToFile(fileName, tostring(root))
	#test_date=sh.cell(0,7).value
	test_date=Start
	avgtemp=sh.cell(32,10).value
	stdtemp=sh.cell(32,11).value
	avgpre=sh.cell(33,10).value
	stdpre=sh.cell(33,11).value
	initpre = sh.cell(34,10).value
	finalpre = sh.cell(35,10).value
	duration = sh.cell(36,10).value
	leakrate = sh.cell(37,10).value
	expofitp0=sh.cell(38,10).value 
	expofitp1=sh.cell(39,10).value 
	time_constant=sh.cell(40,10).value
	elog=sys.argv[8]
	File=sys.argv[9]
	#Comments=sys.argv[10]
	root = generateXMLHeader("QC3_GAS_LEAK_DATA_SUMRY","GEM Chamber QC3 Gas Leak Data Summary",str(location) + " GEM QC3 Gas Leak Data",Run,Start,Stop,comment, location,user)
	dataSet = generateDataSet(root,Comments,"1","GEM Chamber",chamber)
	generateXMLData3a(dataSet, str(test_date) ,str(avgtemp),str(stdtemp),str(avgpre),str(stdpre),str(initpre),str(finalpre),str(duration),str(leakrate),str(expofitp0),str(expofitp1),str(elog),str(File),str(Comments),str(time_constant))
	writeToFile1(testfile, tostring(root))
		def xml_from_excel3(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=str(ObtainDate("Test Start Time(with Date like 2017-01-16):","%Y-%m-%d %H:%M:%S"))
			#print "Test Start At:" +str(Start)
			Stop=str(ObtainDate("Test End Time:","%Y-%m-%d %H:%M:%S"))
			#print "Test End At:" + str(Stop)
			chamber=sh.cell(2,7).value
			#print "Chamber is selected:" +str(chamber)
			#Date=sh.cell(0,7).value
			Date=str(Start[0:10])
			##print Date
			location=raw_input("Enter Location:")
			#print "Test Done At:"+str(location)
			user=sh.cell(1,7).value
			#print "Test Done By:" +str(user)
			comment=raw_input("Make a Comment:")
			#print "Here what you Comment:" +str(comment)
			root = generateXMLHeader("QC3_GAS_LEAK_DATA","GEM Chamber QC3 Gas Leak Data","CERN Station A GEM Chamber QC3 Gas Leak Data",Run,Start,Stop,comment,location,user)	
			dataSet = generateDataSet(root,"GEM Chamber QC3 Gas Leak Calib Data","1","GEM Chamber",chamber)	
			for row in range(1,sh.nrows):
					seconds= sh.row_values(row)[1]
					pre= sh.row_values(row)[2]
					temp =sh.row_values(row)[3]
					ambp= sh.row_values(row)[4]
					times = xlrd.xldate_as_tuple(sh.row_values(row)[0], wb.datemode)
					times=str(times).replace(",",":")
					times = str(times).replace(")","")
					times = str(times).replace("("," ")
					generateXMLData3(dataSet,Date +str(times)[9:],str(seconds),str(pre), str(ambp), str(temp))
					writeToFile(fileName, tostring(root))
			test_date=sh.cell(0,7).value
			avgtemp=sh.cell(32,7).value
			stdtemp=sh.cell(32,8).value
			avgpre=sh.cell(33,7).value
			stdpre=sh.cell(33,8).value
			initpre = sh.cell(34,7).value
			finalpre = sh.cell(35,7).value
			duration = sh.cell(36,7).value
			leakrate = sh.cell(37,7).value
			expofitp0=sh.cell(38,7).value 
			expofitp1=sh.cell(39,7).value 
			expofitR2=sh.cell(40,7).value
			elog=raw_input("Please Enter the ELOG LINK:")
			File=raw_input("Please Enter the File Name:")
			Comments=raw_input("Make a summary Comment:")
			root = generateXMLHeader("QC3_GAS_LEAK_DATA_SUMMARY","GEM Chamber QC3 Gas Leak Data Summary ","CERN Station A GEM Chamber QC3 Gas Leak Data Summary",Run,Start,Stop,comment, location,user)
			dataSet = generateDataSet(root,"GEM Chamber QC3 Gas Leak Data Summary","1","GEM Chamber",chamber)
			generateXMLData3a(dataSet, str(test_date) ,str(avgtemp),str(stdtemp),str(avgpre),str(stdpre),str(initpre),str(finalpre),str(duration),str(leakrate),str(expofitp0),str(expofitp1),str(expofitR2),str(elog),str(File),str(Comments))
			writeToFile1(datafile, tostring(root))
Esempio n. 15
0
def xml_data_generation(excel_file):
    chamber = sys.argv[2]
    qc_test = sys.argv[3]
    qc_result = sys.argv[4]
    elog_link = sys.argv[5]
    comment = sys.argv[6]

    root = generateXMLHeader("QC_RESULT", "GEM Chamber QC Result",
                             "GEM Chamber QC Result", "", "", "", comment, "",
                             "")
    dataSet = generateDataSet(root, comment, "1", "GEM Chamber", chamber)
    generateXMLDataQCResult(dataSet, str(qc_test), str(qc_result),
                            str(elog_link), str(comment))
    writeToFile(fileName, tostring(root))
Esempio n. 16
0
def xml_from_excel3(excel_file):
    wb = xlrd.open_workbook(excel_file)
    sh = wb.sheet_by_index(0)
    user = ''
    location = ''
    Start = ''
    Stop = ''
    comment = ''
    chamber = sh.cell(1,1).value
    overall_efficiency = sh.cell(2,1).value
    error_efficiency = sh.cell(3,1).value
    Run = sh.cell(0,1).value
    root = generateXMLHeader("QC8_GEM_QUICK_EFFICIENCY","GEM QUICK EFFICIENCY QC8","GEM QUICK EFFICIENCY",str(Run),str(Start),str(Stop),str(comment),str(location),str(user))
    dataSet = generateDataSet(root,comment,"1","GEM Chamber",str(chamber))
    generateXMLDataQuickEfficiencyQC8(dataSet,str(overall_efficiency),str(error_efficiency))
    fileName=fname[:-5]+"_Run_"+str(Run)+".xml"
    writeToFile(fileName, tostring(root))
Esempio n. 17
0
def xml_from_csv(csv_file):
  lines = readFile(csv_file)
  for i in range(len(lines)):
    lines[i] = lines[i].split('\n')[0]
  Run = int(lines[0].split(',')[1])
  chamber = str(lines[1].split(',')[1])
  overall_efficiency = float(lines[2].split(',')[1])
  error_efficiency = float(lines[3].split(',')[1])
  Start = '2020-03-14 12:00:00'
  Stop = '2020-03-14 12:00:00'
  comment = ''
  location = ''
  user = ''
  root = generateXMLHeader("QC8_GEM_QUICK_EFFICIENCY","GEM QUICK EFFICIENCY QC8","GEM QUICK EFFICIENCY",str(Run),str(Start),str(Stop),str(comment),str(location),str(user))
  dataSet = generateDataSet(root,comment,"1","GEM Chamber",str(chamber))
  generateXMLDataQuickEfficiencyQC8(dataSet,str(overall_efficiency),str(error_efficiency))
  fileName = csv_file[:-4] + "_Run_" + str(Run) + ".xml"
  writeToFile(fileName, tostring(root))
Esempio n. 18
0
def xml_from_excel3(excel_file):
	wb = xlrd.open_workbook(excel_file)
	sh = wb.sheet_by_index(0)
	user = sys.argv[3]
        #chamber=sh.cell(10,1).value
#       chamber=sys.argv[2]
#       Run=sys.argv[3]
	location=sys.argv[2]
	Start=sys.argv[5]
	Stop=sys.argv[6]
	#Date=str(Start[0:10])
	comment=sys.argv[4]
	chamber = sh.cell(1,1).value#sys.argv[7]
	overall_efficiency = sh.cell(2,1).value
        error_efficiency = sh.cell(3,1).value
	Run = sh.cell(0,1).value
	root = generateXMLHeader("QC8_GEM_QUICK_EFFICIENCY","GEM QUICK EFFICIENCY QC8","GEM QUICK EFFICIENCY",str(Run),str(Start),str(Stop),str(comment),str(location),str(user))
	dataSet = generateDataSet(root,comment,"1","GEM Chamber",str(chamber))	
	generateXMLDataQuickEfficiencyQC8(dataSet,str(overall_efficiency),str(error_efficiency))
	writeToFile(fileName, tostring(root))
	def xml_from_excel4(excel_file):
		wb = xlrd.open_workbook(excel_file)
		sh = wb.sheet_by_index(0)
		req = sh.cell(1,16).value
		pre = sh.cell(5,16).value
		amp = sh.cell(8,16).value
		coa = sh.cell(9,16).value
		fine = sh.cell(10,16).value
		itime = sh.cell(12,16).value
		dtime = sh.cell(13,16).value
		disc = sh.cell(16,16).value
		thrs = sh.cell(17,16).value
		scal = sh.cell(20,16).value
		daq = sh.cell(21,16).value
		Start=str(ObtainDate("Test Start Time(with Date like 2017-01-16):","%Y-%m-%d %H:%M:%S"))
		Stop=str(ObtainDate("Test End Time:","%Y-%m-%d %H:%M:%S"))
		chamber=raw_input("Please Enter a Chamber Name:")
		Date=str(Start[0:10])
		location=raw_input("Enter Location:")
		user=sh.cell(1,7).value
		comment=raw_input("Make a Comment:")
		Run=db.engine.execute("select nvl(max(run.RUN_NUMBER), 0) + 1 from cms_gem_core_cond.cond_data_sets dat join cms_gem_core_cond.kinds_of_conditions koc on dat.KIND_OF_CONDITION_ID = koc.KIND_OF_CONDITION_ID join CMS_GEM_CORE_CONSTRUCT.PARTS par on par.PART_ID = dat.PART_ID join CMS_GEM_CORE_COND.COND_RUNS run on dat.COND_RUN_ID = run.COND_RUN_ID where koc.IS_RECORD_DELETED = 'F' and par.IS_RECORD_DELETED = 'F' and koc.name = '' and par.SERIAL_NUMBER = '"+chamber+"'")
		Run = [ t for t, in Run ]
		root = generateXMLHeader("QC4_HVTEST_CONFIG","GEM Chamber QC4 HV TEST Configuration","CERN Station A GEM QC4 HV Test",Run,Start,Stop,comment,location,user)
		dataSet = generateDataSet(root,"GEM Chamber QC4 HV TEST Configuration","1","GEM Chamber",chamber)
		generateXMLData4a(dataSet,str(req), str(pre),str(amp),str(coa), str(fine), str(itime),str(dtime),str(disc),str(thrs),str(scal),str(daq))
		writeToFile(fileName, tostring(root))
		root = generateXMLHeader("QC4_HVTEST_DATA","GEM Chamber QC4 HVTEST Data","CERN Station A GEM QC4 HV Test",Run,Start,Stop,comment,location,user)
		dataSet = generateDataSet(root,"GEM Chamber QC4 HVTEST Data","1","GEM Chamber",chamber)
		for row in range(3, sh.nrows):
			if row == 37:
				break
			vset = sh.row_values(row)[0]
			vmon= sh.row_values(row)[1]
			iset =sh.row_values(row)[2]
			imon= sh.row_values(row)[3]
			rcal =sh.row_values(row)[4]
			rnorm=sh.row_values(row)[5]
			count=sh.row_values(row)[6]
			rate= sh.row_values(row)[7]
			error=sh.row_values(row)[8]
			generateXMLData4(dataSet,str(vset), str(vmon),str(iset),str(imon), str(rcal), str(rnorm),str(count),str(rate),str(error))
			writeToFile(datafile, tostring(root))
		
		v_max = sh.cell(25,16).value
		test_date=str(Start[0:10])
		v_drift = sh.cell(26,16).value
		i_max = sh.cell(27,16).value
		r_euq = sh.cell(28,16).value
		r_err= sh.cell(29,16).value
		r_diff = sh.cell(30,16).value
		spr_signal = sh.cell(31,16).value
		spr_error = sh.cell(32,16).value
		Filename= raw_input("Please Enter the FileName:")
		Elog=raw_input("Please Enter the Elog Link:")
		Comment=raw_input("Write a Summary Comment:")
		root = generateXMLHeader("QC4_HVTEST_SUMMARY","GEM Chamber QC4 HVTEST Summary","CERN Station A GEM QC4 HV Test Summary",Run,Start,Stop,Comment,location,user)
		dataSet = generateDataSet(root,"GEM Chamber QC4 HVTEST Summary","1","GEM Chamber",chamber)
		generateXMLData4s(dataSet,str(test_time),str(v_max),str(i_max),str(v_drift),str(r_euq), str(r_err), str(r_diff),str(spr_signal),str(Filename),str(Elog),str(Comment))
		writeToFile(testfile, tostring(root))
Esempio n. 20
0
def xml_from_excel3(excel_file):
    wb = xlrd.open_workbook(excel_file)
    sh = wb.sheet_by_index(0)
    user = ''  #sys.argv[3]
    #chamber=sh.cell(10,1).value
    #       chamber=sys.argv[2]
    #       Run=sys.argv[3]
    location = ''  #sys.argv[2]
    Startdate = sh.cell(2, 1).value  #sys.argv[5]
    Stopdate = sh.cell(3, 1).value  #sys.argv[6]
    Start = datetime.datetime(*xlrd.xldate_as_tuple(Startdate, wb.datemode))
    Stop = datetime.datetime(*xlrd.xldate_as_tuple(Stopdate, wb.datemode))
    #Date=str(Start[0:10])
    comment = ''  #sys.argv[4]
    chamber = sh.cell(1, 1).value  #sys.argv[7]
    #Elog=sys.argv[7]
    #File=sys.argv[8]
    #Comment=sys.argv[9]
    Run = sh.cell(0, 1).value
    root = generateXMLHeader("QC8_GEM_CH_VFAT_EFFICIENCY",
                             "GEM CH VFAT EFFICIENCY QC8",
                             "GEM CH VFAT EFFICIENCY", str(Run), str(Start),
                             str(Stop), str(comment), str(location), str(user))
    dataSet = generateDataSet(root, comment, "1", "GEM Chamber", str(chamber))
    for row in range(5, sh.nrows):
        vfat_posn = sh.row_values(row)[0]
        efficiency = sh.row_values(row)[1]
        efficiency_error = sh.row_values(row)[2]
        cluster_size_avg = sh.row_values(row)[3]
        cluster_size_sigma = sh.row_values(row)[4]
        percent_masked = sh.row_values(row)[5]
        generateXMLDataChVfatEfficiency(dataSet, str(vfat_posn),
                                        str(efficiency), str(efficiency_error),
                                        str(cluster_size_avg),
                                        str(cluster_size_sigma),
                                        str(percent_masked))
        writeToFile(fileName, tostring(root))
def xml_from_excellong(excel_file):
    Start = str(
        ObtainDate("Test Start Time(with Date like 2017-01-16):",
                   "%Y-%m-%d %H:%M:%S"))
    Stop = str(ObtainDate("Test End Time:", "%Y-%m-%d %H:%M:%S"))
    comment = raw_input("Comment:")
    location = raw_input("Location:")
    user = raw_input("User:"******"Please Enter Chamber Name:")
    Run = db.engine.execute(
        "select nvl(max(run.RUN_NUMBER), 0) + 1 from cms_gem_core_cond.cond_data_sets dat join cms_gem_core_cond.kinds_of_conditions koc on dat.KIND_OF_CONDITION_ID = koc.KIND_OF_CONDITION_ID join CMS_GEM_CORE_CONSTRUCT.PARTS par on par.PART_ID = dat.PART_ID join CMS_GEM_CORE_COND.COND_RUNS run on dat.COND_RUN_ID = run.COND_RUN_ID where koc.IS_RECORD_DELETED = 'F' and par.IS_RECORD_DELETED = 'F' and koc.name = '' and par.SERIAL_NUMBER = '"
        + foil + "'")
    Run = [t for t, in Run]
    root = generateXMLHeader("FOIL_QC2_LONG_AMB_COND",
                             "GEM QC2 Long Foil Test Conditions Data",
                             "CERN GEM Foil QC2 Long Test Batch 7",
                             str(Run[0]), Start, Stop, comment, location, user)
    dataSet = generateDataSet(root, "GEM Foil QC2 Long Test COnditions", "1",
                              "GEM Foil", foil)
    relhumi = raw_input("Enter the Humidity:")
    tempreature = raw_input("Enter tempreature")
    lines = excel_file
    for line in lines:
        #print line
        if line[0] == "#":
            continue
        else:
            inner_list = [elt.strip() for elt in line.split('\t')]
        root = generateXMLHeader("FOIL_QC2_LONG_TEST",
                                 "GEM Foil QC2 Long Test Data",
                                 "GEM Foil QC2 Long Test Data", str(Run[0]),
                                 Start, Stop, comment, location, user)
        dataSet = generateDataSet(root, "GEM Foil QC2 Long Test Data ", "1",
                                  "GEM Foil", foil)
        generateXMLDatafast(dataSet, [0], inner_list[1], inner_list[2],
                            inner_list[3], inner_list[4], inner_list[5])
        writeToFile(fileName, tostring(root))
def xml_from_csv(csv_file):
  lines = readFile(csv_file)
  for i in range(len(lines)):
    lines[i] = lines[i].split('\n')[0]
  Run = int(lines[0].split(',')[1])
  chamber = str(lines[1].split(',')[1])
  Start = str(lines[2].split(',')[1])
  Stop = str(lines[3].split(',')[1])
  user = ''
  location = ''
  comment = ''
  root = generateXMLHeader("QC8_GEM_CH_VFAT_EFFICIENCY","GEM CH VFAT EFFICIENCY QC8","GEM CH VFAT EFFICIENCY",str(Run),str(Start),str(Stop),str(comment),str(location),str(user))
  dataSet = generateDataSet(root,comment,"1","GEM Chamber",str(chamber))
  for line in range(5,len(lines)):
    vfat_posn = int(lines[line].split(',')[0])
    efficiency = float(lines[line].split(',')[1])
    efficiency_error = float(lines[line].split(',')[2])
    cluster_size_avg = float(lines[line].split(',')[3])
    cluster_size_sigma = float(lines[line].split(',')[4])
    percent_masked = float(lines[line].split(',')[5])
    generateXMLDataChVfatEfficiency(dataSet,str(vfat_posn),str(efficiency), str(efficiency_error),str(cluster_size_avg),str(cluster_size_sigma), str(percent_masked))
    print(str(line-4)+" / "+str(len(lines)-5))
    fileName = csv_file[:-4] + "_Run_" + str(Run) + ".xml"
    writeToFile(fileName, tostring(root))
	def xml_from_excel4(excel_file):
		wb = xlrd.open_workbook(excel_file)
		sh = wb.sheet_by_index(0)
		req = sh.cell(1,16).value
		pre = sh.cell(5,16).value
		amp = sh.cell(8,16).value
		coa = sh.cell(9,16).value
		fine = sh.cell(10,16).value
		itime = sh.cell(12,16).value
		dtime = sh.cell(13,16).value
		disc = sh.cell(16,16).value
		thrs = sh.cell(17,16).value
		scal = sh.cell(20,16).value
		daq = sh.cell(21,16).value
		root = generateXMLHeader("QC6_HVTEST_CONFIG","GEM Chamber QC6 HV TEST Configuration","CERN Station A GEM QC6 HV Test",Run,Start,Stop,comment,location,user)
		dataSet = generateDataSet(root,"GEM Chamber QC6 HV TEST Configuration","1","GEM Chamber",chamber)
		generateXMLData4a(dataSet,str(req), str(pre),str(amp),str(coa), str(fine), str(itime),str(dtime),str(disc),str(thrs),str(scal),str(daq))
		writeToFile(fileName, tostring(root))
		root = generateXMLHeader("QC6_HVTEST_DATA","GEM Chamber QC6 HVTEST Data","CERN Station A GEM QC6 HV Test",Run,Start,Stop,comment,location,user)
		dataSet = generateDataSet(root,"GEM Chamber QC6 HVTEST Data","1","GEM Chamber",chamber)
		for row in range(3, sh.nrows):
			if row == 37:
				break
			vset = sh.row_values(row)[0]
			vmon= sh.row_values(row)[1]
			iset =sh.row_values(row)[2]
			imon= sh.row_values(row)[3]
			rcal =sh.row_values(row)[4]
			rnorm=sh.row_values(row)[5]
			count=sh.row_values(row)[6]
			rate= sh.row_values(row)[7]
			error=sh.row_values(row)[8]
			generateXMLData4(dataSet,str(vset), str(vmon),str(iset),str(imon), str(rcal), str(rnorm),str(count),str(rate),str(error))
			writeToFile(datafile, tostring(root))
		
		v_max = sh.cell(25,16).value
		test_time="2016-11-07"
		v_drift = sh.cell(26,16).value
		i_max = sh.cell(27,16).value
		r_euq = sh.cell(28,16).value
		r_err= sh.cell(29,16).value
		r_diff = sh.cell(30,16).value
		spr_signal = sh.cell(31,16).value
		spr_error = sh.cell(32,16).value
		Filename= raw_input("Please Enter the FileName:")
		Elog=raw_input("Please Enter the Elog Link:")
		Comment=raw_input("Please Enter the comment:")
		root = generateXMLHeader("QC6_HVTEST_DATA_SUMMARY","GEM Chamber QC6 HVTEST Data Summary","CERN Station A GEM QC6 HV Test Summary",Run,Start,Stop,comment,location,user)
		dataSet = generateDataSet(root,"GEM Chamber QC6 HVTEST Data Summary","1","GEM Chamber",chamber)
		generateXMLData4s(dataSet,str(test_time),str(v_max),str(i_max),str(v_drift),str(r_euq), str(r_err), str(r_diff),str(spr_signal),str(Filename),str(Elog),str(Comment))
		writeToFile(testfile, tostring(root))
def xml_from_excel4(excel_file):
	wb = xlrd.open_workbook(excel_file)
	sh = wb.sheet_by_index(0)
	req = sh.cell(1,16).value
	pre = sh.cell(5,16).value
	amp = sh.cell(8,16).value
	coa = sh.cell(9,16).value
	fine = sh.cell(10,16).value
	itime = sh.cell(12,16).value
	dtime = sh.cell(13,16).value
	disc = sh.cell(16,16).value
	thrs = sh.cell(17,16).value
	scal = sh.cell(20,16).value
	daq = sh.cell(21,16).value
	Start=sys.argv[7]
	Stop=sys.argv[8]
	chamber=sys.argv[2]
	Date=str(Start[0:10])
	location=sys.argv[4]
	#user=sh.cell(1,7).value
	user=sys.argv[5]
	comment=sys.argv[6]
	Comment=sys.argv[11]
	Run=sys.argv[3]
	root = generateXMLHeader("QC4_HVTEST_CONFIG","GEM Chamber QC4 HVTEST Configuration",str(location) + " GEM QC4 HV Test",Run,Start,Stop,comment,location,user)
	dataSet = generateDataSet(root,Comment,"1","GEM Chamber",chamber)
	generateXMLData4a(dataSet,str(req), str(pre),str(amp),str(coa), str(fine), str(itime),str(dtime),str(disc),str(thrs),str(scal),str(daq))
	writeToFile(fileName, tostring(root))
	root = generateXMLHeader("QC4_HVTEST_DATA","GEM Chamber QC4 HVTEST Data",str(location) + " GEM QC4 HV Test",Run,Start,Stop,comment,location,user)
	dataSet = generateDataSet(root,Comment,"1","GEM Chamber",chamber)
	for row in range(3, sh.nrows):
		if sh.row_values(row)[0]=='':
			break
		vset = sh.row_values(row)[0]
		vmon= sh.row_values(row)[1]
		iset =sh.row_values(row)[2]
		imon= sh.row_values(row)[3]
		rcal =sh.row_values(row)[4]
		rnorm=sh.row_values(row)[5]
		count=sh.row_values(row)[6]
		rate= sh.row_values(row)[7]
		error=sh.row_values(row)[8]
		generateXMLData4(dataSet,str(vset), str(vmon),str(iset),str(imon), str(rcal), str(rnorm),str(count),str(rate),str(error))
		writeToFile(datafile, tostring(root))
		
	v_max = sh.cell(25,16).value
	test_date=Start
	v_drift = sh.cell(26,16).value
	i_max = sh.cell(27,16).value
	r_euq = sh.cell(28,16).value
	r_err= sh.cell(29,16).value
	r_diff = sh.cell(30,16).value
	spr_signal = sh.cell(31,16).value
	spr_error = sh.cell(32,16).value
	Filename= sys.argv[10]
	Elog=sys.argv[9]
	#Comment=sys.argv[11]
	root = generateXMLHeader("QC4_HVTEST_SUMRY","GEM Chamber QC4 HVTEST Summary",str(location) + " GEM QC4 HV Test",Run,Start,Stop,comment,location,user)
	dataSet = generateDataSet(root,Comment,"1","GEM Chamber",chamber)
	generateXMLData4s(dataSet,test_date,str(v_max),str(i_max),str(v_drift),str(r_euq), str(r_err), str(r_diff),str(spr_signal),str(Filename),str(Elog),str(Comment),str(spr_error))
	writeToFile(testfile, tostring(root))
Esempio n. 25
0
def xml_from_excel5(excel_file):
    #wb = xlrd.open_workbook(excel_file)
    #sh = wb.sheet_by_index(0)
    user = sys.argv[3]
    location = sys.argv[2]
    Start = sys.argv[5]
    Stop = sys.argv[6]
    Run = sys.argv[7]
    ch1 = sys.argv[8]
    ch2 = sys.argv[9]
    ch3 = sys.argv[10]
    ch4 = sys.argv[11]
    ch5 = sys.argv[12]
    ch6 = sys.argv[13]
    ch7 = sys.argv[14]
    ch8 = sys.argv[15]
    ch9 = sys.argv[16]
    ch10 = sys.argv[17]
    ch11 = sys.argv[18]
    ch12 = sys.argv[19]
    ch13 = sys.argv[20]
    ch14 = sys.argv[21]
    ch15 = sys.argv[22]
    ch16 = sys.argv[23]
    ch17 = sys.argv[24]
    ch18 = sys.argv[25]
    ch19 = sys.argv[26]
    ch20 = sys.argv[27]
    ch21 = sys.argv[28]
    ch22 = sys.argv[29]
    ch23 = sys.argv[30]
    ch24 = sys.argv[31]
    ch25 = sys.argv[32]
    ch26 = sys.argv[33]
    ch27 = sys.argv[34]
    ch28 = sys.argv[35]
    ch29 = sys.argv[36]
    ch30 = sys.argv[37]

    flip2 = sys.argv[38]
    flip4 = sys.argv[39]
    flip6 = sys.argv[40]
    flip8 = sys.argv[41]
    flip10 = sys.argv[42]
    flip12 = sys.argv[43]
    flip14 = sys.argv[44]
    flip16 = sys.argv[45]
    flip18 = sys.argv[46]
    flip20 = sys.argv[47]
    flip22 = sys.argv[48]
    flip24 = sys.argv[49]
    flip26 = sys.argv[50]
    flip28 = sys.argv[51]
    flip30 = sys.argv[52]

    flow2 = sys.argv[53]
    flow4 = sys.argv[54]
    flow6 = sys.argv[55]
    flow8 = sys.argv[56]
    flow10 = sys.argv[57]
    flow12 = sys.argv[58]
    flow14 = sys.argv[59]
    flow16 = sys.argv[60]
    flow18 = sys.argv[61]
    flow20 = sys.argv[62]
    flow22 = sys.argv[63]
    flow24 = sys.argv[64]
    flow26 = sys.argv[65]
    flow28 = sys.argv[66]
    flow30 = sys.argv[67]
    comment = sys.argv[4]
    #type = "S"
    chamberCheck = "select"

    root = generateXMLHeader("QC8_GEM_STAND_GEOMETRY_CONF",
                             "GEM STAND GEOMETRY CONFIGURATION QC8",
                             "GEOMETRY STAND CONFIGURATION", str(Run),
                             str(Start), str(Stop), str(comment),
                             str(location), str(user))
    dataSet = generateDataSetMultipleParts(root, comment, "1")
    if chamberCheck != str(ch1):
        type = "L" if "-L" in str(ch1) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch1), '1/1/B', str(flow2),
                                    '11201', type, str(flip2), '2', '2')
    if chamberCheck != str(ch2):
        type = "L" if "-L" in str(ch2) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch2), '1/1/T', str(flow2),
                                    '11101', type, str(flip2), '2', '3')
    if chamberCheck != str(ch3):
        type = "L" if "-L" in str(ch3) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch3), '2/1/B', str(flow4),
                                    '11203', type, str(flip4), '2', '4')
    if chamberCheck != str(ch4):
        type = "L" if "-L" in str(ch4) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch4), '2/1/T', str(flow4),
                                    '11103', type, str(flip4), '2', '5')
    if chamberCheck != str(ch5):
        type = "L" if "-L" in str(ch5) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch5), '3/1/B', str(flow6),
                                    '11205', type, str(flip6), '2', '6')
    if chamberCheck != str(ch6):
        type = "L" if "-L" in str(ch6) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch6), '3/1/T', str(flow6),
                                    '11105', type, str(flip6), '2', '7')
    if chamberCheck != str(ch7):
        type = "L" if "-L" in str(ch7) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch7), '4/1/B', str(flow8),
                                    '11207', type, str(flip8), '2', '8')
    if chamberCheck != str(ch8):
        type = "L" if "-L" in str(ch8) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch8), '4/1/T', str(flow8),
                                    '11107', type, str(flip8), '2', '9')
    if chamberCheck != str(ch9):
        type = "L" if "-L" in str(ch9) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch9), '5/1/B', str(flow10),
                                    '11209', type, str(flip10), '2', '10')
    if chamberCheck != str(ch10):
        type = "L" if "-L" in str(ch10) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch10), '5/1/T', str(flow10),
                                    '11109', type, str(flip10), '2', '11')
    if chamberCheck != str(ch11):
        type = "L" if "-L" in str(ch11) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch11), '1/2/B', str(flow12),
                                    '11211', type, str(flip12), '4', '2')
    if chamberCheck != str(ch12):
        type = "L" if "-L" in str(ch12) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch12), '1/2/T', str(flow12),
                                    '11111', type, str(flip12), '4', '3')
    if chamberCheck != str(ch13):
        type = "L" if "-L" in str(ch13) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch13), '2/2/B', str(flow14),
                                    '11213', type, str(flip14), '4', '4')
    if chamberCheck != str(ch14):
        type = "L" if "-L" in str(ch14) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch14), '2/2/T', str(flow14),
                                    '11113', type, str(flip14), '4', '5')
    if chamberCheck != str(ch15):
        type = "L" if "-L" in str(ch15) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch15), '3/2/B', str(flow16),
                                    '11215', type, str(flip16), '4', '6')
    if chamberCheck != str(ch16):
        type = "L" if "-L" in str(ch16) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch16), '3/2/T', str(flow16),
                                    '11115', type, str(flip16), '4', '7')
    if chamberCheck != str(ch17):
        type = "L" if "-L" in str(ch17) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch17), '4/2/B', str(flow18),
                                    '11217', type, str(flip18), '4', '8')
    if chamberCheck != str(ch18):
        type = "L" if "-L" in str(ch18) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch18), '4/2/T', str(flow18),
                                    '11117', type, str(flip18), '4', '9')
    if chamberCheck != str(ch19):
        type = "L" if "-L" in str(ch19) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch19), '5/2/B', str(flow20),
                                    '11219', type, str(flip20), '4', '10')
    if chamberCheck != str(ch20):
        type = "L" if "-L" in str(ch20) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch20), '5/2/T', str(flow20),
                                    '11119', type, str(flip20), '4', '11')
    if chamberCheck != str(ch21):
        type = "L" if "-L" in str(ch21) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch21), '1/3/B', str(flow22),
                                    '11221', type, str(flip22), '6', '2')
    if chamberCheck != str(ch22):
        type = "L" if "-L" in str(ch22) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch22), '1/3/T', str(flow22),
                                    '11121', type, str(flip22), '6', '3')
    if chamberCheck != str(ch23):
        type = "L" if "-L" in str(ch23) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch23), '2/3/B', str(flow24),
                                    '11223', type, str(flip24), '6', '4')
    if chamberCheck != str(ch24):
        type = "L" if "-L" in str(ch24) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch24), '2/3/T', str(flow24),
                                    '11123', type, str(flip24), '6', '5')
    if chamberCheck != str(ch25):
        type = "L" if "-L" in str(ch25) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch25), '3/3/B', str(flow26),
                                    '11225', type, str(flip26), '6', '6')
    if chamberCheck != str(ch26):
        type = "L" if "-L" in str(ch26) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch26), '3/3/T', str(flow26),
                                    '11125', type, str(flip26), '6', '7')
    if chamberCheck != str(ch27):
        type = "L" if "-L" in str(ch27) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch27), '4/3/B', str(flow28),
                                    '11227', type, str(flip28), '6', '8')
    if chamberCheck != str(ch28):
        type = "L" if "-L" in str(ch28) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch28), '4/3/T', str(flow28),
                                    '11127', type, str(flip28), '6', '9')
    if chamberCheck != str(ch29):
        type = "L" if "-L" in str(ch29) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch29), '5/3/B', str(flow30),
                                    '11229', type, str(flip30), '6', '10')
    if chamberCheck != str(ch30):
        type = "L" if "-L" in str(ch30) else "S"
        generateXMLDataStandGeoConf(dataSet, str(ch30), '5/3/T', str(flow30),
                                    '11129', type, str(flip30), '6', '11')
    writeToFile(fileName, tostring(root))
def xml_from_excel4(excel_file):
    wb = xlrd.open_workbook(excel_file)
    sh = wb.sheet_by_index(0)
    req = sh.cell(1, 33).value
    #	pre = sh.cell(5,16).value
    #	amp = sh.cell(8,16).value
    #	coa = sh.cell(9,16).value
    #	fine = sh.cell(10,16).value
    #	itime = sh.cell(12,16).value
    #	dtime = sh.cell(13,16).value
    #	disc = sh.cell(16,16).value
    #	thrs = sh.cell(17,16).value
    #	scal = sh.cell(20,16).value
    #	daq = sh.cell(21,16).value
    Start = sys.argv[7]
    Stop = sys.argv[8]
    chamber = sys.argv[2]
    Date = str(Start[0:10])
    location = sys.argv[4]
    #user=sh.cell(1,7).value
    user = sys.argv[5]
    comment = sys.argv[6]
    Comment = sys.argv[11]
    Run = sys.argv[3]
    root = generateXMLHeader("QC6_HVTEST_CONFIG",
                             "GEM Chamber QC6 HVTEST Config",
                             str(location) + " GEM QC6 HV Test", Run, Start,
                             Stop, comment, location, user)
    dataSet = generateDataSet(root, Comment, "1", "GEM Chamber", chamber)
    generateXMLData6a(dataSet, str(req))
    writeToFile(fileName, tostring(root))
    root = generateXMLHeader("QC6_HVTEST_DATA", "GEM Chamber QC6 HVTEST Data",
                             str(location) + " GEM QC6 HV Test", Run, Start,
                             Stop, comment, location, user)
    dataSet = generateDataSet(root, Comment, "1", "GEM Chamber", chamber)
    for row in range(2, sh.nrows):
        if sh.row_values(row)[0] == '':
            break
        vmon_equ_vlt = sh.row_values(row)[0]
        imon_equ_ua = sh.row_values(row)[1]
        vmon_g3b_vlt = sh.row_values(row)[3]
        imon_g3b_ua = sh.row_values(row)[4]
        vmon_g3t_vlt = sh.row_values(row)[6]
        imon_g3t_ua = sh.row_values(row)[7]
        vmon_g2b_vlt = sh.row_values(row)[9]
        imon_g2b_ua = sh.row_values(row)[10]
        vmon_g2t_vlt = sh.row_values(row)[12]
        imon_g2t_ua = sh.row_values(row)[13]
        vmon_g1b_vlt = sh.row_values(row)[15]
        imon_g1b_ua = sh.row_values(row)[16]
        vmon_g1t_vlt = sh.row_values(row)[18]
        imon_g1t_ua = sh.row_values(row)[19]
        vmon_drift_vlt = sh.row_values(row)[21]
        imon_drift_ua = sh.row_values(row)[22]
        generateXMLData6b(
            dataSet, str(vmon_equ_vlt), str(imon_equ_ua), str(vmon_g3b_vlt),
            str(imon_g3b_ua), str(vmon_g3t_vlt), str(imon_g3t_ua),
            str(vmon_g2b_vlt), str(imon_g2b_ua), str(vmon_g2t_vlt),
            str(imon_g2t_ua), str(vmon_g1b_vlt), str(imon_g1b_ua),
            str(vmon_g1t_vlt), str(imon_g1t_ua), str(vmon_drift_vlt),
            str(imon_drift_ua))
        writeToFile(datafile, tostring(root))

    test_date = Start
    Filename = sys.argv[10]
    Elog = sys.argv[9]
    Comment = sys.argv[11]
    root = generateXMLHeader("QC6_HVTEST_SUMRY",
                             "GEM Chamber QC6 HVTEST Summary",
                             str(location) + " GEM QC6 HV Test", Run, Start,
                             Stop, comment, location, user)
    dataSet = generateDataSet(root, Comment, "1", "GEM Chamber", chamber)
    generateXMLData6c(dataSet, test_date, str(Filename), str(Elog),
                      str(Comment))
    writeToFile(testfile, tostring(root))
def xml_from_excel5(excel_file):
    wb = xlrd.open_workbook(excel_file)
    sh = wb.sheet_by_index(0)
    #user = sh.cell(0,1).value
    user = sys.argv[5]
    #chamber=sh.cell(10,1).value
    chamber = sys.argv[2]
    Run = sys.argv[3]
    location = sys.argv[4]
    Start = sys.argv[7]
    Stop = sys.argv[8]
    Date = str(Start[0:10])
    comment = sys.argv[6]
    Elog = sys.argv[9]
    File = sys.argv[10]
    Comment = sys.argv[11]
    user_name = sh.cell(1, 1).value
    amp = sh.cell(4, 1).value
    coa = sh.cell(5, 1).value
    fine = sh.cell(6, 1).value
    itime = sh.cell(8, 1).value
    dtime = sh.cell(7, 1).value
    disc = sh.cell(27, 1).value
    thrs = sh.cell(28, 1).value
    walk = sh.cell(29, 1).value
    width = sh.cell(30, 1).value
    scal = sh.cell(40, 1).value
    daq = sh.cell(41, 1).value
    pico = sh.cell(33, 1).value
    #tred = sh.cell(34,1).value
    #tblack = sh.cell(35,1).value
    #tgreen = sh.cell(36,1).value
    source = sh.cell(44, 1).value
    hvlt = sh.cell(45, 1).value
    current = sh.cell(46, 1).value
    activity_bq = sh.cell(47, 1).value
    filter_status = sh.cell(48, 1).value
    collimator_status = sh.cell(49, 1).value
    nbpri = sh.cell(23, 5).value
    eta = sh.cell(12, 1).value
    gas = sh.cell(13, 1).value
    gfac = sh.cell(14, 1).value
    flow = sh.cell(15, 1).value
    req = sh.cell(16, 1).value
    divi = sh.cell(17, 1).value
    avtemp = sh.cell(47, 5).value
    error_temp = sh.cell(48, 5).value
    amb = sh.cell(49, 5).value
    error_amb = sh.cell(50, 5).value
    expo1 = sh.cell(51, 5).value
    expo2 = sh.cell(52, 5).value
    p5p0 = sh.cell(47, 8).value
    p5t0 = sh.cell(48, 8).value
    root = generateXMLHeader("QC5_EFF_GAIN_CONFIG",
                             "GEM Chamber QC5 Effective Gain Config",
                             str(location) + " GEM Chamber QC5 Effective Gain",
                             Run, Start, Stop, comment, location, user)
    dataSet = generateDataSet(root, Comment, "1", "GEM Chamber", chamber)
    generateXMLData5a(dataSet, str(user_name), str(amp), str(coa), str(fine),
                      str(itime), str(dtime), str(disc), str(thrs), str(walk),
                      str(width), str(scal), str(daq), str(pico), str(source),
                      str(hvlt), str(current), str(nbpri), str(eta), str(gas),
                      str(gfac), str(flow), str(req), str(divi),
                      str(activity_bq), str(filter_status),
                      str(collimator_status))
    writeToFile(fileName, tostring(root))

    root = generateXMLHeader("QC5_EFF_GAIN_DATA",
                             "GEM Chamber QC5 Effective Gain Data",
                             str(location) + " GEM Chamber QC5 Effective Gain",
                             Run, Start, Stop, comment, location, user)
    dataSet = generateDataSet(root, Comment, "1", "GEM Chamber", chamber)
    #for row in range(5,21):
    for row in range(29, 45):
        #test_time= sh.row_values(row-24)[7]
        test_time = xlrd.xldate_as_tuple(
            sh.row_values(row - 24)[7], wb.datemode)
        test_time = str(test_time).replace(",", ":")
        test_time = str(test_time).replace(")", "")
        test_time = str(test_time).replace("(", " ")
        pressure = sh.row_values(row - 24)[8]
        temp = sh.row_values(row - 24)[9]
        vmon = sh.row_values(row)[5]
        imon = sh.row_values(row)[4]
        vdrift = sh.row_values(row)[6]
        rate = sh.row_values(row)[7]
        rate_error = sh.row_values(row)[8]
        current = sh.row_values(row)[9]
        current_error = sh.row_values(row)[10]
        gain = sh.row_values(row)[11]
        gain_error = sh.row_values(row)[12]
        generateXMLData5(dataSet, Date + str(test_time[9:]), str(temp),
                         str(pressure), str(imon), str(vmon), str(vdrift),
                         str(rate), str(rate_error), str(current),
                         str(current_error), str(gain), str(gain_error))
        writeToFile(datafile, tostring(root))
    root = generateXMLHeader("QC5_EFF_GAIN_SUMRY",
                             "GEM Chamber QC5 Effective Gain Summary",
                             str(location) + " GEM Chamber QC5 Effective Gain",
                             Run, Start, Stop, comment, location, user)
    dataSet = generateDataSet(root, Comment, "1", "GEM Chamber", chamber)
    generateXMLData5s(dataSet, str(Start), str(avtemp), str(amb), str(expo1),
                      str(expo2), str(File), str(Elog), str(Comment),
                      str(error_temp), str(error_amb), str(p5p0), str(p5t0))
    writeToFile(testfile, tostring(root))
		def xml_from_excel3(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=str(ObtainDate("Test Start Time(with Date like 2017-01-16):","%Y-%m-%d %H:%M:%S"))
			#print "Test Start At:" +str(Start)
			Stop=str(ObtainDate("Test End Time:","%Y-%m-%d %H:%M:%S"))
			#print "Test End At:" + str(Stop)
			chamber=sh.cell(2,7).value
			#print "Chamber is selected:" +str(chamber)
			#Date=sh.cell(0,7).value
			Date=str(Start[0:10])
			##print Date
			#location=raw_input("Enter Location:")
			location = "PLACEHOLDER_LOCATION"
			#print "Test Done At:"+str(location)
			user=sh.cell(1,7).value
			#print "Test Done By:" +str(user)
			#comment=raw_input("Make a Comment:")
			comment = "PLACHOLDER_COMMENT"
			#print "Here what you Comment:" +str(comment)
			Run=db.engine.execute("select nvl(max(run.RUN_NUMBER), 0) + 1 from cms_gem_core_cond.cond_data_sets dat join cms_gem_core_cond.kinds_of_conditions koc on dat.KIND_OF_CONDITION_ID = koc.KIND_OF_CONDITION_ID join CMS_GEM_CORE_CONSTRUCT.PARTS par on par.PART_ID = dat.PART_ID join CMS_GEM_CORE_COND.COND_RUNS run on dat.COND_RUN_ID = run.COND_RUN_ID where koc.IS_RECORD_DELETED = 'F' and par.IS_RECORD_DELETED = 'F' and koc.name = '' and par.SERIAL_NUMBER = '"+chamber+"'")
			Run = [ t for t, in Run ]
			#print "Number of Time Test Perform:"+str(Run[0])
			root = generateXMLHeader("QC3_GAS_LEAK_CALIB","GEM Chamber QC3 Gas Leak Calib Data","CERN Station A GEM Chamber QC3 Gas Leak Calibration",str(Run[0]),Start,Stop,comment,location,user)
			dataSet = generateDataSet(root,"GEM Chamber QC3 Gas Leak Calib Data","1","GEM Chamber",chamber)	
			for row in range(1,sh.nrows):
					seconds= sh.row_values(row)[1]
					pre= sh.row_values(row)[2]
					temp =sh.row_values(row)[3]
					ambp= sh.row_values(row)[4]
					#times=datetime.strftime(sh.row_values(row)[0], '%H:%M:%S')
					times = xlrd.xldate_as_tuple(sh.row_values(row)[0], wb.datemode)
					##print times[3:]
					times=str(times).replace(",",":")
					times = str(times).replace(")","")
					times = str(times).replace("("," ")
					##print times
					generateXMLData3(dataSet,Date +str(times[9:]),str(seconds),str(pre), str(ambp), str(temp))
					writeToFile(fileName, tostring(root))
			test_date=sh.cell(0,7).value
			avgtemp=sh.cell(32,7).value
			stdtemp=sh.cell(32,8).value
			avgpre=sh.cell(33,7).value
			stdpre=sh.cell(33,8).value
			initpre = sh.cell(34,7).value
			finalpre = sh.cell(35,7).value
			duration = sh.cell(36,7).value
			leakrate = sh.cell(37,7).value
			expofitp0=sh.cell(38,7).value 
			expofitp1=sh.cell(39,7).value 
			expofitR2=sh.cell(40,7).value
			#elog=raw_input("Please Enter the ELOG LINK:")
			#File=raw_input("Please Enter the File Name:")
			#Comments=raw_input("Make a Summary Comment:")
			elog="PLACEHOLDER_ELOG"
			File="PLACEHOLDER_FILE"
			Comments="PLACHOLDER_COMMENTS"
			root = generateXMLHeader("QC3_GAS_LEAK_CalIB_SUMMARY","GEM Chamber QC3 Gas Leak Calib Summary ","CERN Station A GEM Chamber QC3 Gas Leak Calib Summary",str(Run[0]),Start,Stop,comment, location,user)
			dataSet = generateDataSet(root,"GEM Chamber QC3 Gas Leak Calib Summary","1","GEM Chamber",chamber)
			generateXMLData3a(dataSet, str(test_date) ,str(avgtemp),str(stdtemp),str(avgpre),str(stdpre),str(initpre),str(finalpre),str(duration),str(leakrate),str(expofitp0),str(expofitp1),str(expofitR2),str(elog),str(File),str(Comments))
			writeToFile1(testfile, tostring(root))