itkdb-gtk 0.0.3__py3-none-any.whl → 0.20.1__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.
- itkdb_gtk/{sendShipments.py → CreateShipments.py} +74 -78
- itkdb_gtk/{getShipments.py → GetShipments.py} +99 -106
- itkdb_gtk/GlueWeight.py +45 -66
- itkdb_gtk/ITkDB.desktop +8 -0
- itkdb_gtk/ITkDB.svg +380 -0
- itkdb_gtk/ITkDBlogin.py +10 -6
- itkdb_gtk/ITkDButils.py +295 -57
- itkdb_gtk/PanelVisualInspection.py +590 -0
- itkdb_gtk/QRScanner.py +120 -0
- itkdb_gtk/SensorUtils.py +492 -0
- itkdb_gtk/ShowAttachments.py +267 -0
- itkdb_gtk/ShowComments.py +94 -0
- itkdb_gtk/ShowDefects.py +103 -0
- itkdb_gtk/UploadModuleIV.py +566 -0
- itkdb_gtk/UploadMultipleTests.py +746 -0
- itkdb_gtk/UploadTest.py +509 -0
- itkdb_gtk/VisualInspection.py +297 -0
- itkdb_gtk/WireBondGui.py +1304 -0
- itkdb_gtk/__init__.py +38 -12
- itkdb_gtk/dashBoard.py +292 -33
- itkdb_gtk/dbGtkUtils.py +356 -75
- itkdb_gtk/findComponent.py +242 -0
- itkdb_gtk/findVTRx.py +36 -0
- itkdb_gtk/readGoogleSheet.py +1 -2
- itkdb_gtk/untrash_component.py +35 -0
- {itkdb_gtk-0.0.3.dist-info → itkdb_gtk-0.20.1.dist-info}/METADATA +21 -12
- itkdb_gtk-0.20.1.dist-info/RECORD +30 -0
- {itkdb_gtk-0.0.3.dist-info → itkdb_gtk-0.20.1.dist-info}/WHEEL +1 -1
- itkdb_gtk-0.20.1.dist-info/entry_points.txt +12 -0
- itkdb_gtk/checkComponent.py +0 -131
- itkdb_gtk/groundingTest.py +0 -225
- itkdb_gtk/readAVSdata.py +0 -565
- itkdb_gtk/uploadPetalInformation.py +0 -604
- itkdb_gtk/uploadTest.py +0 -384
- itkdb_gtk-0.0.3.dist-info/RECORD +0 -19
- itkdb_gtk-0.0.3.dist-info/entry_points.txt +0 -7
- {itkdb_gtk-0.0.3.dist-info → itkdb_gtk-0.20.1.dist-info}/top_level.txt +0 -0
itkdb_gtk/readAVSdata.py
DELETED
|
@@ -1,565 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env pythoon3
|
|
2
|
-
"""Read AVS dats file."""
|
|
3
|
-
import sys
|
|
4
|
-
from argparse import ArgumentParser
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
|
-
try:
|
|
8
|
-
import ITkDBlogin
|
|
9
|
-
import ITkDButils
|
|
10
|
-
except ModuleNotFoundError:
|
|
11
|
-
from itkdb_gtk import ITkDBlogin, ITkDButils
|
|
12
|
-
|
|
13
|
-
import dateutil.parser
|
|
14
|
-
import numpy as np
|
|
15
|
-
import openpyxl as XL
|
|
16
|
-
from openpyxl.cell.cell import MergedCell
|
|
17
|
-
from openpyxl.utils.exceptions import InvalidFileException
|
|
18
|
-
|
|
19
|
-
sk_defaults = {
|
|
20
|
-
"institution": "AVS",
|
|
21
|
-
"runNumber": "1",
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class AVSDataException(Exception):
|
|
26
|
-
"""AVSData exception class."""
|
|
27
|
-
|
|
28
|
-
def __init__(self, message):
|
|
29
|
-
"""Call the base class constructor with the parameters it needs."""
|
|
30
|
-
super().__init__(message)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def create_weight(session, SN, the_date=None, manager="", passed=True, problems=False, comments=[]):
|
|
34
|
-
"""Creates the dictionary for a WEIGHT test.
|
|
35
|
-
|
|
36
|
-
Args:
|
|
37
|
-
----
|
|
38
|
-
session: the DB session
|
|
39
|
-
SN: Serial Number
|
|
40
|
-
the_date: the date of the test
|
|
41
|
-
manager: manager name
|
|
42
|
-
passed: if test passed or not
|
|
43
|
-
problems: if problems were found during test
|
|
44
|
-
comments: list of comments to append to the test
|
|
45
|
-
|
|
46
|
-
"""
|
|
47
|
-
the_date = ITkDButils.get_db_date(the_date)
|
|
48
|
-
out = ITkDButils.get_test_skeleton(session, "CORE_PETAL", "WEIGHING", sk_defaults)
|
|
49
|
-
out['component'] = SN
|
|
50
|
-
out['date'] = the_date
|
|
51
|
-
out['passed'] = passed
|
|
52
|
-
out['problems'] = problems
|
|
53
|
-
out['properties']['PRODUCTION_MANAGER'] = manager
|
|
54
|
-
out['comments'] = comments
|
|
55
|
-
return out
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def create_manufacturing(session, SN, the_date=None, manager="", passed=True, problems=False, comments=[]):
|
|
59
|
-
"""Create the dictionary or the MANUFACTURING test.
|
|
60
|
-
|
|
61
|
-
Args:
|
|
62
|
-
----
|
|
63
|
-
session: the DB session
|
|
64
|
-
SN: Serial Number
|
|
65
|
-
the_date: the date of the test
|
|
66
|
-
manager: manager name
|
|
67
|
-
passed: if test passed or not
|
|
68
|
-
problems: if problems were found during test
|
|
69
|
-
comments: list of comments to append to the test
|
|
70
|
-
|
|
71
|
-
"""
|
|
72
|
-
the_date = ITkDButils.get_db_date(the_date)
|
|
73
|
-
out = ITkDButils.get_test_skeleton(session, "CORE_PETAL", "MANUFACTURING", sk_defaults)
|
|
74
|
-
out['component'] = SN
|
|
75
|
-
out['date'] = the_date
|
|
76
|
-
out['passed'] = passed
|
|
77
|
-
out['problems'] = problems
|
|
78
|
-
out['properties']['PRODUCTION_MANAGER'] = manager
|
|
79
|
-
out['comments'] = comments
|
|
80
|
-
|
|
81
|
-
return out
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def create_visual_inpection(session, SN, the_date=None, operator="", passed=True, problems=False, comments=[]):
|
|
85
|
-
"""Create Visual Inspection test skeleton."""
|
|
86
|
-
the_date = ITkDButils.get_db_date(the_date)
|
|
87
|
-
out = ITkDButils.get_test_skeleton(session, "CORE_PETAL", "VISUAL_INSPECTION", sk_defaults)
|
|
88
|
-
out['component'] = SN
|
|
89
|
-
out['date'] = the_date
|
|
90
|
-
out['passed'] = passed
|
|
91
|
-
out['problems'] = problems
|
|
92
|
-
out['properties']['OPERATOR'] = operator
|
|
93
|
-
out['comments'] = comments
|
|
94
|
-
|
|
95
|
-
return out
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def create_delamination_test(session, SN, the_date=None, operator="", passed=True, problems=False, comments=[]):
|
|
99
|
-
"""Create the delamination test JSON.
|
|
100
|
-
|
|
101
|
-
Args:
|
|
102
|
-
----
|
|
103
|
-
session: the DB session
|
|
104
|
-
SN: Serial Number
|
|
105
|
-
the_date: the date of the test
|
|
106
|
-
operator: operator name
|
|
107
|
-
passed: if test passed or not
|
|
108
|
-
problems: if problems were found during test
|
|
109
|
-
comments: list of comments to append to the test
|
|
110
|
-
|
|
111
|
-
"""
|
|
112
|
-
the_date = ITkDButils.get_db_date(the_date)
|
|
113
|
-
out = ITkDButils.get_test_skeleton(session, "CORE_PETAL", "DELAMINATION", sk_defaults, {"boolean": False})
|
|
114
|
-
out['component'] = SN
|
|
115
|
-
out['date'] = the_date
|
|
116
|
-
out['passed'] = passed
|
|
117
|
-
out['problems'] = problems
|
|
118
|
-
out['properties']['OPERATOR'] = operator
|
|
119
|
-
out['comments'] = comments
|
|
120
|
-
|
|
121
|
-
return out
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def create_grounding_test(session, SN, the_date=None, operator="", passed=True, problems=False, comments=[]):
|
|
125
|
-
"""Create grounding test.
|
|
126
|
-
|
|
127
|
-
Args:
|
|
128
|
-
----
|
|
129
|
-
session: the DB session
|
|
130
|
-
SN: Serial Number
|
|
131
|
-
the_date: the date of the test
|
|
132
|
-
operator: operator name
|
|
133
|
-
passed: if test passed or not
|
|
134
|
-
problems: if problems were found during test
|
|
135
|
-
comments: list of comments to append to the test
|
|
136
|
-
|
|
137
|
-
"""
|
|
138
|
-
the_date = ITkDButils.get_db_date(the_date)
|
|
139
|
-
out = ITkDButils.get_test_skeleton(session, "CORE_PETAL", "GROUNDING_CHECK", sk_defaults, {"boolean": False})
|
|
140
|
-
out['component'] = SN
|
|
141
|
-
out['date'] = the_date
|
|
142
|
-
out['passed'] = passed
|
|
143
|
-
out['problems'] = problems
|
|
144
|
-
out['properties']['OPERATOR'] = operator
|
|
145
|
-
out['comments'] = comments
|
|
146
|
-
|
|
147
|
-
return out
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
def create_metrology_test(session, SN, the_date=None, operator="", passed=True, problems=False, comments=[]):
|
|
151
|
-
"""Metrology test.
|
|
152
|
-
|
|
153
|
-
Args:
|
|
154
|
-
----
|
|
155
|
-
session: the DB session
|
|
156
|
-
SN: Serial Number
|
|
157
|
-
the_date: the date of the test
|
|
158
|
-
operator: operator name
|
|
159
|
-
passed: if test passed or not
|
|
160
|
-
problems: if problems were found during test
|
|
161
|
-
comments: list of comments to append to the test
|
|
162
|
-
|
|
163
|
-
"""
|
|
164
|
-
the_date = ITkDButils.get_db_date(the_date)
|
|
165
|
-
out = ITkDButils.get_test_skeleton(session, "CORE_PETAL", "METROLOGY_AVS",
|
|
166
|
-
sk_defaults, {"integer": -1, "float": -1.0})
|
|
167
|
-
out['component'] = SN
|
|
168
|
-
out['date'] = the_date
|
|
169
|
-
out['passed'] = passed
|
|
170
|
-
out['problems'] = problems
|
|
171
|
-
out['properties']['OPERATOR'] = operator
|
|
172
|
-
out['comments'] = comments
|
|
173
|
-
|
|
174
|
-
return out
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
def split_comp_list(lst):
|
|
178
|
-
"""Split a list of components separated by various possible characters."""
|
|
179
|
-
if lst is None:
|
|
180
|
-
return []
|
|
181
|
-
|
|
182
|
-
if isinstance(lst, float):
|
|
183
|
-
return [lst]
|
|
184
|
-
|
|
185
|
-
if isinstance(lst, int):
|
|
186
|
-
return [lst]
|
|
187
|
-
|
|
188
|
-
out = [lst]
|
|
189
|
-
for sep in ['/', '\\', '\n']:
|
|
190
|
-
if lst.find(sep) >= 0:
|
|
191
|
-
out = [x.strip() for x in lst.split(sep)]
|
|
192
|
-
break
|
|
193
|
-
|
|
194
|
-
return out
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
def get_comments(txt):
|
|
198
|
-
"""Return test DB comment."""
|
|
199
|
-
return split_comp_list(txt)
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
def get_float(cell, separator=None, default=0.0):
|
|
203
|
-
"""Return float from string."""
|
|
204
|
-
txt = cell.value
|
|
205
|
-
if txt is None:
|
|
206
|
-
return default
|
|
207
|
-
|
|
208
|
-
if separator is None:
|
|
209
|
-
if isinstance(txt, float):
|
|
210
|
-
return txt
|
|
211
|
-
|
|
212
|
-
if isinstance(txt, int):
|
|
213
|
-
return float(txt)
|
|
214
|
-
|
|
215
|
-
return default
|
|
216
|
-
|
|
217
|
-
else:
|
|
218
|
-
values = []
|
|
219
|
-
for val in split_comp_list(txt):
|
|
220
|
-
if isinstance(val, float) or isinstance(val, int):
|
|
221
|
-
values.append(val)
|
|
222
|
-
else:
|
|
223
|
-
try:
|
|
224
|
-
v = float(val.strip().replace(',', '.'))
|
|
225
|
-
except ValueError:
|
|
226
|
-
print("get_float: Cannot convert {} in {}".format(val, cell.coordinate))
|
|
227
|
-
v = default
|
|
228
|
-
|
|
229
|
-
values.append(v)
|
|
230
|
-
|
|
231
|
-
return values
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
def get_boolean(cell):
|
|
235
|
-
"""Get a boolean from a cell."""
|
|
236
|
-
value = cell.value
|
|
237
|
-
if value is None:
|
|
238
|
-
return False
|
|
239
|
-
|
|
240
|
-
else:
|
|
241
|
-
txt = value.strip().lower()
|
|
242
|
-
return (txt == "pass")
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
def get_text(cell):
|
|
246
|
-
"""Get a string from a cell."""
|
|
247
|
-
value = cell.value
|
|
248
|
-
if value:
|
|
249
|
-
value = value.strip()
|
|
250
|
-
|
|
251
|
-
return value
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
def get_res_and_accep(sheet, indx):
|
|
255
|
-
"""Return result and acceptancee."""
|
|
256
|
-
val = get_float(sheet["g{}".format(indx)])
|
|
257
|
-
accept = get_boolean(sheet["h{}".format(indx)])
|
|
258
|
-
return val, accept
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
def find_idx(lst, val):
|
|
262
|
-
"""Return index of occurence of val in lst."""
|
|
263
|
-
idx = [i for i, x in enumerate(lst) if (x and x.find(val) >= 0)]
|
|
264
|
-
return idx
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
def cell_value(sheet, coord):
|
|
268
|
-
"""Return the cell value."""
|
|
269
|
-
cell = sheet[coord]
|
|
270
|
-
if not isinstance(cell, MergedCell):
|
|
271
|
-
return cell.value
|
|
272
|
-
|
|
273
|
-
# "Oh no, the cell is merged!"
|
|
274
|
-
for range in sheet.merged_cells.ranges:
|
|
275
|
-
if coord in range:
|
|
276
|
-
return range.start_cell.value
|
|
277
|
-
|
|
278
|
-
return None
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
def check_for_problems(sheet, the_test, row_range):
|
|
282
|
-
"""Finds FAIL massages in the Acceptance column."""
|
|
283
|
-
nfail = 0
|
|
284
|
-
for row in range(row_range[0], row_range[1]):
|
|
285
|
-
txt = get_text(sheet["h{}".format(row)])
|
|
286
|
-
if txt is None:
|
|
287
|
-
continue
|
|
288
|
-
|
|
289
|
-
txt = txt.lower()
|
|
290
|
-
if txt[0] == 'f':
|
|
291
|
-
nfail += 1
|
|
292
|
-
hdr = get_text(sheet["d{}".format(row)])
|
|
293
|
-
reason = cell_value(sheet, "i{}".format(row))
|
|
294
|
-
|
|
295
|
-
if len(reason) < 20:
|
|
296
|
-
msg = "{}: {}".format(hdr, reason)
|
|
297
|
-
the_test["defects"].append({"name": msg})
|
|
298
|
-
else:
|
|
299
|
-
the_test["defects"].append({"name": hdr,
|
|
300
|
-
"description": reason})
|
|
301
|
-
|
|
302
|
-
if nfail:
|
|
303
|
-
the_test["passed"] = False
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
def get_coreID(bustapeID):
|
|
307
|
-
"""Build core SN from bus tape SN."""
|
|
308
|
-
SN = "20USEBC" + bustapeID[-7:]
|
|
309
|
-
return SN
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
def readFATfile(session, fnam, SN=None):
|
|
313
|
-
"""Read data from FAT excel file.
|
|
314
|
-
|
|
315
|
-
Args:
|
|
316
|
-
----
|
|
317
|
-
session: the DB session
|
|
318
|
-
fnam: File path
|
|
319
|
-
SN: COre serial number
|
|
320
|
-
|
|
321
|
-
"""
|
|
322
|
-
# Open spreadsheet
|
|
323
|
-
try:
|
|
324
|
-
wb = XL.load_workbook(fnam)
|
|
325
|
-
except InvalidFileException as ee:
|
|
326
|
-
print("Could not open input file: ", fnam)
|
|
327
|
-
print(ee)
|
|
328
|
-
return None
|
|
329
|
-
|
|
330
|
-
# Assume active sheet is the good one, otherwise will have to find in wb.sheetnames
|
|
331
|
-
sheet = wb.active
|
|
332
|
-
if sheet.max_row < 50 or sheet.max_column < 9:
|
|
333
|
-
raise AVSDataException("Wrong FAT file")
|
|
334
|
-
|
|
335
|
-
# Check the SN of the petal core
|
|
336
|
-
if SN is None or len(SN) == 0:
|
|
337
|
-
coreID = split_comp_list(sheet['C6'].value)
|
|
338
|
-
if len(coreID) == 0:
|
|
339
|
-
raise AVSDataException("Cannot figure out core SN in FAT file.")
|
|
340
|
-
|
|
341
|
-
for cID in coreID:
|
|
342
|
-
cmp = ITkDButils.get_DB_component(session, cID)
|
|
343
|
-
if cmp["type"]["code"] == "BT_PETAL_FRONT":
|
|
344
|
-
SN = get_coreID(cID)
|
|
345
|
-
break
|
|
346
|
-
|
|
347
|
-
batch = sheet['E6'].value
|
|
348
|
-
operator = sheet['G6'].value
|
|
349
|
-
|
|
350
|
-
txt = list(map(str.strip, sheet['i4'].value.split(':')))[1]
|
|
351
|
-
test_date = dateutil.parser.parse(txt)
|
|
352
|
-
|
|
353
|
-
# Get the test index
|
|
354
|
-
test_name = [str(sheet[x][1].value) for x in range(1, sheet.max_row)]
|
|
355
|
-
tests = [str(sheet[x][3].value) for x in range(1, sheet.max_row)]
|
|
356
|
-
|
|
357
|
-
# This is to avoid adding 1 for cell names...
|
|
358
|
-
tests.insert(0, None)
|
|
359
|
-
test_name.insert(0, None)
|
|
360
|
-
|
|
361
|
-
#
|
|
362
|
-
# Visual inspection
|
|
363
|
-
vi_text = get_text(sheet['i9'])
|
|
364
|
-
vi_result = get_text(sheet['g9'])
|
|
365
|
-
vi_pass = (sheet['h9'].value.strip().lower() == "pass")
|
|
366
|
-
vi_defects = []
|
|
367
|
-
if vi_pass:
|
|
368
|
-
if vi_result and len(vi_result):
|
|
369
|
-
if vi_text and len(vi_text):
|
|
370
|
-
vi_text = vi_result + '\n' + vi_text
|
|
371
|
-
else:
|
|
372
|
-
vi_text = vi_result
|
|
373
|
-
|
|
374
|
-
else:
|
|
375
|
-
vi_defects.append({"name": "PETAL_VI_DEFECT", "description": vi_result})
|
|
376
|
-
|
|
377
|
-
vi_test = create_visual_inpection(session, SN, test_date, operator, vi_pass,
|
|
378
|
-
comments=get_comments(vi_text))
|
|
379
|
-
for df in vi_defects:
|
|
380
|
-
vi_test["defects"].append(df)
|
|
381
|
-
|
|
382
|
-
#
|
|
383
|
-
# Delamination test
|
|
384
|
-
dl_text = get_text(sheet['i10'])
|
|
385
|
-
dl_result = get_text(sheet['g10'])
|
|
386
|
-
dl_pass = (sheet['h10'].value.strip().lower() == "pass")
|
|
387
|
-
dl_defects = []
|
|
388
|
-
if dl_pass:
|
|
389
|
-
if dl_result and len(dl_result):
|
|
390
|
-
if dl_text and len(dl_text):
|
|
391
|
-
dl_text = dl_result + '\n' + dl_text
|
|
392
|
-
else:
|
|
393
|
-
dl_text = dl_result
|
|
394
|
-
|
|
395
|
-
else:
|
|
396
|
-
dl_defects.append({"name": "PETAL_DL_DEFECT",
|
|
397
|
-
"description": dl_result})
|
|
398
|
-
|
|
399
|
-
delamination_test = create_delamination_test(session, SN, test_date, operator, dl_pass,
|
|
400
|
-
comments=get_comments(dl_text))
|
|
401
|
-
for df in dl_defects:
|
|
402
|
-
delamination_test["defects"].append(df)
|
|
403
|
-
|
|
404
|
-
#
|
|
405
|
-
# Conductivity
|
|
406
|
-
# TODO: read proper rows
|
|
407
|
-
grounding_test = create_grounding_test(session, SN, test_date, operator)
|
|
408
|
-
cond_val, cond_pass = get_res_and_accep(sheet, tests.index("COND"))
|
|
409
|
-
if "INS_LOOP" in tests:
|
|
410
|
-
loop_val, loop_pass = get_res_and_accep(sheet, tests.index("INS_LOOP"))
|
|
411
|
-
else:
|
|
412
|
-
loop_val, loop_pass = get_res_and_accep(sheet, tests.index("INS"))
|
|
413
|
-
|
|
414
|
-
if "INS_LOOP_GND" in tests:
|
|
415
|
-
loop_gnd_val, loop_gnd_pass = get_res_and_accep(sheet, tests.index("INS_LOOP_GND"))
|
|
416
|
-
else:
|
|
417
|
-
loop_gnd_val, loop_gnd_pass = get_res_and_accep(sheet, tests.index("INS_FACE"))
|
|
418
|
-
|
|
419
|
-
grounding_test["results"]["RESISTANCE_FB"] = cond_val
|
|
420
|
-
grounding_test["results"]["RESISTANCE_PIPES"] = loop_val
|
|
421
|
-
grounding_test["results"]["RESISTANCE_PIPE_GND"] = loop_gnd_val
|
|
422
|
-
check_for_problems(sheet, grounding_test, [tests.index('COND'), tests.index("WEIGH")])
|
|
423
|
-
|
|
424
|
-
#
|
|
425
|
-
# Weight
|
|
426
|
-
petal_weight, weight_pass = get_res_and_accep(sheet, tests.index("WEIGH"))
|
|
427
|
-
|
|
428
|
-
#
|
|
429
|
-
# Metrology AVS
|
|
430
|
-
metrology_test = create_metrology_test(session, SN, test_date, operator)
|
|
431
|
-
metrology_test["results"]["LOCATOR1_DIAMETER"] = get_float(sheet['g{}'.format(tests.index("PL01_DIAM"))])
|
|
432
|
-
metrology_test["results"]["LOCATOR2_DIAMETER"] = get_float(sheet['g{}'.format(tests.index("PL02_DIAM"))])
|
|
433
|
-
metrology_test["results"]["LOCATOR3_DIAMETER"] = get_float(sheet['g{}'.format(tests.index("PL03_DIAM"))])
|
|
434
|
-
metrology_test["results"]["LOCATOR2_X"] = get_float(sheet['g{}'.format(find_idx(tests, "PL02_X")[0])])
|
|
435
|
-
metrology_test["results"]["LOCATOR2_Y"] = get_float(sheet['g{}'.format(find_idx(tests, "PL02_Y")[0])])
|
|
436
|
-
metrology_test["results"]["LOCATOR3_X"] = get_float(sheet['g{}'.format(find_idx(tests, "PL03_X")[0])])
|
|
437
|
-
metrology_test["results"]["LOCATOR3_Y"] = get_float(sheet['g{}'.format(find_idx(tests, "PL03_Y")[0])])
|
|
438
|
-
metrology_test["results"]["FIDUCIAL1_DIAMETER"] = get_float(sheet["g{}".format(find_idx(tests, "FD01_DIAM")[0])])
|
|
439
|
-
metrology_test["results"]["FIDUCIAL1_X"] = get_float(sheet["g{}".format(find_idx(tests, "FD01_X")[0])])
|
|
440
|
-
metrology_test["results"]["FIDUCIAL1_Y"] = get_float(sheet["g{}".format(find_idx(tests, "FD01_Y")[0])])
|
|
441
|
-
metrology_test["results"]["FIDUCIAL2_DIAMETER"] = get_float(sheet["g{}".format(find_idx(tests, "FD02_DIAM")[0])])
|
|
442
|
-
metrology_test["results"]["FIDUCIAL2_X"] = get_float(sheet["g{}".format(find_idx(tests, "FD02_X")[0])])
|
|
443
|
-
metrology_test["results"]["FIDUCIAL2_Y"] = get_float(sheet["g{}".format(find_idx(tests, "FD02_Y")[0])])
|
|
444
|
-
metrology_test["results"]["ANGLE_VCHANNEL"] = get_float(sheet["g{}".format(find_idx(tests, "VANGL")[0])])
|
|
445
|
-
metrology_test["results"]["ENVELOPE"] = get_float(sheet["g{}".format(find_idx(tests, "ENVEL")[0])])
|
|
446
|
-
metrology_test["results"]["COPLANARITY_FRONT"] = get_float(sheet["g{}".format(find_idx(tests, "F/PL_PLAN")[0])])
|
|
447
|
-
metrology_test["results"]["LOCAL_FLATNESS_FRONT"] = get_float(sheet["g{}".format(find_idx(tests, "F/FS_PLAN")[0])], '/')
|
|
448
|
-
metrology_test["results"]["PARALLELISM_FRONT"] = get_float(sheet["g{}".format(find_idx(tests, "F/PARAL")[0])])
|
|
449
|
-
metrology_test["results"]["COPLANARITY_BACK"] = get_float(sheet["g{}".format(find_idx(tests, "B/PL_PLAN")[0])])
|
|
450
|
-
metrology_test["results"]["LOCAL_FLATNESS_BACK"] = get_float(sheet["g{}".format(find_idx(tests, "B/FS_PLAN")[0])], '/')
|
|
451
|
-
metrology_test["results"]["PARALLELISM_BACK"] = get_float(sheet["g{}".format(find_idx(tests, "B/PARAL")[0])])
|
|
452
|
-
|
|
453
|
-
# Get defects
|
|
454
|
-
check_for_problems(sheet, metrology_test, [tests.index("WEIGH")+1, sheet.max_row])
|
|
455
|
-
|
|
456
|
-
return vi_test, delamination_test, grounding_test, metrology_test, batch, petal_weight
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
def readProductionSheet(session, fnam, SN):
|
|
460
|
-
"""Read data fro AVS PS.
|
|
461
|
-
|
|
462
|
-
Args:
|
|
463
|
-
----
|
|
464
|
-
session: the DB session
|
|
465
|
-
fnam: path of input file
|
|
466
|
-
SN: The serial number
|
|
467
|
-
write_json: if true, test json is writen to file.
|
|
468
|
-
|
|
469
|
-
"""
|
|
470
|
-
try:
|
|
471
|
-
wb = XL.load_workbook(fnam)
|
|
472
|
-
except InvalidFileException as ee:
|
|
473
|
-
print("Could not open input file: ", fnam)
|
|
474
|
-
print(ee.message)
|
|
475
|
-
return None
|
|
476
|
-
|
|
477
|
-
# Assume active sheet is the good one, otherwise will have tofind in wb.sheetnames
|
|
478
|
-
sheet = wb.active
|
|
479
|
-
if sheet.max_row > 30 or sheet.max_column > 8:
|
|
480
|
-
raise AVSDataException("Wrong PS file")
|
|
481
|
-
|
|
482
|
-
ID = sheet['c12'].value.strip()
|
|
483
|
-
SN = get_coreID(ID)
|
|
484
|
-
mould_id = sheet['b9'].value
|
|
485
|
-
txt = list(map(str.strip, sheet['f4'].value.split(':')))[1]
|
|
486
|
-
try:
|
|
487
|
-
test_date = dateutil.parser.parse(txt)
|
|
488
|
-
except Exception:
|
|
489
|
-
test_date = ITkDButils.get_db_date(sheet['e8'].value)
|
|
490
|
-
|
|
491
|
-
manager = sheet['e7'].value
|
|
492
|
-
|
|
493
|
-
# Manufacturing
|
|
494
|
-
comments = get_comments(sheet['a25'].value)
|
|
495
|
-
manufacturing = create_manufacturing(session, SN, test_date, manager, comments=comments)
|
|
496
|
-
manufacturing['properties']['START_DATE'] = ITkDButils.get_db_date(sheet['e8'].value)
|
|
497
|
-
manufacturing['properties']['FINISH_DATE'] = ITkDButils.get_db_date(sheet['e9'].value)
|
|
498
|
-
manufacturing["properties"]["MOULD_ID"] = mould_id
|
|
499
|
-
manufacturing["properties"]["PROCESS_DOCUMENT"] = sheet['e6'].value
|
|
500
|
-
manufacturing["results"]["LOCATOR_A"] = sheet['c14'].value
|
|
501
|
-
manufacturing["results"]["LOCATOR_B"] = sheet['c15'].value
|
|
502
|
-
manufacturing["results"]["LOCATOR_C"] = sheet['c16'].value
|
|
503
|
-
manufacturing["results"]["HONEYCOMBSET"] = split_comp_list(sheet['c17'].value)
|
|
504
|
-
manufacturing["results"]["EPOXY_ADHESIVE"] = split_comp_list(sheet['c20'].value)
|
|
505
|
-
manufacturing["results"]["EPOXY_PUTTY"] = split_comp_list(sheet['c21'].value)
|
|
506
|
-
manufacturing["results"]["EPOXY_CONDUCTIVE"] = split_comp_list(sheet['c22'].value)
|
|
507
|
-
|
|
508
|
-
# Weighing
|
|
509
|
-
weighing = create_weight(session, SN, test_date, manager)
|
|
510
|
-
comp_weight = [get_float(x[0]) for x in sheet['d12:d22']]
|
|
511
|
-
petal_weight = np.sum([float(x) for x in comp_weight])
|
|
512
|
-
weighing["results"]["WEIGHT_FACING_FRONT"] = comp_weight[0]
|
|
513
|
-
weighing["results"]["WEIGHT_FACING_BACK"] = comp_weight[1]
|
|
514
|
-
weighing["results"]["WEIGHT_LOCATOR_A"] = comp_weight[2]
|
|
515
|
-
weighing["results"]["WEIGHT_LOCATOR_B"] = comp_weight[3]
|
|
516
|
-
weighing["results"]["WEIGHT_LOCATOR_C"] = comp_weight[4]
|
|
517
|
-
weighing["results"]["WEIGHT_COOLINGLOOPASSEMBLY"] = comp_weight[6]
|
|
518
|
-
weighing["results"]["WEIGHT_HONEYCOMBSET"] = comp_weight[5]
|
|
519
|
-
weighing["results"]["WEIGHT_EPOXYADHESIVE"] = comp_weight[8]
|
|
520
|
-
weighing["results"]["WEIGHT_EPOXYPUTTY"] = comp_weight[9]
|
|
521
|
-
weighing["results"]["WEIGHT_EPOXYCONDUCTIVE"] = comp_weight[10]
|
|
522
|
-
weighing["results"]["WEIGHT_CORE"] = petal_weight
|
|
523
|
-
|
|
524
|
-
# Comments
|
|
525
|
-
for i in range(12, 23):
|
|
526
|
-
cell_id = sheet['B{}'.format(i)].value
|
|
527
|
-
comment = sheet['E{}'.format(i)].value
|
|
528
|
-
if comment is not None:
|
|
529
|
-
comment = comment.strip()
|
|
530
|
-
msg = "{}: {}".format(cell_id, comment)
|
|
531
|
-
weighing["comments"].append(msg)
|
|
532
|
-
|
|
533
|
-
DESY = {
|
|
534
|
-
"FacingFront": sheet['c12'].value.strip(),
|
|
535
|
-
"FacingBack": sheet['c13'].value.strip(),
|
|
536
|
-
"CoolingLoop": str(sheet['c18'].value),
|
|
537
|
-
"AllcompSet": sheet['c19'].value,
|
|
538
|
-
"HoneyCombSet": manufacturing["results"]["HONEYCOMBSET"]
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
return manufacturing, weighing, DESY
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
if __name__ == "__main__":
|
|
545
|
-
parser = ArgumentParser()
|
|
546
|
-
parser.add_argument('files', nargs='*', help="Input files")
|
|
547
|
-
parser.add_argument("--SN", dest="SN", type=str, default="SNnnn",
|
|
548
|
-
help="Module serial number")
|
|
549
|
-
|
|
550
|
-
options = parser.parse_args()
|
|
551
|
-
if len(options.files) == 0:
|
|
552
|
-
print("I need an input file")
|
|
553
|
-
sys.exit()
|
|
554
|
-
|
|
555
|
-
dlg = ITkDBlogin.ITkDBlogin()
|
|
556
|
-
client = dlg.get_client()
|
|
557
|
-
if client is None:
|
|
558
|
-
print("Could not connect to DB with provided credentials.")
|
|
559
|
-
dlg.die()
|
|
560
|
-
sys.exit()
|
|
561
|
-
|
|
562
|
-
fnam = Path(options.files[0]).expanduser().resolve()
|
|
563
|
-
# readProductionSheet(fnam, options.SN)
|
|
564
|
-
readFATfile(client, fnam, options.SN)
|
|
565
|
-
dlg.die()
|