petal-qc 0.0.16__tar.gz → 0.0.18__tar.gz

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.

Potentially problematic release.


This version of petal-qc might be problematic. Click here for more details.

Files changed (84) hide show
  1. {petal_qc-0.0.16 → petal_qc-0.0.18}/PKG-INFO +2 -2
  2. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/BTreport/CheckBTtests.py +92 -33
  3. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/BTreport/bustapeReport.py +2 -1
  4. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/__init__.py +2 -2
  5. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/getPetalCoreTestSummary.py +14 -14
  6. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/convert_mitutoyo.py +5 -0
  7. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/do_Metrology.py +1 -1
  8. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/uploadPetalInformation.py +3 -3
  9. petal_qc-0.0.18/petal_qc/test/checkCoreShipments.py +57 -0
  10. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/getAVStests.py +13 -3
  11. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/test_Graphana.py +2 -1
  12. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/IRPetalParam.py +2 -0
  13. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/PipeFit.py +48 -19
  14. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/analyze_IRCore.py +34 -24
  15. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/contours.py +18 -12
  16. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/create_IRCore.py +40 -9
  17. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/create_core_report.py +8 -5
  18. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/utils/docx_utils.py +18 -6
  19. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc.egg-info/PKG-INFO +2 -2
  20. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc.egg-info/SOURCES.txt +1 -0
  21. {petal_qc-0.0.16 → petal_qc-0.0.18}/pyproject.toml +1 -1
  22. {petal_qc-0.0.16 → petal_qc-0.0.18}/README.md +0 -0
  23. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/BTreport/__init__.py +0 -0
  24. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/PetalReceptionTests.py +0 -0
  25. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/dashBoard.py +0 -0
  26. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/Cluster.py +0 -0
  27. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/DataFile.py +0 -0
  28. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/PetalMetrology.py +0 -0
  29. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/__init__.py +0 -0
  30. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/all2csv.py +0 -0
  31. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/analyze_locking_points.py +0 -0
  32. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/cold_noise.py +0 -0
  33. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/compare_Cores.py +0 -0
  34. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/comparisonTable.py +0 -0
  35. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/convert_smartscope.py +0 -0
  36. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/coreMetrology.py +0 -0
  37. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/data2csv.py +0 -0
  38. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/flatness4nigel.py +0 -0
  39. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/gtkutils.py +0 -0
  40. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/petal_flatness.py +0 -0
  41. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/readAVSdata.py +0 -0
  42. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/show_data_file.py +0 -0
  43. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/testSummary.py +0 -0
  44. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/metrology/test_paralelism.py +0 -0
  45. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/analyzeMetrologyTable.py +0 -0
  46. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/checkAVStests.py +0 -0
  47. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/compare_golden.py +0 -0
  48. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/createMetrologyFile.py +0 -0
  49. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/createMetrologyTable.py +0 -0
  50. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/desyModuleBow.py +0 -0
  51. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/findRawData.py +0 -0
  52. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/getAVSjson.py +0 -0
  53. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/listPetalCoreComponents.py +0 -0
  54. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/prepareDESYfiles.py +0 -0
  55. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/reportFromJSon.py +0 -0
  56. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/test/test_coreThermal.py +0 -0
  57. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/CSVImage.py +0 -0
  58. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/DESYdata.py +0 -0
  59. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/DebugPlot.py +0 -0
  60. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/IRBFile.py +0 -0
  61. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/IRCore.py +0 -0
  62. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/IRDataGetter.py +0 -0
  63. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/IRPetal.py +0 -0
  64. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/PetalColorMaps.py +0 -0
  65. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/Petal_IR_Analysis.py +0 -0
  66. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/__init__.py +0 -0
  67. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/coreThermal.py +0 -0
  68. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/pipe_back.npz +0 -0
  69. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/pipe_front.npz +0 -0
  70. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/pipe_read.py +0 -0
  71. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/thermal/show_IR_petal.py +0 -0
  72. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/utils/ArgParserUtils.py +0 -0
  73. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/utils/Geometry.py +0 -0
  74. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/utils/Progress.py +0 -0
  75. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/utils/__init__.py +0 -0
  76. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/utils/all_files.py +0 -0
  77. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/utils/fit_utils.py +0 -0
  78. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/utils/readGraphana.py +0 -0
  79. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc/utils/utils.py +0 -0
  80. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc.egg-info/dependency_links.txt +0 -0
  81. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc.egg-info/entry_points.txt +0 -0
  82. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc.egg-info/requires.txt +0 -0
  83. {petal_qc-0.0.16 → petal_qc-0.0.18}/petal_qc.egg-info/top_level.txt +0 -0
  84. {petal_qc-0.0.16 → petal_qc-0.0.18}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: petal_qc
3
- Version: 0.0.16
3
+ Version: 0.0.18
4
4
  Summary: A collection of scripts for Petal CORE QC.
5
5
  Author-email: Carlos Lacasta <carlos.lacasta@cern.ch>
6
6
  Project-URL: Homepage, https://gitlab.cern.ch/atlas-itk/sw/db/itk-pdb-gtk-gui-utils
@@ -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
- complain_func(SerialN, "Could not find petal core.")
161
- return None
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
- try:
260
- SN = sys.argv[1]
261
- except IndexError:
262
- print("I need a petal core SN or AlternativeID")
263
- sys.exit()
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
- except Exception:
289
- print(traceback.format_exc())
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, child_sn, cstage]
160
+ values = [btype, bt_sn, cstage]
160
161
 
161
162
  self.outDB = CheckBTtests.BTreport(self.session, SN, complain_func=dbGtkUtils.complain)
162
163
 
@@ -1,5 +1,5 @@
1
1
  """petal_qc python module."""
2
- __version__ = "0.0.16"
2
+ __version__ = "0.0.18"
3
3
 
4
4
 
5
5
  def coreMetrology():
@@ -23,7 +23,7 @@ def coreThermal():
23
23
  main()
24
24
 
25
25
  def bustapeReport():
26
- """Launches the Core metrology analysis ahd PDB script."""
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()
@@ -9,7 +9,7 @@ from argparse import ArgumentParser
9
9
  from pathlib import Path
10
10
  try:
11
11
  import itkdb_gtk
12
-
12
+
13
13
  except ImportError:
14
14
  cwd = Path(__file__).parent.parent
15
15
  sys.path.append(cwd.as_posix())
@@ -40,31 +40,31 @@ def petalCoreTest(session, options):
40
40
  if options.institute:
41
41
  payload["filterMap"]["currentLocation"] = options.institute
42
42
  suff = options.institute
43
-
43
+
44
44
  core_list = session.get("listComponents", json=payload)
45
45
  core_tests = ["PETAL_METROLOGY_FRONT", "PETAL_METROLOGY_BACK", "XRAYIMAGING", "THERMAL_EVALUATION", "BTTESTING"]
46
-
46
+
47
47
  do_check_stage = "AT_QC_SITE"
48
48
  #do_check_stage = None
49
49
  petal_id_db = {}
50
-
50
+
51
51
  has_list = len(options.cores) != 0
52
-
52
+
53
53
  for core in core_list:
54
54
  SN = core["serialNumber"]
55
55
  altid = core['alternativeIdentifier']
56
56
  if "PPC" not in altid:
57
57
  continue
58
-
58
+
59
59
  R = r_petal_id.search(altid)
60
60
  if R is None:
61
61
  continue
62
62
 
63
63
  pid = int(R.group(1))
64
-
64
+
65
65
  if has_list and pid not in options.cores:
66
66
  continue
67
-
67
+
68
68
  petal_id_db[altid] = SN
69
69
  location = core["currentLocation"]['code']
70
70
  coreStage = core["currentStage"]['code']
@@ -88,11 +88,11 @@ def petalCoreTest(session, options):
88
88
  T = session.get("getTestRun", json={"testRun": tst["id"]})
89
89
  if T["state"] != "ready":
90
90
  print(T)
91
-
91
+
92
92
  print("-- {} [{}]".format(T["testType"]["name"], T["runNumber"]))
93
93
  if not T["passed"]:
94
94
  print("\t## test FAILED")
95
-
95
+
96
96
  for D in T["defects"]:
97
97
  print("\t{} - {}".format(D["name"], D["description"]))
98
98
 
@@ -106,7 +106,7 @@ def main():
106
106
  parser.add_argument("--cores", dest="cores", action=RangeListAction, default=[],
107
107
  help="Create list of cores to analyze. The list is made with numbers or ranges (ch1:ch2 or ch1:ch2:step) ")
108
108
  options = parser.parse_args()
109
-
109
+
110
110
  # ITk_PB authentication
111
111
  dlg = ITkDBlogin.ITkDBlogin()
112
112
  session = dlg.get_client()
@@ -118,7 +118,7 @@ def main():
118
118
  print(E)
119
119
 
120
120
  dlg.die()
121
-
122
- if __name__ == "__main__":
123
- main()
124
121
 
122
+ if __name__ == "__main__":
123
+ main()
124
+
@@ -111,6 +111,11 @@ def mitutoyo2cvs(infiles, ofile, label='\\w+', data_type="Punto", keep=False, fi
111
111
  while len(line_data) < fill:
112
112
  line_data.append(0.0)
113
113
 
114
+ else:
115
+ if len(line_data)<3:
116
+ print("Warning: less than three data points: {}".format(','.join([str(v) for v in line_data])))
117
+ continue
118
+
114
119
  slin = ','.join([str(v) for v in line_data])
115
120
  fout.write(slin)
116
121
  if keep:
@@ -56,7 +56,7 @@ def do_analysis(fnam, prefix, SN, options):
56
56
  def analyze_files(ifile, options):
57
57
  """Main entry."""
58
58
  failed_files = []
59
- with open(ifile, 'r', encoding='UTF-8') as inp:
59
+ with open(ifile, 'r', encoding='ISO-8859-1') as inp:
60
60
 
61
61
  for line in inp:
62
62
  line = line.strip()
@@ -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 itkdb_gtk
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.
@@ -0,0 +1,57 @@
1
+ """List shipments."""
2
+ import sys
3
+ from pathlib import Path
4
+ import numpy as np
5
+
6
+ from itkdb_gtk import ITkDBlogin, ITkDButils
7
+
8
+
9
+ def main(session):
10
+ """List shipments from AVS to CERN and IFIC containing CORES."""
11
+
12
+ payload = {
13
+ "filterMap": {
14
+ "sender": "AVS",
15
+ "recipient": ["CERN", "IFIC"],
16
+ "status": "delivered"
17
+ }
18
+ }
19
+ shpmts = session.get("listShipmentsByInstitution", json=payload)
20
+ for s in shpmts:
21
+ items = session.get("listShipmentItems", json={"shipment": s["id"]})
22
+ cores = []
23
+ for it in items:
24
+ if it["component"]["componentType"]['code'] == "CORE_PETAL":
25
+ if "PPC." in it["component"]["alternativeIdentifier"]:
26
+ cores.append(it["component"]["alternativeIdentifier"])
27
+
28
+ if len(cores) == 0:
29
+ continue
30
+
31
+ print("Shipment {}".format(s["name"]))
32
+ print("AVS -> {}".format(s["recipient"]["code"]))
33
+ print(":> {}".format(s["sentTs"]))
34
+ for c in cores:
35
+ print("\t{}".format(c))
36
+
37
+ print("\n")
38
+
39
+ if __name__ == "__main__":
40
+ # ITk_PB authentication
41
+ dlg = ITkDBlogin.ITkDBlogin()
42
+ client = dlg.get_client()
43
+
44
+ try:
45
+ main(client)
46
+ # the_test = analyze_avs_metrology(client, "20USEBC1000124", "PPC.015")
47
+ #rc = ITkDButils.upload_test(client, the_test, check_runNumber=True)
48
+ #if rc:
49
+ # print(rc)
50
+
51
+ except Exception as E:
52
+ print(E)
53
+
54
+ dlg.die()
55
+
56
+
57
+
@@ -4,6 +4,7 @@ import sys
4
4
  from pathlib import Path
5
5
  import numpy as np
6
6
  import matplotlib.pyplot as plt
7
+ from argparse import ArgumentParser
7
8
 
8
9
  try:
9
10
  import petal_qc
@@ -14,7 +15,7 @@ except ImportError:
14
15
 
15
16
  from itkdb_gtk import ITkDBlogin
16
17
  import petal_qc.utils.docx_utils as docx_utils
17
-
18
+ from petal_qc.utils.ArgParserUtils import RangeListAction
18
19
 
19
20
 
20
21
  def get_value(results, code):
@@ -171,7 +172,7 @@ def plot_weighing(weights, tick_labels, document, show_total=False):
171
172
  ax.legend(loc="upper left", ncol=4)
172
173
 
173
174
 
174
- def main(session):
175
+ def main(session, options):
175
176
  """Entry point"""
176
177
  # find all cores
177
178
  # Now all the objects
@@ -206,6 +207,10 @@ def main(session):
206
207
  altid = core['alternativeIdentifier']
207
208
  if "PPC" not in altid:
208
209
  continue
210
+
211
+ pID = int(altid[4:])
212
+ if len(options.cores)>0 and pID not in options.cores:
213
+ continue
209
214
 
210
215
  petal_ids.append(altid)
211
216
  location = core["currentLocation"]['code']
@@ -314,9 +319,14 @@ def main(session):
314
319
 
315
320
  if __name__ == "__main__":
316
321
  # ITk_PB authentication
322
+ parser = ArgumentParser()
323
+ parser.add_argument("--cores", dest="cores", action=RangeListAction, default=[],
324
+ help="Create list of cores to analyze. The list is made with numbers or ranges (ch1:ch2 or ch1:ch2:step) ")
325
+
326
+
317
327
  dlg = ITkDBlogin.ITkDBlogin()
318
328
  session = dlg.get_client()
319
329
 
320
- main(session)
330
+ main(session, options)
321
331
 
322
332
  dlg.die()
@@ -19,7 +19,8 @@ from petal_qc.thermal import IRBFile
19
19
 
20
20
 
21
21
  options = IRPetalParam()
22
- options.files = [Path("~/tmp/thermal/PPC.008.irb").expanduser().resolve()]
22
+ options.institute = "IFIC"
23
+ options.files = [Path("~/tmp/thermal/IFIC-thermal/IRB_files/PPC.008.irb").expanduser().resolve()]
23
24
  getter = IRDataGetter.factory(options.institute, options)
24
25
  DB = ReadGraphana("localhost")
25
26
  irbf = IRBFile.open_file(options.files)
@@ -27,6 +27,7 @@ class IRPetalParam(object):
27
27
  self.rotate = True # Rotate to have a vertical petal in mirror image
28
28
  self.debug = False # To debug
29
29
  self.report = False #
30
+ self.graphana = None # Graphana server
30
31
 
31
32
  if values is not None:
32
33
  self.set_values(values)
@@ -61,6 +62,7 @@ class IRPetalParam(object):
61
62
  help="Either IFIC or DESY to treat the different files")
62
63
  parser.add_argument("--thrs", type=float, default=P.thrs, help="Temperature threshold")
63
64
  parser.add_argument("--tco2", type=float, default=P.tco2, help="CO2 Inlet temperature")
65
+ parser.add_argument("--graphana", type=str, default=None, help="Graphana server.")
64
66
  parser.add_argument("--gauss_size", type=int, default=P.gauss_size, help="Radius of gausian filtering")
65
67
  parser.add_argument("--distance", type=float, default=P.distance, help="Distance in contour beteween slices")
66
68
  parser.add_argument("--npoints", type=int, default=P.npoints, help="Number of points per segment")