From 878f42df6ac7f9a494ab1c06bacaafc3b21df076 Mon Sep 17 00:00:00 2001 From: Pixel Production Date: Tue, 24 May 2016 18:39:15 +0200 Subject: [PATCH] include only A,B in BB quality list --- .../BBCorners/BBCorners.py | 137 +++++++++--------- 1 file changed, 71 insertions(+), 66 deletions(-) diff --git a/Analyse/OverviewClasses/CMSPixel/ProductionOverview/ProductionOverviewPage/BBCorners/BBCorners.py b/Analyse/OverviewClasses/CMSPixel/ProductionOverview/ProductionOverviewPage/BBCorners/BBCorners.py index 92b847a0..688f1f62 100644 --- a/Analyse/OverviewClasses/CMSPixel/ProductionOverview/ProductionOverviewPage/BBCorners/BBCorners.py +++ b/Analyse/OverviewClasses/CMSPixel/ProductionOverview/ProductionOverviewPage/BBCorners/BBCorners.py @@ -1,6 +1,7 @@ import ROOT import AbstractClasses import glob +import os class ProductionOverview(AbstractClasses.GeneralProductionOverview.GeneralProductionOverview): @@ -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): @@ -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 = ("Bump Bonding defects map"%(imgFiles[0],imgFiles[0])) if len(imgFiles) > 0 else "-" - - if max(countROCBB) < 42: - MaxROC = "%d"%max(countROCBB) - elif max(countROCBB) < 167: - MaxROC = "%d"%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 = ("Bump Bonding defects map"%(imgFile,imgFile)) + + if max(countROCBB) < 42: + MaxROC = "%d"%max(countROCBB) + elif max(countROCBB) < 167: + MaxROC = "%d"%max(countROCBB) + else: + MaxROC = "%d"%max(countROCBB) + + TableData.append( + [ + "%s"%ModuleID, FinalGradeFormatted, "%d"%countTotBB, MaxROC, "%d"%sum(countBorderBB), "%d"%sum(countCornerBB), "%d"%sum(countCenterBB), imgHTMLData + ] + ) + elif len(matchRows) < 1: + TableData.append( + [ + "%s"%ModuleID, FinalGradeFormatted, 'N/A', '', '', '', '', '-' + ]) else: - MaxROC = "%d"%max(countROCBB) - - TableData.append( - [ - "%s"%ModuleID, FinalGradeFormatted, "%d"%countTotBB, MaxROC, "%d"%sum(countBorderBB), "%d"%sum(countCornerBB), "%d"%sum(countCenterBB), imgHTMLData - ] - ) - elif len(matchRows) < 1: - TableData.append( - [ - "%s"%ModuleID, FinalGradeFormatted, 'N/A', '', '', '', '', '-' - ]) - else: - TableData.append( - [ - "%s"%ModuleID, FinalGradeFormatted, '?', '', '', '', '', '-' - ]) - nMod +=1 + TableData.append( + [ + "%s"%ModuleID, FinalGradeFormatted, '?', '', '', '', '', '-' + + ]) + print "multiple rows found!:", matchRows + nMod +=1 RowLimit = 500 HTMLInfo = "definitions: 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.
" HTMLInfo += "test: " + self.Attributes['Test'] + "
" + HTMLInfo += "grades: %s
"%(', '.join(self.IncludeGrades)) HTMLInfo += "features: click on table header to sort table
" + HTML = HTMLInfo + self.Table(TableData, RowLimit, TableClass='sortable', TableStyle='text-align:center;') return self.Boxed(HTML)