Skip to content

Commit

Permalink
add full IV curve to reception test
Browse files Browse the repository at this point in the history
  • Loading branch information
piberger committed Jul 5, 2016
1 parent e67deb5 commit d6cb10f
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Analyse/AbstractClasses/Helper/GlobalDatabaseQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():

Expand Down Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit d6cb10f

Please sign in to comment.