Skip to content

Commit

Permalink
include only A,B in BB quality list
Browse files Browse the repository at this point in the history
  • Loading branch information
piberger committed May 24, 2016
1 parent b3c7a5e commit 878f42d
Showing 1 changed file with 71 additions and 66 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ROOT
import AbstractClasses
import glob
import os

class ProductionOverview(AbstractClasses.GeneralProductionOverview.GeneralProductionOverview):

Expand All @@ -18,6 +19,7 @@ def CustomInit(self):
self.marginX = 10
self.marginY = 10
self.IncludeSorttable = True
self.IncludeGrades = ['A', 'B']

# taken from M. Donega. pickmodule.py
def isBorder(self, x,y):
Expand Down Expand Up @@ -107,78 +109,81 @@ def GenerateOverview(self):
else:
FinalGradeFormatted = FinalGrade

if len(matchRows) == 1:
RowTuple = matchRows[0]

countTotBB = 0
# get ROOT histogram corresponding to BB defects map
Path = '/'.join([self.GlobalOverviewPath, RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], "BumpBondingMap", '*.root'])
RootFiles = glob.glob(Path)
ROOTObject = self.GetHistFromROOTFile(RootFiles, "BumpBonding")

for r in range(0,2): # 2 rows per modules
for c in range(0,8): # 8 columns per modules
nROC = c
if r > 0:
nROC += 8

localX = -1
for ic in range(0+c*self.nCols+1,self.nCols+c*self.nCols+1):
localX += 1
localY = -1
for ir in range(0+r*self.nRows+1,self.nRows+r*self.nRows+1):
localY += 1
bb = ROOTObject.GetBinContent(ic,ir)

#ntotPXL+=1

if bb > 0.5:
# print nROC, localX, localY, bb
countTotBB += 1
countROCBB[nROC] += 1 # to plot all BB per ROC

# definition of border includes corners!
if self.isBorder(localX,localY):
countBorderBB[nROC]+=1 # to plot all border BB per ROC
else:
countCenterBB[nROC]+=1

if self.isCorner(localX,localY):
countCornerBB[nROC]+=1 # to plot all corners BB per ROC

imgPath = '/'.join([self.GlobalOverviewPath, RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], "BumpBondingMap", '*.png'])
imgFiles = glob.glob(imgPath)
imgFiles[0] = imgFiles[0].replace('//', '/')
imgHTMLData = ("<a href='%s'><img src='%s' alt='Bump Bonding defects map' width=600></a>"%(imgFiles[0],imgFiles[0])) if len(imgFiles) > 0 else "-"

if max(countROCBB) < 42:
MaxROC = "%d"%max(countROCBB)
elif max(countROCBB) < 167:
MaxROC = "<span style='color:#f70;font-weight:bold;'>%d</span>"%max(countROCBB)
if FinalGrade in self.IncludeGrades:
if len(matchRows) == 1:
RowTuple = matchRows[0]

countTotBB = 0
# get ROOT histogram corresponding to BB defects map
Path = '/'.join([self.GlobalOverviewPath, RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], "BumpBondingMap", '*.root'])
RootFiles = glob.glob(Path)
ROOTObject = self.GetHistFromROOTFile(RootFiles, "BumpBonding")

for r in range(0,2): # 2 rows per modules
for c in range(0,8): # 8 columns per modules
nROC = c
if r > 0:
nROC += 8

localX = -1
for ic in range(0+c*self.nCols+1,self.nCols+c*self.nCols+1):
localX += 1
localY = -1
for ir in range(0+r*self.nRows+1,self.nRows+r*self.nRows+1):
localY += 1
bb = ROOTObject.GetBinContent(ic,ir)

#ntotPXL+=1

if bb > 0.5:
# print nROC, localX, localY, bb
countTotBB += 1
countROCBB[nROC] += 1 # to plot all BB per ROC

# definition of border includes corners!
if self.isBorder(localX,localY):
countBorderBB[nROC]+=1 # to plot all border BB per ROC
else:
countCenterBB[nROC]+=1

if self.isCorner(localX,localY):
countCornerBB[nROC]+=1 # to plot all corners BB per ROC

imgFile = '/'.join(['..','..',RowTuple['RelativeModuleFinalResultsPath'], RowTuple['FulltestSubfolder'], "BumpBondingMap", 'BumpBondingMap.png'])
imgHTMLData = ("<a href='%s'><img src='%s' alt='Bump Bonding defects map' width=600></a>"%(imgFile,imgFile))

if max(countROCBB) < 42:
MaxROC = "%d"%max(countROCBB)
elif max(countROCBB) < 167:
MaxROC = "<span style='color:#f70;font-weight:bold;'>%d</span>"%max(countROCBB)
else:
MaxROC = "<span style='color:red;font-weight:bold;'>%d</span>"%max(countROCBB)

TableData.append(
[
"<b>%s</b>"%ModuleID, FinalGradeFormatted, "%d"%countTotBB, MaxROC, "%d"%sum(countBorderBB), "%d"%sum(countCornerBB), "%d"%sum(countCenterBB), imgHTMLData
]
)
elif len(matchRows) < 1:
TableData.append(
[
"<b>%s</b>"%ModuleID, FinalGradeFormatted, 'N/A', '', '', '', '', '-'
])
else:
MaxROC = "<span style='color:red;font-weight:bold;'>%d</span>"%max(countROCBB)

TableData.append(
[
"<b>%s</b>"%ModuleID, FinalGradeFormatted, "%d"%countTotBB, MaxROC, "%d"%sum(countBorderBB), "%d"%sum(countCornerBB), "%d"%sum(countCenterBB), imgHTMLData
]
)
elif len(matchRows) < 1:
TableData.append(
[
"<b>%s</b>"%ModuleID, FinalGradeFormatted, 'N/A', '', '', '', '', '-'
])
else:
TableData.append(
[
"<b>%s</b>"%ModuleID, FinalGradeFormatted, '?', '', '', '', '', '-'
])
nMod +=1
TableData.append(
[
"<b>%s</b>"%ModuleID, FinalGradeFormatted, '?', '', '', '', '', '-'

])
print "multiple rows found!:", matchRows
nMod +=1

RowLimit = 500
HTMLInfo = "<b>definitions:</b> corners are pixels with col less or equal than " + "%d"%self.marginX + " pix and row less or equal than " + "%d"%self.marginY + " pix away from edge. Borders include pixels with col less or equal than " + "%d"%self.marginX + " pix or row less or equal than " + "%d"%self.marginY + " pix away from edge, thus include corners.<br>"
HTMLInfo += "<b>test:</b> " + self.Attributes['Test'] + "<br>"
HTMLInfo += "<b>grades:</b> %s<br>"%(', '.join(self.IncludeGrades))
HTMLInfo += "<b>features:</b> click on table header to sort table<br>"

HTML = HTMLInfo + self.Table(TableData, RowLimit, TableClass='sortable', TableStyle='text-align:center;')

return self.Boxed(HTML)
Expand Down

0 comments on commit 878f42d

Please sign in to comment.