From d6cb10f1656db92d57efca1dc1d3488a1d424449 Mon Sep 17 00:00:00 2001 From: piberger Date: Tue, 5 Jul 2016 11:11:56 +0200 Subject: [PATCH] add full IV curve to reception test --- .../Helper/GlobalDatabaseQuery.py | 30 +++++++++++++++++++ .../Reception/Database/Database.py | 6 ++++ .../Reception/IVCurve/IVCurve.py | 21 +++++++++++++ 3 files changed, 57 insertions(+) diff --git a/Analyse/AbstractClasses/Helper/GlobalDatabaseQuery.py b/Analyse/AbstractClasses/Helper/GlobalDatabaseQuery.py index ca718697..d69ee460 100644 --- a/Analyse/AbstractClasses/Helper/GlobalDatabaseQuery.py +++ b/Analyse/AbstractClasses/Helper/GlobalDatabaseQuery.py @@ -12,6 +12,12 @@ print "\x1b[31merror: can't load Python module 'MySQLdb' \x1b[0m" print "\x1b[31m -> run: pip install MySQL-python\x1b[0m" +try: + from urllib2 import urlopen +except: + raise + print "\x1b[31merror: can't load Python module 'urllib' \x1b[0m" + print "\x1b[31m -> needed for getting IV curves from DB\x1b[0m" class GlobalDatabaseQuery(): @@ -109,3 +115,27 @@ def GetFullQualificationResult(self, ModuleID): return self.QuerySQL(SQLQuery) + def GetFulltestIVCurve(self, ModuleID, tempnominal = 'p17_1'): + + SQLQuery = '''SELECT inventory_fullmodule.FULLMODULE_ID, GRADE, inventory_fullmodule.BUILTON, inventory_fullmodule.BUILTBY, inventory_fullmodule.STATUS, tempnominal, I150, IVSLOPE, PFNs + FROM inventory_fullmodule + INNER JOIN test_fullmodule ON inventory_fullmodule.LASTTEST_FULLMODULE=test_fullmodule.SUMMARY_ID + INNER JOIN test_fullmoduleanalysis ON test_fullmodule.LASTANALYSIS_ID=test_fullmoduleanalysis.TEST_ID + INNER JOIN test_data ON test_data.DATA_ID = test_fullmoduleanalysis.DATA_ID + WHERE inventory_fullmodule.FULLMODULE_ID = '{ModuleID}' AND tempnominal = '{tempnominal}' AND test_fullmodule.TYPE='FullQualification' AND inventory_fullmodule.STATUS='INSTOCK' + ORDER BY tempnominal;'''.format(ModuleID=ModuleID, tempnominal=tempnominal) + DbResults = self.QuerySQL(SQLQuery) + if len(DbResults) > 0: + print DbResults[0] + RelativePath = DbResults[0]['PFNs'].replace('file:','') + IVCurveURL = "http://" + self.Host + RelativePath + "/ivCurve.log" + myreq = urlopen(IVCurveURL) + IVdata = myreq.read() + + IVdataLines = IVdata.replace('\x0d','').split('\n') + IVdataLines = [x.strip().replace('\t', ' ').split(' ') for x in IVdataLines if not x.strip().startswith('#')] + else: + IVdataLines = [] + + return IVdataLines + diff --git a/Analyse/TestResultClasses/CMSPixel/QualificationGroup/Reception/Database/Database.py b/Analyse/TestResultClasses/CMSPixel/QualificationGroup/Reception/Database/Database.py index e163888c..58a1dae6 100644 --- a/Analyse/TestResultClasses/CMSPixel/QualificationGroup/Reception/Database/Database.py +++ b/Analyse/TestResultClasses/CMSPixel/QualificationGroup/Reception/Database/Database.py @@ -89,12 +89,18 @@ def PopulateResultDataFullQualifications(self): LeakageCurrent150p17 = -2 self.ResultData['Table']['BODY'].append(FulltestRow) + + IVdata = DB.GetFulltestIVCurve(ModuleID=ModuleID) + self.ResultData['HiddenData']['IVCurveDB'] = IVdata + except: self.ResultData['Table'] = { 'HEADER': [['Error']], 'BODY': [["Can't compare with DB, either no connection or module not in database!"]], 'FOOTER': [], } + + self.ResultData['HiddenData']['LeakageCurrent150p17'] = LeakageCurrent150p17 diff --git a/Analyse/TestResultClasses/CMSPixel/QualificationGroup/Reception/IVCurve/IVCurve.py b/Analyse/TestResultClasses/CMSPixel/QualificationGroup/Reception/IVCurve/IVCurve.py index f350c0e5..da52a611 100644 --- a/Analyse/TestResultClasses/CMSPixel/QualificationGroup/Reception/IVCurve/IVCurve.py +++ b/Analyse/TestResultClasses/CMSPixel/QualificationGroup/Reception/IVCurve/IVCurve.py @@ -32,4 +32,25 @@ def PopulateResultData(self): self.ResultData['KeyValueDictPairs']['IV150DB'] = {'Label': 'I(150 V) Fulltest', 'Value': "%1.2f"%(float(IVfromDB)*1e6), 'Unit': 'μA'} self.ResultData['KeyList'].append('IV150DB') + + if 'IVCurveDB' in self.ParentObject.ResultData['SubTestResults']['Database'].ResultData['HiddenData']: + IVCurveDB = self.ParentObject.ResultData['SubTestResults']['Database'].ResultData['HiddenData']['IVCurveDB'] + + voltages = [] + currents = [] + for IVTuple in IVCurveDB: + if len(IVTuple) > 1: + try: + voltages.append(-float(IVTuple[0])) + currents.append(-float(IVTuple[1])) + except: + pass + + xp = array.array('d', voltages) + yp = array.array('d', currents) + + ivGraph2 = ROOT.TGraph(len(voltages), xp, yp) + ivGraph2.SetLineColor(ROOT.kRed + 1) + ivGraph2.Draw("L same") + self.SaveCanvas()