petal-qc 0.0.3__tar.gz → 0.0.4__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 (66) hide show
  1. {petal_qc-0.0.3 → petal_qc-0.0.4}/PKG-INFO +1 -1
  2. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/__init__.py +1 -1
  3. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/PetalMetrology.py +3 -3
  4. petal_qc-0.0.4/petal_qc/metrology/compare_Cores.py +232 -0
  5. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/petal_flatness.py +7 -2
  6. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/IRDataGetter.py +5 -3
  7. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/IRPetal.py +1 -1
  8. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/coreThermal.py +2 -1
  9. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/create_IRCore.py +5 -3
  10. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc.egg-info/PKG-INFO +1 -1
  11. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc.egg-info/SOURCES.txt +2 -2
  12. {petal_qc-0.0.3 → petal_qc-0.0.4}/pyproject.toml +1 -1
  13. petal_qc-0.0.3/petal_qc/metrology/compare_Cores.py +0 -96
  14. {petal_qc-0.0.3 → petal_qc-0.0.4}/README.md +0 -0
  15. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/BTreport/CheckBTtests.py +0 -0
  16. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/BTreport/__init__.py +0 -0
  17. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/BTreport/bustapeReport.py +0 -0
  18. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/dashBoard.py +0 -0
  19. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/Cluster.py +0 -0
  20. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/DataFile.py +0 -0
  21. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/__init__.py +0 -0
  22. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/all2csv.py +0 -0
  23. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/analyze_locking_points.py +0 -0
  24. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/cold_noise.py +0 -0
  25. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/comparisonTable.py +0 -0
  26. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/convert_mitutoyo.py +0 -0
  27. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/convert_smartscope.py +0 -0
  28. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/coreMetrology.py +0 -0
  29. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/data2csv.py +0 -0
  30. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/do_Metrology.py +0 -0
  31. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/flatness4nigel.py +0 -0
  32. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/gtkutils.py +0 -0
  33. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/show_data_file.py +0 -0
  34. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/testSummary.py +0 -0
  35. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/metrology/test_paralelism.py +0 -0
  36. {petal_qc-0.0.3/petal_qc/thermal → petal_qc-0.0.4/petal_qc/test}/test_Graphana.py +0 -0
  37. {petal_qc-0.0.3/petal_qc/thermal → petal_qc-0.0.4/petal_qc/test}/test_coreThermal.py +0 -0
  38. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/CSVImage.py +0 -0
  39. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/DebugPlot.py +0 -0
  40. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/IRBFile.py +0 -0
  41. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/IRCore.py +0 -0
  42. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/IRPetalParam.py +0 -0
  43. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/PetalColorMaps.py +0 -0
  44. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/Petal_IR_Analysis.py +0 -0
  45. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/PipeFit.py +0 -0
  46. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/__init__.py +0 -0
  47. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/analyze_IRCore.py +0 -0
  48. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/contours.py +0 -0
  49. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/create_core_report.py +0 -0
  50. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/pipe_back.npz +0 -0
  51. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/pipe_front.npz +0 -0
  52. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/pipe_read.py +0 -0
  53. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/thermal/show_IR_petal.py +0 -0
  54. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/utils/Geometry.py +0 -0
  55. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/utils/Progress.py +0 -0
  56. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/utils/__init__.py +0 -0
  57. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/utils/all_files.py +0 -0
  58. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/utils/docx_utils.py +0 -0
  59. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/utils/fit_utils.py +0 -0
  60. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/utils/readGraphana.py +0 -0
  61. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc/utils/utils.py +0 -0
  62. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc.egg-info/dependency_links.txt +0 -0
  63. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc.egg-info/entry_points.txt +0 -0
  64. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc.egg-info/requires.txt +0 -0
  65. {petal_qc-0.0.3 → petal_qc-0.0.4}/petal_qc.egg-info/top_level.txt +0 -0
  66. {petal_qc-0.0.3 → petal_qc-0.0.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: petal_qc
3
- Version: 0.0.3
3
+ Version: 0.0.4
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 python module."""
2
- __version__ = "0.0.3"
2
+ __version__ = "0.0.4"
3
3
 
4
4
 
5
5
  def coreMetrology():
@@ -130,7 +130,7 @@ def petal_metrology(ifile, options):
130
130
  if options.desy:
131
131
  flatness_data = DataFile.read(ifile, "PetalPlane")
132
132
  else:
133
- flatness_data = DataFile.read(ifile, r"Punto[-|Vision-]\w", "Punto")
133
+ flatness_data = DataFile.read(ifile, r"Punto(-|(Vision-))\d", "Punto")
134
134
  Fmean = np.mean(flatness_data[:, 2])
135
135
  flatness_data[:, 2] -= Fmean
136
136
 
@@ -170,10 +170,10 @@ def petal_metrology(ifile, options):
170
170
  if key == "COPLANARITY_LOCATORS" and not check_spec(val, 0.1):
171
171
  dbOut["comments"].append(
172
172
  "Coplanarity of locators: {:.3f} mm".format(val))
173
- elif key == "PARALLELISM" and not check_spec(abs(val), 0.1):
173
+ elif key == "PARALLELISM" and not check_spec(abs(val), 0.2):
174
174
  dbOut["defects"].append({
175
175
  "name": key,
176
- "description": "Paralelism of locators is {:.3f} mm > 0.100 mm".format(val)
176
+ "description": "Paralelism of locators is {:.3f} mm > 0.200 mm".format(val)
177
177
  })
178
178
  elif key == "OFFSET" and not check_spec(abs(val), 0.100):
179
179
  dbOut["comments"].append("Offset of locator plane w.r.t BT is {:.3f} mm".format(val))
@@ -0,0 +1,232 @@
1
+ #!/usr/bin/env python3
2
+ """Compare quantities."""
3
+
4
+ import sys
5
+ import argparse
6
+ import glob
7
+ import json
8
+ from pathlib import Path
9
+ import numpy as np
10
+ import matplotlib.pyplot as plt
11
+
12
+
13
+ def get_value(data, value_path):
14
+ """Get the value from the path given."""
15
+ a = data
16
+ for k in value_path.split('/'):
17
+ a = a[k]
18
+
19
+ return a
20
+
21
+ def save_figure(fig, fnam, prefix=None, dpi=192):
22
+ """Saves the figure
23
+
24
+ Args:
25
+ fig (Figure): The figure to save
26
+ fnam (str): The name of the output file
27
+ dpi (int, optional): The Dots por Inch. Defaults to 300.
28
+ """
29
+ if fnam is not None:
30
+ if prefix:
31
+ P = Path(fnam).expanduser().resolve()
32
+ name = prefix + P.name
33
+ out = P.parent / name
34
+ fnam = out
35
+
36
+ print("out: {}".format(fnam))
37
+ fig.savefig(fnam, dpi=dpi)
38
+
39
+
40
+ def read_data_files(options):
41
+ """Read the data files.
42
+
43
+ It assumes the data file names are in the format:
44
+
45
+ <AlternativeID>-<side>.json
46
+
47
+ AlternativeID is PPC.nnn side is either front or back.
48
+
49
+ Returns the values for front and back petal tests.
50
+
51
+ The results are a dictionary with the file label as key and the requested
52
+ value, which can be a number of an array.
53
+
54
+ the file labels are also returned.
55
+
56
+ """
57
+ labels = []
58
+ front = {}
59
+ back = {}
60
+
61
+ for fnam in options.files:
62
+ ifile = Path(fnam).expanduser().resolve()
63
+ print(ifile.name)
64
+ if not ifile.exists():
65
+ print("File does not exist: ", fnam)
66
+ continue
67
+
68
+ data = None
69
+ with open(ifile, 'r', encoding="UTF-8") as fp:
70
+ data = json.load(fp)
71
+
72
+ if data is None:
73
+ print("Problems reading ", fnam)
74
+ continue
75
+
76
+ tmp = ifile.name.split('-')
77
+ label = tmp[0]
78
+ if not label in labels:
79
+ labels.append(label)
80
+
81
+ val = get_value(data, options.value)
82
+ if "front" in tmp[1].lower():
83
+ front[label] = val
84
+ else:
85
+ back[label] = val
86
+
87
+ labels.sort()
88
+
89
+ return front, back, labels
90
+
91
+ def draw_deltas(data, keys, fnam=None, title="Front"):
92
+ """Plot the position deltas."""
93
+ key_table = {"Bot.": "PL01", "Slot": "PL02", "Top": "PL03",
94
+ "Bot-FD01": "PL01-FD01", "Bot-FD02": "PL01-FD02", "FD01-FD02": "FD01-FD02" }
95
+ nfiles = len(data)
96
+
97
+ P = [np.zeros([nfiles, 2]),
98
+ np.zeros([nfiles, 2]),
99
+ np.zeros([nfiles, 2])]
100
+
101
+ fig_width = 12.0
102
+ fig_height = 1.2*fig_width/3.0
103
+ fig, ax = plt.subplots(nrows=1, ncols=3, tight_layout=True, figsize=(fig_width, fig_height))
104
+ fig.suptitle(title)
105
+ for i in range(3):
106
+ ax[i].set_title(keys[i])
107
+ ax[i].set_aspect('equal', adjustable='box')
108
+ ax[i].set_xlim(-100, 100)
109
+ ax[i].set_ylim(-100, 100)
110
+ circle = plt.Circle((0,0), 50, color="red", alpha=0.25)
111
+ ax[i].add_patch(circle)
112
+ circle = plt.Circle((0,0), 25, color="green", alpha=0.25)
113
+ ax[i].add_patch(circle)
114
+
115
+ ax[i].set_xlabel("X (µm)")
116
+ ax[i].set_ylabel("Y (µm)")
117
+ ax[i].grid()
118
+
119
+ for j, v in enumerate(data.items()):
120
+ label, values = v
121
+ for k in range(3):
122
+ ky = key_table[keys[k]]
123
+ P[k][j, :] = 1000*np.array(values[ky])
124
+
125
+ ax[i].scatter(P[i][:,0], P[i][:,1])
126
+
127
+ save_figure(fig, fnam, prefix=title)
128
+
129
+
130
+ def show_positions(options):
131
+ """Make position plots."""
132
+
133
+ if "LOCATION" in options.value:
134
+ keys = ["Bot.", "Slot", "Top"]
135
+ elif "REL_POS" in options.value:
136
+ keys = ["Bot-FD01", "Bot-FD02", "FD01-FD02"]
137
+ else:
138
+ print("Invalid value")
139
+ return
140
+
141
+ front, back, labels = read_data_files(options)
142
+ val_name = options.value.split('/')[-1]
143
+ draw_deltas(front, keys, fnam=options.out, title="{} - Front".format(val_name))
144
+ draw_deltas(back, keys, fnam=options.out, title="{} - Back".format(val_name))
145
+
146
+ plt.show()
147
+
148
+ def show_flatness(options):
149
+ """Show flatness plots."""
150
+ tick_labels = ["R0", "R1", "R2", "R3S0", "R3S1", "R4S0", "R4S1", "R5S0", "R5S1"]
151
+ cindx = ["Front", "Back"]
152
+
153
+ front, back, labels = read_data_files(options)
154
+ nfiles = len(labels)
155
+ npts = len(tick_labels)
156
+ X = np.array([float(x) for x in range(npts)])
157
+
158
+
159
+ fig, ax = plt.subplots(nrows=1, ncols=2, tight_layout=True, figsize=(9., 5.))
160
+ fig.suptitle(options.value)
161
+
162
+ P = [ np.zeros([nfiles, npts]), np.zeros([nfiles, npts]) ]
163
+ y_lim = []
164
+ for i, V in enumerate([front, back]):
165
+ ax[i].set_title(cindx[i])
166
+ ax[i].set_xticks(range(npts), labels=tick_labels)
167
+ ax[i].grid()
168
+
169
+ for lbl in labels:
170
+ ax[i].plot(X, V[lbl], '-', label=lbl)
171
+
172
+ y_lim.append(ax[i].get_ylim())
173
+
174
+ for a in ax:
175
+ a.set_ylim(0, 1.2*max(y_lim[0][1], y_lim[1][1]))
176
+ a.legend(ncol=3, fontsize="x-small")
177
+
178
+ save_figure(fig, options.out, prefix="zzz-")
179
+
180
+ def main(options):
181
+ """Main entry."""
182
+
183
+ if "LOCATION" in options.value or "REL_POS" in options.value:
184
+ show_positions(options)
185
+ return
186
+
187
+ if "FLATNESS_LOCAL" in options.value:
188
+ show_flatness(options)
189
+ return
190
+
191
+
192
+ front, back, labels = read_data_files(options)
193
+
194
+ labels.sort()
195
+ X = np.arange(0, len(labels))
196
+ fig, ax = plt.subplots(1, 1, tight_layout=True)
197
+ fig.suptitle(options.value)
198
+ ax.set_xticks(range(len(labels)), labels=labels)
199
+ ax.grid()
200
+
201
+ vfront = [front[x] for x in labels]
202
+ vback = [back[x] for x in labels]
203
+ ax.plot(X, vfront, '*', label="Front")
204
+ ax.plot(X, vback, 'o', label="Back")
205
+ ax.legend()
206
+
207
+ save_figure(fig, options.out)
208
+
209
+ plt.show()
210
+
211
+
212
+ if __name__ == "__main__":
213
+ # Argument parser
214
+ parser = argparse.ArgumentParser()
215
+ parser.add_argument('files', nargs='*', help="Input files")
216
+ parser.add_argument("--value", default=None, help="Value to plot")
217
+ parser.add_argument("--out", default=None, help="File to store the figure.")
218
+
219
+ opts = parser.parse_args()
220
+ if len(opts.files) == 0:
221
+ print("I need at least one input file")
222
+ sys.exit()
223
+
224
+ if len(opts.files) == 1:
225
+ xxx = any(elem in opts.files[0] for elem in r"*?")
226
+ if xxx:
227
+ opts.files = glob.glob(opts.files[0])
228
+
229
+ if opts.value[0] == '/':
230
+ opts.value = opts.value[1:]
231
+ opts.value = "results/METROLOGY/" + opts.value
232
+ main(opts)
@@ -162,7 +162,12 @@ def petal_flatness(orig_data, options, document=None):
162
162
  flatness_func = flatness_LSPL
163
163
  F = {}
164
164
  for key, val in sensors.items():
165
- F[key] = flatness_func(val)
165
+ try:
166
+ F[key] = flatness_func(val)
167
+ except ValueError as E:
168
+ print("*** Error: Petal flatnes: key {}\n{}".format(key, E))
169
+ print(val)
170
+ return TM, avg, Zmean, [-9999, -9999]
166
171
 
167
172
  flatness_all_sensor_area = flatness_func(all_data)
168
173
 
@@ -182,7 +187,7 @@ def petal_flatness(orig_data, options, document=None):
182
187
  outF.extend(values)
183
188
  print("{}: {:.3f} {}: {:.3f}".format(lbls[0], values[0], lbls[1], values[1]))
184
189
 
185
- print("All sensor area: {:.3f}".format(flatness_all_sensor_area))
190
+ print("All sensor area: {:.3f}".format(1000*flatness_all_sensor_area))
186
191
 
187
192
  # Add table in document
188
193
  if document:
@@ -133,7 +133,8 @@ class IRDataIFIC(IRDataGetter):
133
133
  super().__init__()
134
134
  self.analysis_frame = None
135
135
  if HAS_GRAPHANA:
136
- self.DB = ReadGraphana("localhost")
136
+ #self.DB = ReadGraphana("localhost")
137
+ self.DB = ReadGraphana()
137
138
  else:
138
139
  self.DB = None
139
140
 
@@ -156,9 +157,10 @@ class IRDataIFIC(IRDataGetter):
156
157
  """
157
158
  irbf.set_concatenate(True)
158
159
  frame = self.get_analysis_frame(irbf)
159
- i_min = self.indx
160
+ i_min = self.indx[-1]
160
161
  min_T = np.min(frame[0].image)
161
- return min_T, i_min, frame
162
+ values = self.get_IR_data(frame[0])
163
+ return min_T, i_min, [values, ]
162
164
 
163
165
  # if len(args) == 0:
164
166
  # T_min = -22.0
@@ -551,7 +551,7 @@ def get_T_profile(data, A, B, npts=10, do_fit=False, npdim=7, debug=False):
551
551
  fmin.success = True
552
552
  break
553
553
 
554
- # If the re is aclear minimum within the segment
554
+ # If there is a clear minimum within the segment
555
555
  if fmin.success and fmin.x[0] > 0 and fmin.x[0] < mx_dist:
556
556
  # This should no happen. if minimize returns we should have found
557
557
  # at least a valid root.
@@ -167,7 +167,8 @@ class CoreThermal(itkdb_gtk.dbGtkUtils.ITkDBWindow):
167
167
  self.irbfile = PSF
168
168
  self.param.files =[PSF,]
169
169
 
170
- DB = ReadGraphana("localhost")
170
+ #DB = ReadGraphana("localhost")
171
+ DB = ReadGraphana()
171
172
  irbf = IRBFile.open_file(self.irbfile)
172
173
  getter = IRDataGetter.factory(self.param.institute, self.param)
173
174
  frames = getter.get_analysis_frame(irbf)
@@ -75,9 +75,11 @@ def clean_figures():
75
75
  def get_inlet_temp(irbf, param):
76
76
  """Gets the value of the inlet temperature from Graphana."""
77
77
 
78
+ print("# Getting the Inlet temperature. Contacting Graphana...")
78
79
  out = -9999
79
80
  getter = IRDataGetter.factory(param.institute, param)
80
- DB = ReadGraphana("localhost")
81
+ #DB = ReadGraphana("localhost")
82
+ DB = ReadGraphana()
81
83
  frames = getter.get_analysis_frame(irbf)
82
84
  the_time = frames[0].timestamp
83
85
  try:
@@ -113,14 +115,14 @@ def create_IR_core(options):
113
115
  if irbf is None:
114
116
  print("Could not fine input file: {}".format(options.files))
115
117
  return
116
-
118
+
117
119
  if options.tco2 <= -999:
118
120
  out = get_inlet_temp(irbf, options)
119
121
  if out <= -999:
120
122
  print("### Cannot get Tcos. Setting to default.")
121
123
  P = IRPetalParam()
122
124
  out = P.tco2
123
-
125
+
124
126
  options.tco2 = out
125
127
 
126
128
  # Set parameters from command line
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: petal_qc
3
- Version: 0.0.3
3
+ Version: 0.0.4
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
@@ -31,6 +31,8 @@ petal_qc/metrology/petal_flatness.py
31
31
  petal_qc/metrology/show_data_file.py
32
32
  petal_qc/metrology/testSummary.py
33
33
  petal_qc/metrology/test_paralelism.py
34
+ petal_qc/test/test_Graphana.py
35
+ petal_qc/test/test_coreThermal.py
34
36
  petal_qc/thermal/CSVImage.py
35
37
  petal_qc/thermal/DebugPlot.py
36
38
  petal_qc/thermal/IRBFile.py
@@ -51,8 +53,6 @@ petal_qc/thermal/pipe_back.npz
51
53
  petal_qc/thermal/pipe_front.npz
52
54
  petal_qc/thermal/pipe_read.py
53
55
  petal_qc/thermal/show_IR_petal.py
54
- petal_qc/thermal/test_Graphana.py
55
- petal_qc/thermal/test_coreThermal.py
56
56
  petal_qc/utils/Geometry.py
57
57
  petal_qc/utils/Progress.py
58
58
  petal_qc/utils/__init__.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "petal_qc"
7
- version = "0.0.3"
7
+ version = "0.0.4"
8
8
  authors = [
9
9
  { name="Carlos Lacasta", email="carlos.lacasta@cern.ch" },
10
10
  ]
@@ -1,96 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Compare quantities."""
3
-
4
- import sys
5
- import argparse
6
- import glob
7
- import json
8
- from pathlib import Path
9
- import numpy as np
10
- import matplotlib.pyplot as plt
11
-
12
-
13
- def get_value(data, value_path):
14
- """Get the value."""
15
- a = data
16
- for k in value_path.split('/'):
17
- a = a[k]
18
-
19
- return a
20
-
21
-
22
- def main(options):
23
- labels = []
24
- front = {}
25
- back = {}
26
-
27
- for fnam in options.files:
28
- ifile = Path(fnam).expanduser().resolve()
29
- print(ifile.name)
30
- if not ifile.exists():
31
- print("File does not exist: ", fnam)
32
- continue
33
-
34
- data = None
35
- with open(ifile, 'r', encoding="UTF-8") as fp:
36
- data = json.load(fp)
37
-
38
- if data is None:
39
- print("Problems reading ", fnam)
40
- continue
41
-
42
- tmp = ifile.name.split('-')
43
- label = tmp[0]
44
- if not label in labels:
45
- labels.append(label)
46
-
47
- is_front = False
48
- if "front" in tmp[1].lower():
49
- is_front = True
50
-
51
- val = get_value(data, options.value)
52
- if is_front:
53
- front[label] = val
54
- else:
55
- back[label] = val
56
-
57
- labels.sort()
58
- X = np.arange(0, len(labels))
59
- fig, ax = plt.subplots(1, 1, tight_layout=True)
60
- fig.suptitle(options.value)
61
- ax.set_xticks(range(len(labels)), labels=labels)
62
- ax.grid()
63
-
64
- vfront = [front[x] for x in labels]
65
- vback = [back[x] for x in labels]
66
- ax.plot(X, vfront, '*', label="Front")
67
- ax.plot(X, vback, 'o', label="Back")
68
- ax.legend()
69
-
70
- if options.out:
71
- fig.savefig(options.out, dpi=300)
72
-
73
- plt.show()
74
-
75
-
76
- if __name__ == "__main__":
77
- # Argument parser
78
- parser = argparse.ArgumentParser()
79
- parser.add_argument('files', nargs='*', help="Input files")
80
- parser.add_argument("--value", default=None, help="Value to plot")
81
- parser.add_argument("--out", default=None, help="File to store the figure.")
82
-
83
- options = parser.parse_args()
84
- if len(options.files) == 0:
85
- print("I need at least one input file")
86
- sys.exit()
87
-
88
- if len(options.files) == 1:
89
- xxx = any(elem in options.files[0] for elem in r"*?")
90
- if xxx:
91
- options.files = glob.glob(options.files[0])
92
-
93
- if options.value[0] == '/':
94
- options.value = options.value[1:]
95
- options.value = "results/METROLOGY/" + options.value
96
- main(options)
File without changes
File without changes
File without changes