Skip to content

Commit

Permalink
Merge pull request #147 from psi46/dev-v1.0.0
Browse files Browse the repository at this point in the history
Dev v1.0.0
  • Loading branch information
piberger committed May 19, 2016
2 parents afce92a + ea62647 commit aa62e8c
Show file tree
Hide file tree
Showing 20 changed files with 200 additions and 138 deletions.
25 changes: 14 additions & 11 deletions Analyse/AbstractClasses/GeneralTestResult.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def __init__(self, TestResultEnvironmentObject, ParentObject=None, InitialModule
'Order': 0,
'Width': 1,
'GroupWithNext': False,
'Floating': False,
}

# Result array
Expand Down Expand Up @@ -1181,17 +1182,19 @@ def GenerateResultDataHTML(self, TestResultObject, RecursionLevel, DisplayOption
if i['TestResultObject'].DisplayOptions['Show']:

GroupCSSClass = ''
if i2 % 5 == 0:
GroupCSSClass += ' WidthNthChild5n'
if i2 % 4 == 0:
GroupCSSClass += ' WidthNthChild4n'
if i2 % 3 == 0:
GroupCSSClass += ' WidthNthChild3n'
if i2 % 2 == 0:
GroupCSSClass += ' WidthNthChild2n'

if i['TestResultObject'].DisplayOptions['Width'] > 1:
GroupCSSClass += ' Width' + str(i['TestResultObject'].DisplayOptions['Width'])

if not i['TestResultObject'].DisplayOptions['Floating']:
if i2 % 5 == 0:
GroupCSSClass += ' WidthNthChild5n'
if i2 % 4 == 0:
GroupCSSClass += ' WidthNthChild4n'
if i2 % 3 == 0:
GroupCSSClass += ' WidthNthChild3n'
if i2 % 2 == 0:
GroupCSSClass += ' WidthNthChild2n'

if i['TestResultObject'].DisplayOptions['Width'] > 1:
GroupCSSClass += ' Width' + str(i['TestResultObject'].DisplayOptions['Width'])

if not GroupWithNext:
SubTestResultListHTML += HtmlParser.substituteMarker(
Expand Down
8 changes: 7 additions & 1 deletion Analyse/AbstractClasses/Helper/GlobalDatabaseQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@

try:
import getpass
except:
print "\x1b[31merror: can't load Python module 'getpass' \x1b[0m"

try:
import MySQLdb
except:
pass
print "\x1b[31merror: can't load Python module 'MySQLdb' \x1b[0m"
print "\x1b[31m -> run: pip install MySQL-python\x1b[0m"


class GlobalDatabaseQuery():

Expand Down
4 changes: 4 additions & 0 deletions Analyse/AbstractClasses/ModuleMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def SetContour(self, NContours):
if self.Map2D:
self.Map2D.SetContour(NContours)

def SetRangeUser(self, rangeMin, rangeMax):
if self.Map2D:
self.Map2D.GetZaxis().SetRangeUser(rangeMin, rangeMax)

def AddTH2D(self, ROOTObject, CountMissing=False, GoodRange=None):
if ROOTObject.GetXaxis().GetNbins() != self.nBinsX or ROOTObject.GetYaxis().GetNbins() != self.nBinsY:
if self.verbose:
Expand Down
6 changes: 3 additions & 3 deletions Analyse/AbstractClasses/TestResultEnvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class TestResultEnvironment:
LocalDBConnectionCursor = None

# Path to the test results
ModuleDataDirectory = '';
ModuleDataDirectory = ''

# path to folder with all test results
GlobalDataDirectory = ''
Expand All @@ -128,9 +128,9 @@ class TestResultEnvironment:
# Path to the Overview
GlobalOverviewPath = ''

LastUniqueIDCounter = 0;
LastUniqueIDCounter = 0

MoReWebVersion = 'unknown MoReWeb version'
MoReWebVersion = 'MoReWeb v1.0.0'
MoReWebBranch = 'unknown branch'

IVCurveFiles = {}
Expand Down
13 changes: 11 additions & 2 deletions Analyse/Changelog/MoReWeb_changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@

<body>
<h1>MoReWeb changelog</h1>
last updated: Feb 18, 2016
last updated: May 19, 2016

<h2>v0.7.2 - DB reprocessing</h2>
<h2>v1.0.0 - DB reprocessing</h2>
<ul>
<li>made for DB reprocessing with <b>final grading</b></li>
<li><b>fix:</b> sometimes missing plots in Fulltest</li>
<li><b>fix:</b> exceptions for some cases with incomplete data</li>
<li>plot labels corrected, plot axis set to fixed in some x-ray tests</li>
<li>exit code 404 if no data to analyze has been found (for global DB!)</li>
</ul>

<h2>v0.7.2</h2>
<ul>
<li><b>fix:</b> defective pixel counts in performance parameters dictionary were -1</li>
<li><b>fix:</b> remove dependence on <b>numpy</b> module</li>
Expand Down
4 changes: 2 additions & 2 deletions Analyse/MoReWeb.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

<body>

<h1>MoReWeb v0.7.2</h1>
last updated: February 19, 2016
<h1>MoReWeb v1.0.0</h1>
last updated: May 19, 2016
<h2>Changelog</h2>
<a href='Changelog/MoReWeb_changes.html'>see Changelog</a>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def PopulateResultData(self):
self.ResultData['Plot']['ROOTObject'].GetXaxis().SetRangeUser(-50., 50.)
self.ResultData['Plot']['ROOTObject'].GetYaxis().SetRangeUser(0.5, 5.0 * self.ResultData['Plot'][
'ROOTObject'].GetMaximum())
self.ResultData['Plot']['ROOTObject'].GetXaxis().SetTitle("Threshold")
self.ResultData['Plot']['ROOTObject'].GetXaxis().SetTitle("Vthrcomp threshold")
self.ResultData['Plot']['ROOTObject'].GetYaxis().SetTitle("No. of Entries")
self.ResultData['Plot']['ROOTObject'].GetXaxis().CenterTitle()
self.ResultData['Plot']['ROOTObject'].GetYaxis().SetTitleOffset(1.5)
Expand Down Expand Up @@ -109,7 +109,12 @@ def PopulateResultData(self):
pass

# check convergence of fit and use non-fit method if chi2 is bad
FitChi2Ndf = FitStatus.Chi2() / FitStatus.Ndf() if FitStatus.Ndf() > 0 else -1
try:
FitChi2Ndf = FitStatus.Chi2() / FitStatus.Ndf() if FitStatus.Ndf() > 0 else -1
except:
print "\x1b[31mBumpBonding: can't check status and chi2/ndf of bump bonding fit!\x1b[0m"
FitChi2Ndf = -1

self.ResultData['KeyValueDictPairs']['Chi2Ndf']['Value'] = FitChi2Ndf

if FitChi2Ndf < 0 or FitChi2Ndf > 100:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def PopulateResultData(self):
self.ResultData['Plot']['ROOTObject'].GetYaxis().SetTitleOffset(1.5)
self.ResultData['Plot']['ROOTObject'].GetYaxis().CenterTitle()

self.ResultData['Plot']['ROOTObject'].GetZaxis().SetTitle("Threshold [DAC]")
self.ResultData['Plot']['ROOTObject'].GetZaxis().SetTitle("Vthrcomp threshold [DAC]")
self.ResultData['Plot']['ROOTObject'].GetZaxis().CenterTitle()
self.ResultData['Plot']['ROOTObject'].Draw("colz")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def CustomInit(self):
self.ResultData['HiddenData']['ReadbackCal'] = {}
self.Attributes['TestedObjectType'] = 'CMSPixel_QualificationGroup_Fulltest_ROC'

self.ResultData['KeyValueDictPairs']['Vbg'] = {'Label': 'Vbg', 'Value': '-1'}
self.ResultData['KeyValueDictPairs']['par0ia'] = {'Label': 'par0ia', 'Value': '-1'}
self.ResultData['KeyValueDictPairs']['par1ia'] = {'Label': 'par1ia', 'Value': '-1'}
self.ResultData['KeyValueDictPairs']['par2ia'] = {'Label': 'par2ia', 'Value': '-1'}

def PopulateResultData(self):
Directory = self.RawTestSessionDataPath
Expand Down Expand Up @@ -57,7 +61,7 @@ def PopulateResultData(self):



#Adding Vbg
# Adding Vbg
HistoName= 'Readback.Vbg_readback_VdCal_V0'
ChipNo = self.ParentObject.Attributes['ChipNo']
ROOTFile = self.ParentObject.ParentObject.FileHandle
Expand All @@ -77,10 +81,13 @@ def PopulateResultData(self):
try:
par0ia = self.ParentObject.ResultData['SubTestResults']['ReadbackCalIana'].ResultData['KeyValueDictPairs']['par0ia']['Value']
par1ia = self.ParentObject.ResultData['SubTestResults']['ReadbackCalIana'].ResultData['KeyValueDictPairs']['par1ia']['Value']
par2ia = self.ParentObject.ResultData['SubTestResults']['ReadbackCalIana'].ResultData['KeyValueDictPairs']['par2ia']['Value']
self.ResultData['KeyValueDictPairs']['par0ia'] = {'Label': 'par0ia', 'Value': par0ia}
self.ResultData['KeyList'].append('par0ia')
self.ResultData['KeyValueDictPairs']['par1ia'] = {'Label': 'par1ia', 'Value': par1ia}
self.ResultData['KeyList'].append('par1ia')
self.ResultData['KeyValueDictPairs']['par2ia'] = {'Label': 'par2ia', 'Value': par2ia}
self.ResultData['KeyList'].append('par2ia')
except:
ReadbackCalibrated = False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def CustomInit(self):
self.NameSingle = 'ReadbackCalIana'
self.Name = 'CMSPixel_QualificationGroup_Fulltest_Chips_Chip_%s_TestResult'%self.NameSingle
self.Attributes['TestedObjectType'] = 'CMSPixel_QualificationGroup_Fulltest_ROC'
self.FitFunction = "[0]+[1]*x+[2]*x**2"

self.ResultData['KeyList'] = []
self.ResultData['KeyValueDictPairs'] = {}

def PopulateResultData(self):
ROOT.gStyle.SetOptStat(0)
Expand All @@ -39,59 +42,58 @@ def PopulateResultData(self):
pointListADC = []
pointListCurrent = []

if NBinsX==NBinsX2:
if NBinsX == NBinsX2:
for i in range(NBinsX):
if HistogramAdcVsDac.GetBinContent(i+1)!=0 or HistogramCurrentVsDac.GetBinContent(i+1)!=0:
if HistogramAdcVsDac.GetBinContent(i+1) != 0 or HistogramCurrentVsDac.GetBinContent(i+1) != 0:
pointListCurrent.append(HistogramCurrentVsDac.GetBinContent(i+1))
pointListADC.append(HistogramAdcVsDac.GetBinContent(i+1))


pointsADC = array.array('d', pointListADC)
pointsCurrent = array.array('d', pointListCurrent)
numPoints = len(pointsADC)

self.ResultData['Plot']['ROOTObject'] = ROOT.TGraph(numPoints, pointsADC, pointsCurrent)

self.ResultData['Plot']['ROOTObject'] = ROOT.TGraph(numPoints, pointsCurrent, pointsADC)

if self.ResultData['Plot']['ROOTObject']:
self.ResultData['Plot']['ROOTObject'].SetMarkerColor(4)
self.ResultData['Plot']['ROOTObject'].SetMarkerStyle(21)
self.ResultData['Plot']['ROOTObject'].SetTitle()
self.ResultData['Plot']['ROOTObject'].GetXaxis().SetTitle('Iana [ADC]')
self.ResultData['Plot']['ROOTObject'].GetXaxis().SetTitle('Iana [mA]')
self.ResultData['Plot']['ROOTObject'].GetXaxis().SetTitleOffset(1.3)
self.ResultData['Plot']['ROOTObject'].GetYaxis().SetTitle('Iana [mA]')
self.ResultData['Plot']['ROOTObject'].GetYaxis().SetTitle('Iana [ADC]')
self.ResultData['Plot']['ROOTObject'].GetYaxis().SetTitleOffset(1.4)

#Make linear fit with pol1 and get fit parameters
f1=ROOT.TF1('f1','1 ++ x')
self.ResultData['Plot']['ROOTObject'].Fit("f1","Q")
p0 = f1.GetParameter(0)
p1 = f1.GetParameter(1)
chi2 = f1.GetChisquare()
# Make linear fit with pol1 and get fit parameters
FitFunctionTF1 = ROOT.TF1('f1', self.FitFunction)
self.ResultData['Plot']['ROOTObject'].Fit(FitFunctionTF1, "QS")
chi2 = FitFunctionTF1.GetChisquare() / FitFunctionTF1.GetNDF() if FitFunctionTF1.GetNDF() > 0 else -1

#Draw the plot
# Draw the plot
self.ResultData['Plot']['ROOTObject'].Draw('AP')


self.Title = 'Iana [mA]/Iana [ADC]'
self.Title = 'Iana [ADC]/Iana [mA]'
if self.Canvas:
self.Canvas.SetCanvasSize(500, 500)
self.SaveCanvas()

#Write down the fit results
self.ResultData['KeyValueDictPairs'] = {
'par0ia': {
'Value': round(p0, 2),
'Label':'par0ia'
},
'par1ia': {
'Value': round(p1, 2),
'Label':'par1ia'
},
'chi2ia': {
# Write down the fit function + results
self.ResultData['KeyValueDictPairs']['FitFunction'] = {
'Value': self.FitFunction,
'Label':'fit'
}
self.ResultData['KeyList'].append('FitFunction')

# parameters
for i in range(FitFunctionTF1.GetNpar()):
self.ResultData['KeyValueDictPairs']['par%dia'%i] = {
'Value': '{0:1.3e}'.format(FitFunctionTF1.GetParameter(i)),
'Label':'par%dia'%i
}
self.ResultData['KeyList'].append('par%dia'%i)

# chi2/ndf
self.ResultData['KeyValueDictPairs']['chi2ia'] = {
'Value': round(chi2, 2),
'Label':'chi2'
},

'Label':'chi2/ndf'
}
self.ResultData['KeyList'] = ['par0ia', 'par1ia', 'chi2ia']
self.ResultData['KeyList'].append('chi2ia')
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def CustomInit(self):
self.NameSingle = 'ReadbackCalVana'
self.Name = 'CMSPixel_QualificationGroup_Fulltest_Chips_Chip_%s_TestResult'%self.NameSingle
self.Attributes['TestedObjectType'] = 'CMSPixel_QualificationGroup_Fulltest_ROC'

self.FitFunction = "[0]+[1]*x"

def PopulateResultData(self):
ROOT.gStyle.SetOptStat(0)
Expand Down Expand Up @@ -56,39 +56,44 @@ def PopulateResultData(self):
if g1:
g1.SetMarkerColor(4)
g1.SetMarkerStyle(21)
g1.SetTitle();
g1.GetXaxis().SetTitle('Vana [V]');
g1.GetXaxis().SetTitleOffset(1.3);
g1.GetYaxis().SetTitle('Vana [ADC]');
g1.GetYaxis().SetTitleOffset(1.4);
g1.SetTitle()
g1.GetXaxis().SetTitle('Vana [V]')
g1.GetXaxis().SetTitleOffset(1.3)
g1.GetYaxis().SetTitle('Vana [ADC]')
g1.GetYaxis().SetTitleOffset(1.4)

#Make linear fit with pol1 and get fit parameters
f1=ROOT.TF1('f1','1 ++ x')
g1.Fit("f1","Q");
p0 = f1.GetParameter(0)
p1 = f1.GetParameter(1)
chi2 = f1.GetChisquare()
FitFunctionTF1 = ROOT.TF1('f1', self.FitFunction)
g1.Fit(FitFunctionTF1, "QS")
chi2 = FitFunctionTF1.GetChisquare() / FitFunctionTF1.GetNDF() if FitFunctionTF1.GetNDF() > 0 else -1

#Draw the plot
g1.Draw('AP')

#Write down the fit results
self.ResultData['KeyValueDictPairs'] = {
'par0va': {
'Value':round(p0,2),
'Label':'par0va'
},
'par1va': {
'Value':round(p1,2),
'Label':'par1va'
},
'chi2va': {
'Value':round(chi2,2),
'Label':'chi2'
},

}
self.ResultData['KeyList'] = ['par0va', 'par1va', 'chi2va']
self.ResultData['KeyList'] = []
self.ResultData['KeyValueDictPairs'] = {}

# Write down the fit function + results
self.ResultData['KeyValueDictPairs']['FitFunction'] = {
'Value': self.FitFunction,
'Label': 'fit'
}
self.ResultData['KeyList'].append('FitFunction')

# parameters
for i in range(FitFunctionTF1.GetNpar()):
self.ResultData['KeyValueDictPairs']['par%dva'%i] = {
'Value': '{0:1.3e}'.format(FitFunctionTF1.GetParameter(i)),
'Label': 'par%dva'%i
}
self.ResultData['KeyList'].append('par%dva'%i)

# chi2/ndf
self.ResultData['KeyValueDictPairs']['chi2va'] = {
'Value': round(chi2, 2),
'Label': 'chi2/ndf'
}
self.ResultData['KeyList'].append('chi2va')

self.Title = 'Vana [ADC]/Vana [V]'
if self.Canvas:
Expand Down
Loading

0 comments on commit aa62e8c

Please sign in to comment.