petal-qc 0.0.19__py3-none-any.whl → 0.0.20__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.

Potentially problematic release.


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

petal_qc/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  """petal_qc python module."""
2
- __version__ = "0.0.19"
2
+ __version__ = "0.0.20"
3
3
 
4
4
 
5
5
  def coreMetrology():
@@ -24,10 +24,10 @@ from petal_qc.utils.Geometry import fit_plane
24
24
  from petal_qc.utils.Geometry import flatness_conhull, flatness_LSPL
25
25
  from petal_qc.utils.Geometry import project_to_plane
26
26
 
27
- from .analyze_locking_points import analyze_locking_point_data, locking_point_positions
28
- from .analyze_locking_points import remove_outliers
29
- from .Cluster import cluster_points
30
- from .show_data_file import show_data, TOP_VIEW
27
+ from petal_qc.metrology.analyze_locking_points import analyze_locking_point_data, locking_point_positions
28
+ from petal_qc.metrology.analyze_locking_points import remove_outliers
29
+ from petal_qc.metrology.Cluster import cluster_points
30
+ from petal_qc.metrology.show_data_file import show_data, TOP_VIEW
31
31
 
32
32
  figure_width = 14
33
33
 
@@ -132,7 +132,7 @@ def petal_flatness(orig_data, options, document=None):
132
132
 
133
133
  # group points by sensors.
134
134
  sensor_dict = {0: "R0", 10: "R1", 20: "R2", 30: "R3_0", 31: "R3_1", 40: "R4_0", 41: "R4_1", 50: "R5_0", 51: "R5_1"}
135
- sensors, *_ = group_by_sensors(M, options.is_front, False)
135
+ sensors, *_ = group_by_sensors(M, options.is_front, True)
136
136
  all_data = np.vstack(list(sensors.values()))
137
137
 
138
138
  fig = show_data(all_data, "All points in core", view=TOP_VIEW, surf=False)
@@ -257,7 +257,7 @@ def get_iring(P, is_front):
257
257
  return -1
258
258
 
259
259
 
260
- def group_by_sensors(Min, is_front=True, remove_outliers=False):
260
+ def group_by_sensors(Min, is_front=True, no_outliers=False):
261
261
  """Groups data points by sensors."""
262
262
  # Now move in Y to be on the ATLAS reference
263
263
  M = np.array(Min)
@@ -275,10 +275,11 @@ def group_by_sensors(Min, is_front=True, remove_outliers=False):
275
275
  else:
276
276
  sensors.setdefault(iring, []).append(P)
277
277
 
278
- if remove_outliers:
278
+ if no_outliers:
279
279
  for key, val in sensors.items():
280
- if remove_outliers:
281
- sensors[key] = remove_outliers(sensors[key][:, 2], 0.075)
280
+ points = np.vstack(val)
281
+ indx = remove_outliers(points[:, 2])
282
+ sensors[key] = points[indx, :]
282
283
 
283
284
  return sensors, np.array(other)
284
285
 
@@ -6,23 +6,47 @@ from pathlib import Path
6
6
  import json
7
7
 
8
8
 
9
+ try:
10
+ import petal_qc
11
+
12
+ except ImportError:
13
+ cwd = Path(__file__).parent.parent
14
+ sys.path.append(cwd.as_posix())
15
+
16
+ from petal_qc.utils.ArgParserUtils import RangeListAction
17
+ from petal_qc.utils.all_files import all_files
18
+
19
+
9
20
 
10
21
  def main(options):
11
22
  """main entry."""
12
23
  petal_cores = {}
13
- for fnam in options.files:
14
- ifile = Path(fnam).expanduser().resolve()
15
- with open(ifile, "r", encoding="utf-8") as fin:
24
+ for fpath in options.files:
25
+ fnam = str(fpath)
26
+ if "PPC." not in fnam:
27
+ continue
28
+
29
+ ipos = fnam.find("PPC")
30
+ lpos = fnam[ipos:].find("-")
31
+ petal_id = fnam[ipos:ipos+lpos]
32
+ pid = int(petal_id[4:])
33
+
34
+ if len(options.cores)>0 and pid not in options.cores:
35
+ continue
36
+
37
+ with open(fpath, "r", encoding="utf-8") as fin:
16
38
  data = json.load(fin)
17
39
 
18
40
  if not data["passed"]:
19
41
  petalId = data["component"]
20
- if petalId not in petal_cores:
21
- petal_cores[petalId] = {"FRONT": [], "BACK": []}
42
+ if petalId is None:
43
+ print("Petal {} has bad Serial number".format(petal_id))
44
+ if petal_id not in petal_cores:
45
+ petal_cores[petal_id] = {"FRONT": [], "BACK": []}
22
46
 
23
47
  side = "FRONT" if "FRONT" in data["testType"] else "BACK"
24
48
  for D in data["defects"]:
25
- petal_cores[petalId][side].append("{}: {}".format(D["name"], D["description"]))
49
+ petal_cores[petal_id][side].append("{}: {}".format(D["name"], D["description"]))
26
50
 
27
51
 
28
52
  keys = sorted(petal_cores.keys())
@@ -40,12 +64,15 @@ def main(options):
40
64
  if __name__ == "__main__":
41
65
  parser = argparse.ArgumentParser()
42
66
  parser.add_argument('files', nargs='*', help="Input files")
67
+ parser.add_argument("--cores", dest="cores", action=RangeListAction, default=[],
68
+ help="Create list of cores to analyze. The list is made with numbers or ranges (ch1:ch2 or ch1:ch2:step) ")
43
69
  opts = parser.parse_args()
44
70
 
45
- from petal_qc.utils.all_files import all_files
46
71
 
72
+ folder = Path("/tmp/petal-metrology/results")
73
+ # folder = Path("~/tmp/petal-metrology/Production/Results").expanduser()
47
74
  opts.files = []
48
- for fnam in all_files(Path("~/tmp/petal-metrology/Production/Results").expanduser(), "*.json"):
75
+ for fnam in all_files(folder, "*.json"):
49
76
  opts.files.append(fnam)
50
77
 
51
78
  main(opts)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: petal_qc
3
- Version: 0.0.19
3
+ Version: 0.0.20
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
@@ -1,5 +1,5 @@
1
1
  petal_qc/PetalReceptionTests.py,sha256=cSrq4PUjdV7T16ARonhsnXWPBBRuvliTKlZwEPfgRVY,10832
2
- petal_qc/__init__.py,sha256=lyJtmxO016y5gjORoAZhL6k14_G8Q_sAFhTvxOZYrsc,1595
2
+ petal_qc/__init__.py,sha256=wWhkImfHsRq6bdiB9KpR1wF1DsTymn7ydqz71fLtYWw,1595
3
3
  petal_qc/dashBoard.py,sha256=U_UHNMca3H2ogD4a0Vpe4ZVUKEv2-xmGZQEZ9_aH0E4,4034
4
4
  petal_qc/getPetalCoreTestSummary.py,sha256=hTv4A8gcEkvCZLcy9ZkpwOevksz6LfK1Rb1-4ENlC7I,3706
5
5
  petal_qc/BTreport/CheckBTtests.py,sha256=CoKTnW_7gbL42rVaBy9FnH1SEYifmgg1P5Iy253vDFk,9855
@@ -21,7 +21,7 @@ petal_qc/metrology/data2csv.py,sha256=2ttMSmfGLPIaOqZGima2dH6sdnSRAFTHlEbSOfW5eb
21
21
  petal_qc/metrology/do_Metrology.py,sha256=wA3fKJrdDLGYd0lEi8uSP9uRwQeS59nX6F4VtNnm9LM,4356
22
22
  petal_qc/metrology/flatness4nigel.py,sha256=SUHwn6pCEUWQV_62-_9-VKrmUdL4gVQcSA3aTtYq958,4071
23
23
  petal_qc/metrology/gtkutils.py,sha256=1pOTxiE2EZR9zNNNT5cOetga_4NG9DzLaqQPI4c1EzE,3372
24
- petal_qc/metrology/petal_flatness.py,sha256=KksOFO_ZrKM4nUDHRC-3mSm1tp5C7wkE_6f9ZiH9B70,10610
24
+ petal_qc/metrology/petal_flatness.py,sha256=f8UqAmwbSkOngFbwekeGq6cX5flSkd7JNhCYRIn39LE,10695
25
25
  petal_qc/metrology/readAVSdata.py,sha256=6GRUac9b3iOoVoGfWr6rsNj1smsw9aT0tu5wuNuumAE,25615
26
26
  petal_qc/metrology/show_data_file.py,sha256=yZPcmMy-1EWWySiBBx0hNB3tPVh19bTr0PDaXSyIF4c,4057
27
27
  petal_qc/metrology/testSummary.py,sha256=0BhcEd1BPz2Mbonzi8nyZOzNSzpUqowBFNl5cVutqsk,994
@@ -39,7 +39,7 @@ petal_qc/test/getAVSjson.py,sha256=o8AYtyr7Vnp-enznmQ-NNiivZipmxtoVrmsfnRCl0X4,9
39
39
  petal_qc/test/getAVStests.py,sha256=GNqEpncUQdvo-qSf46ltGVeezSnHB2BQsKjApS6xomY,10285
40
40
  petal_qc/test/listPetalCoreComponents.py,sha256=7U9wokRkgeZdYZKeZdAadA32BlhVK6okInuh94hmj24,2502
41
41
  petal_qc/test/prepareDESYfiles.py,sha256=uRir2fv0oGqB6hKnIqRltDW-oLz1tR2SDvVkMVxCfKI,4106
42
- petal_qc/test/reportFromJSon.py,sha256=3YTuWeeVtw5pITloLlwEYbx84f6k9XC_jTBK53I4mLM,1456
42
+ petal_qc/test/reportFromJSon.py,sha256=GHx4Jk5_DTGiaxUd98mdnuFePsCqrJ_v86ufF0_wCBs,2296
43
43
  petal_qc/test/test_Graphana.py,sha256=4wADxS_ObG9n4vsCvD1GwPQnx8bFUiUOS6ZwK83wTl8,1082
44
44
  petal_qc/test/test_coreThermal.py,sha256=YRPK3DGG7Tz66K4Kka3euXgUDzW_JlIqSYicMBhb96E,1516
45
45
  petal_qc/thermal/CSVImage.py,sha256=Vt2kYmUsZWkQvxcF8fDda3HO1Rb29kPQHnEoHFCqWYo,2038
@@ -72,8 +72,8 @@ petal_qc/utils/docx_utils.py,sha256=zVmSKHDVE8cUwbXxqyPtgS0z62VCFya1DWklOpO1rCQ,
72
72
  petal_qc/utils/fit_utils.py,sha256=3KUGWpBMV-bVDkQHWBigXot8chOpjAVBJ5H5b5dbdjk,5349
73
73
  petal_qc/utils/readGraphana.py,sha256=YVOztJC3q3P7F0I9Ggeiu6Mv9rZLKgj3clkLCU7k4i4,1918
74
74
  petal_qc/utils/utils.py,sha256=CqCsNIcEg6FQb3DN70tmqeLVLlQqsRfDzhfGevlnfBc,4035
75
- petal_qc-0.0.19.dist-info/METADATA,sha256=APlvpqVgGnSabKIK89z6KHFwbUZIWZi4mckoVETXxrc,953
76
- petal_qc-0.0.19.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
77
- petal_qc-0.0.19.dist-info/entry_points.txt,sha256=YPrZOsRBRsiKNDvsnbug0-Khj7DcN_Sdpq-tB_XjykI,505
78
- petal_qc-0.0.19.dist-info/top_level.txt,sha256=CCo1Xe6kLS79PruhsB6bk2CuL9VFtNdNpgJjYUs4jk4,9
79
- petal_qc-0.0.19.dist-info/RECORD,,
75
+ petal_qc-0.0.20.dist-info/METADATA,sha256=EHoZu8c1KUKkam4HCqJRmWP3cnu-AjydFTB4edKmmCI,953
76
+ petal_qc-0.0.20.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
77
+ petal_qc-0.0.20.dist-info/entry_points.txt,sha256=YPrZOsRBRsiKNDvsnbug0-Khj7DcN_Sdpq-tB_XjykI,505
78
+ petal_qc-0.0.20.dist-info/top_level.txt,sha256=CCo1Xe6kLS79PruhsB6bk2CuL9VFtNdNpgJjYUs4jk4,9
79
+ petal_qc-0.0.20.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.0.2)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5