petal-qc 0.0.15__py3-none-any.whl → 0.0.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- petal_qc/BTreport/CheckBTtests.py +92 -33
- petal_qc/BTreport/bustapeReport.py +2 -1
- petal_qc/__init__.py +7 -2
- petal_qc/{test/getPetalCoreTestSummary.py → getPetalCoreTestSummary.py} +36 -14
- petal_qc/metrology/PetalMetrology.py +0 -13
- petal_qc/metrology/compare_Cores.py +44 -0
- petal_qc/metrology/coreMetrology.py +0 -12
- petal_qc/metrology/do_Metrology.py +0 -13
- petal_qc/metrology/petal_flatness.py +0 -13
- petal_qc/metrology/readAVSdata.py +2 -0
- petal_qc/metrology/uploadPetalInformation.py +20 -20
- petal_qc/test/analyzeMetrologyTable.py +119 -0
- petal_qc/test/checkAVStests.py +2 -2
- petal_qc/test/checkCoreShipments.py +57 -0
- petal_qc/test/createMetrologyTable.py +87 -0
- petal_qc/test/getAVStests.py +21 -3
- petal_qc/test/prepareDESYfiles.py +2 -1
- petal_qc/test/test_Graphana.py +2 -1
- petal_qc/thermal/IRPetalParam.py +2 -0
- petal_qc/thermal/PipeFit.py +48 -19
- petal_qc/thermal/analyze_IRCore.py +34 -24
- petal_qc/thermal/contours.py +18 -12
- petal_qc/thermal/create_IRCore.py +40 -9
- petal_qc/thermal/create_core_report.py +8 -5
- petal_qc/thermal/show_IR_petal.py +1 -10
- petal_qc/utils/ArgParserUtils.py +41 -0
- petal_qc/utils/docx_utils.py +18 -6
- {petal_qc-0.0.15.dist-info → petal_qc-0.0.17.dist-info}/METADATA +2 -2
- {petal_qc-0.0.15.dist-info → petal_qc-0.0.17.dist-info}/RECORD +32 -28
- {petal_qc-0.0.15.dist-info → petal_qc-0.0.17.dist-info}/WHEEL +1 -1
- {petal_qc-0.0.15.dist-info → petal_qc-0.0.17.dist-info}/entry_points.txt +1 -0
- {petal_qc-0.0.15.dist-info → petal_qc-0.0.17.dist-info}/top_level.txt +0 -0
|
@@ -14,9 +14,12 @@ The main routine is BTreport and can be called from anywhere else.
|
|
|
14
14
|
import sys
|
|
15
15
|
import traceback
|
|
16
16
|
import json
|
|
17
|
-
import getpass
|
|
18
17
|
import datetime
|
|
19
18
|
import dateutil.parser
|
|
19
|
+
import argparse
|
|
20
|
+
|
|
21
|
+
from petal_qc.utils.ArgParserUtils import RangeListAction
|
|
22
|
+
|
|
20
23
|
import itkdb
|
|
21
24
|
from itkdb_gtk import ITkDBlogin
|
|
22
25
|
from itkdb_gtk import ITkDButils
|
|
@@ -88,7 +91,7 @@ def find_bus_tapes(session, petal, complain_func=complain):
|
|
|
88
91
|
if cstage != "COMPLETED":
|
|
89
92
|
complain_func("Bus tape not in final stages", cstage)
|
|
90
93
|
bt_valid[comp_type] = False
|
|
91
|
-
|
|
94
|
+
|
|
92
95
|
else:
|
|
93
96
|
bt_valid[comp_type] = True
|
|
94
97
|
|
|
@@ -108,8 +111,8 @@ def find_but_tape_tests(session, petal_date, bt_sn, complain_func=complain):
|
|
|
108
111
|
dict: dict with all tests. key is the test type code.
|
|
109
112
|
|
|
110
113
|
"""
|
|
111
|
-
test_list = session.get("listTestRunsByComponent",
|
|
112
|
-
json={"filterMap":{"serialNumber": bt_sn,
|
|
114
|
+
test_list = session.get("listTestRunsByComponent",
|
|
115
|
+
json={"filterMap":{"serialNumber": bt_sn,
|
|
113
116
|
"stage": "COMPLETED"}
|
|
114
117
|
})
|
|
115
118
|
bt_tests = {}
|
|
@@ -147,7 +150,7 @@ def date2string(the_date=None):
|
|
|
147
150
|
return out
|
|
148
151
|
|
|
149
152
|
|
|
150
|
-
def BTreport(session, SerialN, complain_func=complain):
|
|
153
|
+
def BTreport(session, SerialN, petal=None, complain_func=complain):
|
|
151
154
|
"""Makes the BTreport for a petal core.
|
|
152
155
|
|
|
153
156
|
Args:
|
|
@@ -155,20 +158,21 @@ def BTreport(session, SerialN, complain_func=complain):
|
|
|
155
158
|
SerialN (str): The Petal core SB
|
|
156
159
|
"""
|
|
157
160
|
# get petal frm DB.
|
|
158
|
-
petal = ITkDButils.get_DB_component(session, SerialN)
|
|
159
161
|
if petal is None:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
petal = ITkDButils.get_DB_component(session, SerialN)
|
|
163
|
+
if petal is None:
|
|
164
|
+
complain_func(SerialN, "Could not find petal core.")
|
|
165
|
+
return None
|
|
162
166
|
|
|
163
167
|
SerialN = petal["serialNumber"]
|
|
164
168
|
|
|
165
|
-
print("+++ Petal core {} [{}]".format(SerialN, petal["alternativeIdentifier"]))
|
|
169
|
+
print("\n+++ Petal core {} [{}]".format(SerialN, petal["alternativeIdentifier"]))
|
|
166
170
|
petal_date = dateutil.parser.parse(petal["stateTs"])
|
|
167
171
|
comp_type = get_type(petal)
|
|
168
172
|
if comp_type != "CORE_AVS":
|
|
169
173
|
complain_func("This is not a petal cores", comp_type)
|
|
170
174
|
return None
|
|
171
|
-
|
|
175
|
+
|
|
172
176
|
# Check that the petal core is in the proper stage.
|
|
173
177
|
stage = petal["currentStage"]['code']
|
|
174
178
|
if stage != "AT_QC_SITE":
|
|
@@ -182,12 +186,12 @@ def BTreport(session, SerialN, complain_func=complain):
|
|
|
182
186
|
|
|
183
187
|
# Loop on children an find bustapes
|
|
184
188
|
bt_list, bt_valid = find_bus_tapes(session, petal, complain_func=complain_func)
|
|
185
|
-
|
|
189
|
+
|
|
186
190
|
nvalid = 0
|
|
187
191
|
for valid in bt_valid.values():
|
|
188
192
|
if valid:
|
|
189
193
|
nvalid += 1
|
|
190
|
-
|
|
194
|
+
|
|
191
195
|
if nvalid != 2:
|
|
192
196
|
complain_func("no valid bustape found", "Either not assembled or in incorrect stage.")
|
|
193
197
|
return None
|
|
@@ -210,6 +214,7 @@ def BTreport(session, SerialN, complain_func=complain):
|
|
|
210
214
|
# Check the tests in the bustapes
|
|
211
215
|
ngood = 0
|
|
212
216
|
ntrouble = 0
|
|
217
|
+
nprocess = 0
|
|
213
218
|
for bt, cp_id in bt_list.values():
|
|
214
219
|
bt_sn = bt["serialNumber"]
|
|
215
220
|
print("bus tape {}".format(bt_sn))
|
|
@@ -218,7 +223,11 @@ def BTreport(session, SerialN, complain_func=complain):
|
|
|
218
223
|
bt_nprob = 0
|
|
219
224
|
# get list of tests and select the latest.
|
|
220
225
|
bt_tests = find_but_tape_tests(session, petal_date, bt_sn, complain_func=complain_func)
|
|
221
|
-
|
|
226
|
+
if len(bt_tests) == 0:
|
|
227
|
+
print("-> No bus tape tests available")
|
|
228
|
+
continue
|
|
229
|
+
|
|
230
|
+
nprocess += 1
|
|
222
231
|
results = {}
|
|
223
232
|
childId = {}
|
|
224
233
|
for key, the_test in bt_tests.items():
|
|
@@ -248,19 +257,62 @@ def BTreport(session, SerialN, complain_func=complain):
|
|
|
248
257
|
# {"value": childId["BTSTRETCHP"],
|
|
249
258
|
# "childParentRelation": cp_id})
|
|
250
259
|
|
|
260
|
+
if nprocess == 0:
|
|
261
|
+
return None
|
|
262
|
+
|
|
251
263
|
out["passed"] = (ngood == 4)
|
|
252
264
|
out["problems"] = (ntrouble > 0)
|
|
253
265
|
print("BusTape Report\n\tN. good {}\n\tN. prob {}".format(ngood, ntrouble))
|
|
254
266
|
|
|
255
267
|
return out
|
|
256
268
|
|
|
269
|
+
|
|
270
|
+
def check_petal_core(session, SerialN):
|
|
271
|
+
"""Check petal core for bt report."""
|
|
272
|
+
core = ITkDButils.get_DB_component(session, SerialN)
|
|
273
|
+
if core is None:
|
|
274
|
+
return None
|
|
275
|
+
|
|
276
|
+
test_list = session.get(
|
|
277
|
+
"listTestRunsByComponent",
|
|
278
|
+
json={
|
|
279
|
+
"filterMap": {
|
|
280
|
+
"serialNumber": core["serialNumber"],
|
|
281
|
+
"state": "ready",
|
|
282
|
+
"testType": ["BTTESTING",],
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
ntest = 0
|
|
288
|
+
for tst in test_list:
|
|
289
|
+
ntest += 1
|
|
290
|
+
|
|
291
|
+
if ntest>0:
|
|
292
|
+
return None
|
|
293
|
+
|
|
294
|
+
return core
|
|
295
|
+
|
|
257
296
|
def main():
|
|
258
297
|
"""Main entry."""
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
298
|
+
parser = argparse.ArgumentParser()
|
|
299
|
+
parser.add_argument("args", nargs='*', help="Input cores")
|
|
300
|
+
parser.add_argument("--cores", dest="cores", action=RangeListAction, default=[],
|
|
301
|
+
help="Create list of cores to analyze. The list is made with numbers or ranges (ch1:ch2 or ch1:ch2:step) ")
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
args = parser.parse_args()
|
|
305
|
+
if len(args.cores)==0:
|
|
306
|
+
try:
|
|
307
|
+
args.cores.extend(args.args)
|
|
308
|
+
|
|
309
|
+
except IndexError:
|
|
310
|
+
print("I need a petal core SN or AlternativeID")
|
|
311
|
+
sys.exit()
|
|
312
|
+
|
|
313
|
+
else:
|
|
314
|
+
cores = [ "PPC.{:03d}".format(int(x)) for x in args.cores]
|
|
315
|
+
args.cores = cores
|
|
264
316
|
|
|
265
317
|
# ITk PDB authentication
|
|
266
318
|
dlg = None
|
|
@@ -272,27 +324,34 @@ def main():
|
|
|
272
324
|
except Exception:
|
|
273
325
|
# Login with "standard" if the above fails.
|
|
274
326
|
client = ITkDButils.create_client()
|
|
275
|
-
|
|
276
|
-
# Check the Bustape tests
|
|
277
|
-
try:
|
|
278
|
-
out = BTreport(client, SN)
|
|
279
|
-
# Upload test
|
|
280
|
-
if out:
|
|
281
|
-
try:
|
|
282
|
-
db_response = client.post("uploadTestRunResults", json=out)
|
|
283
|
-
except Exception as ex:
|
|
284
|
-
print("Could not upload test.")
|
|
285
|
-
print(ex)
|
|
286
|
-
|
|
287
327
|
|
|
288
|
-
|
|
289
|
-
|
|
328
|
+
# Check the Bustape tests
|
|
329
|
+
for SN in args.cores:
|
|
330
|
+
core = check_petal_core(client, SN)
|
|
331
|
+
if core is None:
|
|
332
|
+
continue
|
|
333
|
+
|
|
334
|
+
try:
|
|
335
|
+
out = BTreport(client, SN, petal=core)
|
|
336
|
+
# Upload test
|
|
337
|
+
if out:
|
|
338
|
+
try:
|
|
339
|
+
db_response = client.post("uploadTestRunResults", json=out)
|
|
340
|
+
except Exception as ex:
|
|
341
|
+
print("Could not upload test for {}.".format(SN))
|
|
342
|
+
print(ex)
|
|
343
|
+
|
|
344
|
+
except KeyError as ex:
|
|
345
|
+
print("Key error: {}".format(ex))
|
|
346
|
+
|
|
347
|
+
except Exception:
|
|
348
|
+
print(traceback.format_exc())
|
|
290
349
|
|
|
291
350
|
try:
|
|
292
351
|
dlg.die()
|
|
293
352
|
|
|
294
353
|
except Exception:
|
|
295
354
|
print("Bye !")
|
|
296
|
-
|
|
355
|
+
|
|
297
356
|
if __name__ == "__main__":
|
|
298
357
|
main()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""GUI for the BTtest."""
|
|
3
3
|
import dateutil.parser
|
|
4
|
+
import getpass
|
|
4
5
|
from itkdb_gtk import ITkDButils
|
|
5
6
|
from itkdb_gtk import dbGtkUtils
|
|
6
7
|
from itkdb_gtk import ITkDBlogin
|
|
@@ -156,7 +157,7 @@ class BusTapeReport(dbGtkUtils.ITkDBWindow):
|
|
|
156
157
|
bt_sn,
|
|
157
158
|
complain_func=dbGtkUtils.complain)
|
|
158
159
|
|
|
159
|
-
values = [btype,
|
|
160
|
+
values = [btype, bt_sn, cstage]
|
|
160
161
|
|
|
161
162
|
self.outDB = CheckBTtests.BTreport(self.session, SN, complain_func=dbGtkUtils.complain)
|
|
162
163
|
|
petal_qc/__init__.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""petal_qc python module."""
|
|
2
|
-
__version__ = "0.0.
|
|
2
|
+
__version__ = "0.0.17"
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
def coreMetrology():
|
|
@@ -23,7 +23,7 @@ def coreThermal():
|
|
|
23
23
|
main()
|
|
24
24
|
|
|
25
25
|
def bustapeReport():
|
|
26
|
-
"""
|
|
26
|
+
"""Creates the bustape report and uplades to PDB."""
|
|
27
27
|
from .BTreport.CheckBTtests import main
|
|
28
28
|
# from .BTreport.bustapeReport import main
|
|
29
29
|
main()
|
|
@@ -48,6 +48,11 @@ def petalReceptionTests():
|
|
|
48
48
|
from .PetalReceptionTests import main
|
|
49
49
|
main()
|
|
50
50
|
|
|
51
|
+
def petalCoreTestSummary():
|
|
52
|
+
"""GND/VI tests."""
|
|
53
|
+
from .getPetalCoreTestSummary import main
|
|
54
|
+
main()
|
|
55
|
+
|
|
51
56
|
def dashBoard():
|
|
52
57
|
"""Launches the Core thermal analysis ahd PDB script."""
|
|
53
58
|
from .dashBoard import main
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""Get a summery of Petal core TEsts."""
|
|
3
3
|
import json
|
|
4
|
+
import sys
|
|
5
|
+
import re
|
|
6
|
+
from argparse import ArgumentParser
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
from pathlib import Path
|
|
4
10
|
try:
|
|
5
11
|
import itkdb_gtk
|
|
6
|
-
|
|
12
|
+
|
|
7
13
|
except ImportError:
|
|
8
|
-
import sys
|
|
9
|
-
from pathlib import Path
|
|
10
14
|
cwd = Path(__file__).parent.parent
|
|
11
15
|
sys.path.append(cwd.as_posix())
|
|
12
16
|
|
|
13
17
|
from itkdb_gtk import ITkDBlogin, ITkDButils
|
|
14
18
|
from itkdb_gtk.dbGtkUtils import replace_in_container, DictDialog, ask_for_confirmation
|
|
19
|
+
from petal_qc.utils.ArgParserUtils import RangeListAction
|
|
15
20
|
|
|
21
|
+
r_petal_id = re.compile("PPC.([0-9]*)")
|
|
16
22
|
|
|
17
|
-
def
|
|
23
|
+
def petalCoreTest(session, options):
|
|
18
24
|
"""Main entry point."""
|
|
19
25
|
|
|
20
26
|
# find all cores
|
|
@@ -34,20 +40,31 @@ def main(session, options):
|
|
|
34
40
|
if options.institute:
|
|
35
41
|
payload["filterMap"]["currentLocation"] = options.institute
|
|
36
42
|
suff = options.institute
|
|
37
|
-
|
|
43
|
+
|
|
38
44
|
core_list = session.get("listComponents", json=payload)
|
|
39
45
|
core_tests = ["PETAL_METROLOGY_FRONT", "PETAL_METROLOGY_BACK", "XRAYIMAGING", "THERMAL_EVALUATION", "BTTESTING"]
|
|
40
|
-
|
|
46
|
+
|
|
41
47
|
do_check_stage = "AT_QC_SITE"
|
|
42
48
|
#do_check_stage = None
|
|
43
49
|
petal_id_db = {}
|
|
44
|
-
|
|
50
|
+
|
|
51
|
+
has_list = len(options.cores) != 0
|
|
52
|
+
|
|
45
53
|
for core in core_list:
|
|
46
54
|
SN = core["serialNumber"]
|
|
47
55
|
altid = core['alternativeIdentifier']
|
|
48
56
|
if "PPC" not in altid:
|
|
49
57
|
continue
|
|
50
|
-
|
|
58
|
+
|
|
59
|
+
R = r_petal_id.search(altid)
|
|
60
|
+
if R is None:
|
|
61
|
+
continue
|
|
62
|
+
|
|
63
|
+
pid = int(R.group(1))
|
|
64
|
+
|
|
65
|
+
if has_list and pid not in options.cores:
|
|
66
|
+
continue
|
|
67
|
+
|
|
51
68
|
petal_id_db[altid] = SN
|
|
52
69
|
location = core["currentLocation"]['code']
|
|
53
70
|
coreStage = core["currentStage"]['code']
|
|
@@ -71,32 +88,37 @@ def main(session, options):
|
|
|
71
88
|
T = session.get("getTestRun", json={"testRun": tst["id"]})
|
|
72
89
|
if T["state"] != "ready":
|
|
73
90
|
print(T)
|
|
74
|
-
|
|
91
|
+
|
|
75
92
|
print("-- {} [{}]".format(T["testType"]["name"], T["runNumber"]))
|
|
76
93
|
if not T["passed"]:
|
|
77
94
|
print("\t## test FAILED")
|
|
78
|
-
|
|
95
|
+
|
|
79
96
|
for D in T["defects"]:
|
|
80
97
|
print("\t{} - {}".format(D["name"], D["description"]))
|
|
81
98
|
|
|
82
99
|
with open("petal_ID_db_{}.json".format(suff), "w", encoding="utf-8") as fOut:
|
|
83
100
|
json.dump(petal_id_db, fOut, indent=3)
|
|
84
101
|
|
|
85
|
-
|
|
86
|
-
|
|
102
|
+
def main():
|
|
103
|
+
"""Main entry"""
|
|
87
104
|
parser = ArgumentParser()
|
|
88
105
|
parser.add_argument("--institute", default=None, help="The petal current location")
|
|
106
|
+
parser.add_argument("--cores", dest="cores", action=RangeListAction, default=[],
|
|
107
|
+
help="Create list of cores to analyze. The list is made with numbers or ranges (ch1:ch2 or ch1:ch2:step) ")
|
|
89
108
|
options = parser.parse_args()
|
|
90
|
-
|
|
109
|
+
|
|
91
110
|
# ITk_PB authentication
|
|
92
111
|
dlg = ITkDBlogin.ITkDBlogin()
|
|
93
112
|
session = dlg.get_client()
|
|
94
113
|
|
|
95
114
|
try:
|
|
96
|
-
|
|
115
|
+
petalCoreTest(session, options)
|
|
97
116
|
|
|
98
117
|
except Exception as E:
|
|
99
118
|
print(E)
|
|
100
119
|
|
|
101
120
|
dlg.die()
|
|
102
121
|
|
|
122
|
+
if __name__ == "__main__":
|
|
123
|
+
main()
|
|
124
|
+
|
|
@@ -45,19 +45,6 @@ def check_spec(val, nom, fraction=0.0):
|
|
|
45
45
|
rc = val <= (1+fraction)*nom
|
|
46
46
|
return rc
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
class CommaSeparatedListAction(Action):
|
|
50
|
-
"""Create a list from the comma sepparated numbers at imput."""
|
|
51
|
-
|
|
52
|
-
def __call__(self, args_parser, namespace, values, option_string=None):
|
|
53
|
-
"""The actual action."""
|
|
54
|
-
value = np.array(list(map(float, values.split(','))), dtype='float64')
|
|
55
|
-
if value.shape[0] < 3:
|
|
56
|
-
raise ValueError("{} needs a 3D vector".format(self.dest))
|
|
57
|
-
|
|
58
|
-
setattr(namespace, self.dest, value)
|
|
59
|
-
|
|
60
|
-
|
|
61
48
|
def petal_metrology(ifile, options):
|
|
62
49
|
"""Do the analysis of the petal metrology data.
|
|
63
50
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
"""Compare quantities."""
|
|
3
3
|
|
|
4
4
|
import sys
|
|
5
|
+
import re
|
|
6
|
+
|
|
5
7
|
import argparse
|
|
6
8
|
import glob
|
|
7
9
|
import json
|
|
@@ -10,6 +12,33 @@ from pathlib import Path
|
|
|
10
12
|
import numpy as np
|
|
11
13
|
import matplotlib.pyplot as plt
|
|
12
14
|
|
|
15
|
+
r_petal_id = re.compile("PPC.([0-9]*)")
|
|
16
|
+
|
|
17
|
+
class PetalCoreListAction(argparse.Action):
|
|
18
|
+
"""Create a list from the comma sepparated numbers at imput."""
|
|
19
|
+
|
|
20
|
+
def __call__(self, parser, namespace, values, option_string=None):
|
|
21
|
+
"""The actual action."""
|
|
22
|
+
value = []
|
|
23
|
+
for V in values.split(','):
|
|
24
|
+
try:
|
|
25
|
+
value.append(int(V))
|
|
26
|
+
except ValueError:
|
|
27
|
+
if ':' not in V:
|
|
28
|
+
continue
|
|
29
|
+
|
|
30
|
+
items = V.split(':')
|
|
31
|
+
if len(items)==1:
|
|
32
|
+
continue
|
|
33
|
+
|
|
34
|
+
ival = list(map(int, items))
|
|
35
|
+
ival[1] += 1
|
|
36
|
+
for x in range(*ival):
|
|
37
|
+
value.append(int(x))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
setattr(namespace, self.dest, value)
|
|
41
|
+
|
|
13
42
|
|
|
14
43
|
def get_value(data, value_path):
|
|
15
44
|
"""Get the value from the path given."""
|
|
@@ -59,12 +88,25 @@ def read_data_files(options):
|
|
|
59
88
|
front = {}
|
|
60
89
|
back = {}
|
|
61
90
|
|
|
91
|
+
has_list = len(options.cores) != 0
|
|
92
|
+
|
|
62
93
|
for fnam in options.files:
|
|
63
94
|
ifile = Path(fnam).expanduser().resolve()
|
|
64
95
|
if not ifile.exists():
|
|
65
96
|
print("File does not exist: ", fnam)
|
|
66
97
|
continue
|
|
67
98
|
|
|
99
|
+
R = r_petal_id.search(fnam)
|
|
100
|
+
if R is None:
|
|
101
|
+
continue
|
|
102
|
+
|
|
103
|
+
petal_id = R.group(0)
|
|
104
|
+
pid = int(R.group(1))
|
|
105
|
+
|
|
106
|
+
if has_list and pid not in options.cores:
|
|
107
|
+
continue
|
|
108
|
+
|
|
109
|
+
|
|
68
110
|
data = None
|
|
69
111
|
with open(ifile, 'r', encoding="UTF-8") as fp:
|
|
70
112
|
data = json.load(fp)
|
|
@@ -251,6 +293,8 @@ if __name__ == "__main__":
|
|
|
251
293
|
parser.add_argument("--out", default=None, help="File to store the figure.")
|
|
252
294
|
parser.add_argument("--no-legend", dest="no_legend", default=False, action="store_true", help="Do not draw the legend")
|
|
253
295
|
parser.add_argument("--no-show", dest="no_show", default=False, action="store_true", help="Do not show the figure")
|
|
296
|
+
parser.add_argument("--cores", dest="cores", action=PetalCoreListAction, default=[],
|
|
297
|
+
help="Create list of cores to analyze. The list is made with numbers or ranges (ch1:ch2 or ch1:ch2:step) ")
|
|
254
298
|
|
|
255
299
|
opts = parser.parse_args()
|
|
256
300
|
if len(opts.files) == 0:
|
|
@@ -18,18 +18,6 @@ from gi.repository import Gtk, GObject, Gio, GLib
|
|
|
18
18
|
|
|
19
19
|
__HELP__ = "https://petal-qc.docs.cern.ch/metrology.html"
|
|
20
20
|
|
|
21
|
-
class CommaSeparatedListAction(Action):
|
|
22
|
-
"""Create a list from the comma sepparated numbers at imput."""
|
|
23
|
-
|
|
24
|
-
def __call__(self, parser, namespace, values, option_string=None):
|
|
25
|
-
"""The actual action."""
|
|
26
|
-
value = np.array(list(map(float, values.split(','))), dtype='float64')
|
|
27
|
-
if value.shape[0] < 3:
|
|
28
|
-
raise ValueError("{} needs a 3D vector".format(self.dest))
|
|
29
|
-
|
|
30
|
-
setattr(namespace, self.dest, value)
|
|
31
|
-
|
|
32
|
-
|
|
33
21
|
class CoreMetrology(itkdb_gtk.dbGtkUtils.ITkDBWindow):
|
|
34
22
|
"""Application window."""
|
|
35
23
|
|
|
@@ -23,21 +23,8 @@ except ImportError:
|
|
|
23
23
|
sys.path.append(cwd.as_posix())
|
|
24
24
|
|
|
25
25
|
from petal_qc.utils.utils import output_folder
|
|
26
|
-
|
|
27
26
|
from petal_qc.metrology.PetalMetrology import petal_metrology
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
class CommaSeparatedListAction(Action):
|
|
31
|
-
"""Create a list from the comma sepparated numbers at imput."""
|
|
32
|
-
|
|
33
|
-
def __call__(self, parser, namespace, values, option_string=None):
|
|
34
|
-
"""The actual action."""
|
|
35
|
-
value = np.array(list(map(float, values.split(','))), dtype='float64')
|
|
36
|
-
if value.shape[0] < 3:
|
|
37
|
-
raise Exception("{} needs a 3D vector".format(self.dest))
|
|
38
|
-
|
|
39
|
-
setattr(namespace, self.dest, value)
|
|
40
|
-
|
|
41
28
|
def do_analysis(fnam, prefix, SN, options):
|
|
42
29
|
"""Perform analysis of a file.
|
|
43
30
|
|
|
@@ -31,19 +31,6 @@ from .show_data_file import show_data, TOP_VIEW
|
|
|
31
31
|
|
|
32
32
|
figure_width = 14
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
class CommaSeparatedListAction(Action):
|
|
36
|
-
"""Create a list from the comma sepparated numbers at imput."""
|
|
37
|
-
|
|
38
|
-
def __call__(self, parser, namespace, values, option_string=None):
|
|
39
|
-
"""The actual action."""
|
|
40
|
-
value = np.array(list(map(float, values.split(','))), dtype='float64')
|
|
41
|
-
if value.shape[0] < 3:
|
|
42
|
-
raise Exception("{} needs a 3D vector".format(self.dest))
|
|
43
|
-
|
|
44
|
-
setattr(namespace, self.dest, value)
|
|
45
|
-
|
|
46
|
-
|
|
47
34
|
def plot_sensor(Spoints, ax, marker='o', cmap='magma'):
|
|
48
35
|
"""Plot the points given in a scatter plot."""
|
|
49
36
|
ax.scatter(Spoints[:, 0], Spoints[:, 1], Spoints[:, 2],
|
|
@@ -696,6 +696,8 @@ def readProductionSheet(session, file_path, SN):
|
|
|
696
696
|
manufacturing["results"]["LOCATOR_B"] = sheet["{}{}".format(id_col, i_items+3)].value
|
|
697
697
|
manufacturing["results"]["LOCATOR_C"] = sheet["{}{}".format(id_col, i_items+4)].value
|
|
698
698
|
manufacturing["results"]["HONEYCOMBSET"] = split_comp_list( sheet["{}{}".format(id_col, i_items+5)].value)
|
|
699
|
+
manufacturing["results"]["HONEYCOMBSET"] = [ str(x) for x in manufacturing["results"]["HONEYCOMBSET"]]
|
|
700
|
+
|
|
699
701
|
manufacturing["results"]["EPOXY_ADHESIVE"] = split_comp_list(sheet["{}{}".format(id_col, i_items+8)].value)
|
|
700
702
|
manufacturing["results"]["EPOXY_PUTTY"] = split_comp_list( sheet["{}{}".format(id_col, i_items+9)].value)
|
|
701
703
|
manufacturing["results"]["EPOXY_CONDUCTIVE"] = split_comp_list( sheet["{}{}".format(id_col, i_items+10)].value)
|
|
@@ -12,10 +12,10 @@ gi.require_version("Gtk", "3.0")
|
|
|
12
12
|
from gi.repository import Gtk, Gio
|
|
13
13
|
|
|
14
14
|
try:
|
|
15
|
-
import
|
|
15
|
+
import petal_qc
|
|
16
16
|
|
|
17
17
|
except ImportError:
|
|
18
|
-
cwd = Path(__file__).parent.parent
|
|
18
|
+
cwd = Path(__file__).parent.parent.parent
|
|
19
19
|
sys.path.append(cwd.as_posix())
|
|
20
20
|
|
|
21
21
|
from itkdb_gtk import ITkDBlogin, ITkDButils, dbGtkUtils
|
|
@@ -271,7 +271,7 @@ class AVSPanel(dbGtkUtils.ITkDBWindow):
|
|
|
271
271
|
self.btnFAT.unselect_all()
|
|
272
272
|
self.btn_state.set_label("Undef")
|
|
273
273
|
dbGtkUtils.set_button_color(self.btn_state, "azure", "black")
|
|
274
|
-
|
|
274
|
+
|
|
275
275
|
|
|
276
276
|
def create_test_window(self, test_json, test_name, label):
|
|
277
277
|
"""Create the dialog for a DB test and add it to the notebook.
|
|
@@ -537,6 +537,23 @@ class AVSPanel(dbGtkUtils.ITkDBWindow):
|
|
|
537
537
|
if self.petal_core is None:
|
|
538
538
|
return
|
|
539
539
|
|
|
540
|
+
this_petal = self.SN.get_text()
|
|
541
|
+
# Check for HonneyComb set
|
|
542
|
+
for P in self.petal_core["properties"]:
|
|
543
|
+
if P["code"] == "HC_ID" and P["value"] is None:
|
|
544
|
+
if dbGtkUtils.is_iterable(components["HoneyCombSet"]):
|
|
545
|
+
val = ','.join([str(x) for x in components["HoneyCombSet"]])
|
|
546
|
+
else:
|
|
547
|
+
val = str(components["HoneyCombSet"])
|
|
548
|
+
rc = ITkDButils.set_component_property(self.session,
|
|
549
|
+
this_petal,
|
|
550
|
+
"HC_ID",
|
|
551
|
+
val)
|
|
552
|
+
if rc is None:
|
|
553
|
+
error_txt.append("Problems setting HoneyCombSet ID.\n")
|
|
554
|
+
|
|
555
|
+
break
|
|
556
|
+
|
|
540
557
|
comp_map = {
|
|
541
558
|
"BT_PETAL_FRONT": "FacingFront",
|
|
542
559
|
"BT_PETAL_BACK": "FacingBack",
|
|
@@ -565,7 +582,6 @@ class AVSPanel(dbGtkUtils.ITkDBWindow):
|
|
|
565
582
|
error_txt = []
|
|
566
583
|
txt = "Click OK to add\n\t{}".format("\n\t".join(missing))
|
|
567
584
|
if dbGtkUtils.ask_for_confirmation("Missing components", txt, parent=self):
|
|
568
|
-
this_petal = self.SN.get_text()
|
|
569
585
|
for cmp in missing:
|
|
570
586
|
SN = components[comp_map[cmp]]
|
|
571
587
|
if SN[0:5] == "20USE":
|
|
@@ -582,22 +598,6 @@ class AVSPanel(dbGtkUtils.ITkDBWindow):
|
|
|
582
598
|
if rc is None:
|
|
583
599
|
print("Could not set final stage of {} [{}]".format(ctype, SN))
|
|
584
600
|
|
|
585
|
-
# Check for HonneyComb set
|
|
586
|
-
for P in self.petal_core["properties"]:
|
|
587
|
-
if P["code"] == "HC_ID" and P["value"] is None:
|
|
588
|
-
if dbGtkUtils.is_iterable(components["HoneyCombSet"]):
|
|
589
|
-
val = ' '.join(components["HoneyCombSet"])
|
|
590
|
-
else:
|
|
591
|
-
val = str(components["HoneyCombSet"])
|
|
592
|
-
rc = ITkDButils.set_component_property(self.session,
|
|
593
|
-
this_petal,
|
|
594
|
-
"HC_ID",
|
|
595
|
-
val)
|
|
596
|
-
if rc is None:
|
|
597
|
-
error_txt.append("Problems setting HoneyCombSet ID.\n")
|
|
598
|
-
|
|
599
|
-
break
|
|
600
|
-
|
|
601
601
|
# Check the final stage of the assembled objects
|
|
602
602
|
# for child in self.petal_core["children"]:
|
|
603
603
|
# if child["component"]:
|