Skip to content
Snippets Groups Projects
Commit 6d139e17 authored by Mario's avatar Mario
Browse files

bugFix on parameterOptimizer.py

parent e044341d
No related branches found
No related tags found
No related merge requests found
Pipeline #2640595 passed
{
"targetChipNumber": 4,
"targetChipNumber": 1,
"repetitions": 2,
"parameters":
[
{
"name": "CmlTapBias0",
"min": 500,
"max": 800,
"min": 300,
"max": 900,
"step": 100
},
{
"name": "CmlTapBias1",
"min": 100,
"max": 300,
"min": 0,
"max": 400,
"step": 100
}
],
......@@ -41,6 +41,18 @@
"min": 20,
"max": 26,
"step": 1
},
{
"name": "OutputActiveLanes",
"min": 1,
"max": 15,
"step": 1
},
{
"name": "CmlEn",
"min": 1,
"max": 7,
"step": 6
}
]
}
......@@ -35,6 +35,8 @@ def count0(enMaskPath):
data = json.load(file1)
for y in data["Data"]:
badPixels += y.count(0)
return float(badPixels)
except:
......@@ -75,10 +77,11 @@ def updatecfg(args, chipName, name_v1, name_v2, v1range, v2range, xtest, ytest):
cfg = json.load(f)
cfg["RD53A"]["GlobalConfig"][name_v1] = v1range[xtest]
cfg["RD53A"]["GlobalConfig"][name_v2] = v2range[ytest]
with open(chipCfg, 'w') as f:
json.dump(cfg, f, indent=4)
def find(args):
"""Finds a minimum amongst some setting parameters"""
......@@ -173,12 +176,14 @@ def find(args):
# run first digitalScan
total = 0
for j in range(nReps):
print("[ info ][po] Running a digital scan at %i %i..." % (v1range[xtest0[i]], v2range[ytest0[i]]))
print("[ info ][po] Running a digital scan at %i %i... " % (v1range[xtest0[i]], v2range[ytest0[i]]))
process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
enMaskPath = args.basepath + "/data/optimizer/last_scan/" + chipName + "_EnMask.json"
count = count0(enMaskPath)
print(" -> Counted %i" % count)
total += count
if count < 0:
......@@ -211,12 +216,12 @@ def find(args):
lookaround_y = min(prev3validY) if prev3validY != [] else randint(0, len(v2range) - 1)
xtest1, ytest1 = whereToGoNext(lookaround_x, lookaround_y, results)
updatecfg(args, chipName, name_v1, name_v2, v1range, v2range, xtest1, ytest1)
print("[ info ][po] Entering the loop...")
while True:
updatecfg(args, chipName, name_v1, name_v2, v1range, v2range, xtest1, ytest1)
# power cycle
if args.powercycle:
os.system("python3 libDCS/qaqc.py -e " + args.equip + " -c " + args.channel + " power-off")
......@@ -224,12 +229,8 @@ def find(args):
print()
# If the matrix is filled
if xtest1 == None:
return
# If we have already tested this point
elif results[xtest1][ytest1] != ' ':
if results[xtest1][ytest1] != ' ':
# Find another one random
xtest1 = randint(0, len(v1range))
......@@ -248,6 +249,8 @@ def find(args):
enMaskPath = args.basepath + "/data/optimizer/last_scan/" + chipName + "_EnMask.json"
count = count0(enMaskPath)
print(" -> Counted %i" % count)
total += count
if count < 0:
......@@ -281,6 +284,11 @@ def find(args):
print("")
print(t)
# If the matrix is filled
if xtest1 == None:
return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment