petal-qc 0.0.2__py3-none-any.whl → 0.0.3__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 +7 -1
- petal_qc/metrology/analyze_locking_points.py +2 -4
- petal_qc/metrology/compare_Cores.py +96 -0
- petal_qc/metrology/do_Metrology.py +8 -0
- petal_qc/thermal/IRBFile.py +1 -1
- petal_qc/thermal/IRDataGetter.py +21 -14
- petal_qc/thermal/analyze_IRCore.py +48 -3
- petal_qc/thermal/coreThermal.py +19 -3
- petal_qc/thermal/create_IRCore.py +41 -5
- petal_qc/thermal/create_core_report.py +4 -0
- petal_qc/thermal/test_Graphana.py +12 -5
- petal_qc/utils/readGraphana.py +11 -8
- {petal_qc-0.0.2.dist-info → petal_qc-0.0.3.dist-info}/METADATA +1 -1
- {petal_qc-0.0.2.dist-info → petal_qc-0.0.3.dist-info}/RECORD +17 -16
- {petal_qc-0.0.2.dist-info → petal_qc-0.0.3.dist-info}/entry_points.txt +1 -0
- {petal_qc-0.0.2.dist-info → petal_qc-0.0.3.dist-info}/WHEEL +0 -0
- {petal_qc-0.0.2.dist-info → petal_qc-0.0.3.dist-info}/top_level.txt +0 -0
petal_qc/__init__.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""petal_qc python module."""
|
|
2
|
-
__version__ = "0.0.
|
|
2
|
+
__version__ = "0.0.3"
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
def coreMetrology():
|
|
@@ -7,6 +7,12 @@ def coreMetrology():
|
|
|
7
7
|
from .metrology.coreMetrology import main
|
|
8
8
|
main()
|
|
9
9
|
|
|
10
|
+
def coreThermal():
|
|
11
|
+
"""Launches the Core thermal analysis ahd PDB script."""
|
|
12
|
+
from .thermal.coreThermal import main
|
|
13
|
+
main()
|
|
14
|
+
|
|
15
|
+
|
|
10
16
|
def bustapeReport():
|
|
11
17
|
"""Launches the Core metrology analysis ahd PDB script."""
|
|
12
18
|
from .BTreport.bustapeReport import main
|
|
@@ -303,7 +303,7 @@ def analyze_locking_point_data(orig_data, nbins=50, plane_fit=True, cut=3, docum
|
|
|
303
303
|
max_par = -9999
|
|
304
304
|
for i in range(3):
|
|
305
305
|
pts = M[iloc_indx[i], 2] + 0.435
|
|
306
|
-
|
|
306
|
+
vmin, vmax, band = get_min_max(pts)
|
|
307
307
|
avg_pts = np.mean(pts)
|
|
308
308
|
if abs(avg_pts) > max_par:
|
|
309
309
|
max_par = abs(avg_pts)
|
|
@@ -312,8 +312,6 @@ def analyze_locking_point_data(orig_data, nbins=50, plane_fit=True, cut=3, docum
|
|
|
312
312
|
print("Loc par. {} - {:.3f} avg: {:.3f}".format(i, band, avg_pts))
|
|
313
313
|
ax.hist(pts, bins=xaxis, label="Avg {:.3f} band {:.3f} mm".format(avg_pts, band))
|
|
314
314
|
|
|
315
|
-
parallelism = max_avg
|
|
316
|
-
|
|
317
315
|
ax.legend(loc='upper left')
|
|
318
316
|
y_lim = ax.get_ylim()
|
|
319
317
|
ax.fill_between([-0.100, 0.100], y_lim[0], y_lim[1], facecolor="grey", alpha=0.1)
|
|
@@ -330,7 +328,7 @@ def analyze_locking_point_data(orig_data, nbins=50, plane_fit=True, cut=3, docum
|
|
|
330
328
|
|
|
331
329
|
outDB["PARALLELISM"] = parallelism
|
|
332
330
|
outDB["OFFSET"] = mean_dist
|
|
333
|
-
print("
|
|
331
|
+
print("Parallelism test: {:.4f}.\n{}".format(parallelism, txt))
|
|
334
332
|
if document:
|
|
335
333
|
txt = """To study parallelism, we subtract -0.435 mm to the Z values. \
|
|
336
334
|
This is the nominal position of locator points. \
|
|
@@ -0,0 +1,96 @@
|
|
|
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)
|
|
@@ -14,6 +14,14 @@ from argparse import Action
|
|
|
14
14
|
from argparse import ArgumentParser
|
|
15
15
|
from pathlib import Path
|
|
16
16
|
import numpy as np
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
import petal_qc
|
|
20
|
+
|
|
21
|
+
except ImportError:
|
|
22
|
+
cwd = Path(__file__).parent.parent.parent
|
|
23
|
+
sys.path.append(cwd.as_posix())
|
|
24
|
+
|
|
17
25
|
from petal_qc.utils.utils import output_folder
|
|
18
26
|
|
|
19
27
|
from petal_qc.metrology.PetalMetrology import petal_metrology
|
petal_qc/thermal/IRBFile.py
CHANGED
petal_qc/thermal/IRDataGetter.py
CHANGED
|
@@ -31,6 +31,7 @@ class IRDataGetter(object):
|
|
|
31
31
|
def __init__(self):
|
|
32
32
|
"""Initialization."""
|
|
33
33
|
self.factor = 1
|
|
34
|
+
self.indx = -1
|
|
34
35
|
return
|
|
35
36
|
|
|
36
37
|
@staticmethod
|
|
@@ -153,17 +154,23 @@ class IRDataIFIC(IRDataGetter):
|
|
|
153
154
|
|
|
154
155
|
|
|
155
156
|
"""
|
|
156
|
-
if len(args) == 0:
|
|
157
|
-
T_min = -22.0
|
|
158
|
-
else:
|
|
159
|
-
T_min = args[0]
|
|
160
|
-
|
|
161
157
|
irbf.set_concatenate(True)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
158
|
+
frame = self.get_analysis_frame(irbf)
|
|
159
|
+
i_min = self.indx
|
|
160
|
+
min_T = np.min(frame[0].image)
|
|
161
|
+
return min_T, i_min, frame
|
|
162
|
+
|
|
163
|
+
# if len(args) == 0:
|
|
164
|
+
# T_min = -22.0
|
|
165
|
+
# else:
|
|
166
|
+
# T_min = args[0]
|
|
167
|
+
#
|
|
168
|
+
# irbf.set_concatenate(True)
|
|
169
|
+
# min_T, i_min, ref_img = IRPetal.find_reference_image(irbf, T_min)
|
|
170
|
+
# values = self.get_IR_data(ref_img)
|
|
171
|
+
# self.factor = values.shape[0]/640
|
|
172
|
+
#
|
|
173
|
+
# return min_T, i_min, [values, ]
|
|
167
174
|
|
|
168
175
|
def get_IR_data(self, image, **kargs):
|
|
169
176
|
"""Get the data from the image in the proper orientation.
|
|
@@ -262,16 +269,16 @@ class IRDataIFIC(IRDataGetter):
|
|
|
262
269
|
for img in irbf.images():
|
|
263
270
|
min_T.append(np.min(img[0].image))
|
|
264
271
|
|
|
265
|
-
indx = IRDataIFIC.find_minimum(min_T)
|
|
266
|
-
self.analysis_frame = [irbf.getImage(indx[-1])]
|
|
272
|
+
self.indx = IRDataIFIC.find_minimum(min_T)
|
|
273
|
+
self.analysis_frame = [irbf.getImage(self.indx[-1])]
|
|
267
274
|
return self.analysis_frame
|
|
268
275
|
|
|
269
276
|
def get_inlet_temperature(self):
|
|
270
277
|
"""REturn the inlet temperature."""
|
|
271
278
|
if self.DB:
|
|
272
279
|
img = self.analysis_frame[0]
|
|
273
|
-
|
|
274
|
-
return
|
|
280
|
+
X, T = self.DB.get_temperature(img.timestamp, 1)
|
|
281
|
+
return np.min(T)
|
|
275
282
|
|
|
276
283
|
else:
|
|
277
284
|
return -9999
|
|
@@ -12,6 +12,7 @@ import numpy as np
|
|
|
12
12
|
from scipy.interpolate import CubicSpline
|
|
13
13
|
from petal_qc.utils.utils import find_file
|
|
14
14
|
from petal_qc.utils.utils import output_folder
|
|
15
|
+
import petal_qc.utils.docx_utils as docx_utils
|
|
15
16
|
|
|
16
17
|
from petal_qc.thermal import IRCore
|
|
17
18
|
from petal_qc.thermal import Petal_IR_Analysis
|
|
@@ -33,6 +34,23 @@ def get_names(files):
|
|
|
33
34
|
names.append(ifile.stem)
|
|
34
35
|
return names
|
|
35
36
|
|
|
37
|
+
def add_figures_to_doc(doc, figures, name=None):
|
|
38
|
+
"""Add figures to doc.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
doc (Document): Document
|
|
42
|
+
figures (list): List of figures.
|
|
43
|
+
|
|
44
|
+
"""
|
|
45
|
+
if doc is None or len(figures)==0:
|
|
46
|
+
return
|
|
47
|
+
|
|
48
|
+
if name:
|
|
49
|
+
doc.add_heading(name, level=1)
|
|
50
|
+
|
|
51
|
+
for F in figures:
|
|
52
|
+
doc.add_picture(F, True, 12, caption=F._suptitle.get_text())
|
|
53
|
+
|
|
36
54
|
|
|
37
55
|
class GoldenAxis(object):
|
|
38
56
|
"""Get best X path."""
|
|
@@ -293,10 +311,11 @@ def show_golden_average(golden, results, value):
|
|
|
293
311
|
for i in range(2):
|
|
294
312
|
ax[i].set_xticks(range(10), labels=tick_labels)
|
|
295
313
|
|
|
314
|
+
G = golden[iside]
|
|
296
315
|
for R in results:
|
|
297
316
|
RS = R.results[iside]
|
|
298
317
|
Y = getattr(RS, value)
|
|
299
|
-
gY = getattr(
|
|
318
|
+
gY = getattr(G, value)
|
|
300
319
|
O = getattr(R.golden[iside], value) - gY
|
|
301
320
|
if value.find("path") >= 0:
|
|
302
321
|
X = RS.path_length
|
|
@@ -381,6 +400,7 @@ def analyze_petal_cores(files, golden, options):
|
|
|
381
400
|
|
|
382
401
|
"""
|
|
383
402
|
output = []
|
|
403
|
+
cores = []
|
|
384
404
|
names = get_names(files)
|
|
385
405
|
for i, ifile in enumerate(files):
|
|
386
406
|
ifile = find_file(options.folder, ifile)
|
|
@@ -397,6 +417,7 @@ def analyze_petal_cores(files, golden, options):
|
|
|
397
417
|
print("+++ File {} does not have component serial number.")
|
|
398
418
|
continue
|
|
399
419
|
|
|
420
|
+
cores.append(core)
|
|
400
421
|
out = [{}, {}]
|
|
401
422
|
for iside in range(2):
|
|
402
423
|
for val in ("path_temp", "sensor_avg", "sensor_std"):
|
|
@@ -463,7 +484,7 @@ def analyze_petal_cores(files, golden, options):
|
|
|
463
484
|
|
|
464
485
|
output.append(dbOut)
|
|
465
486
|
|
|
466
|
-
return output
|
|
487
|
+
return output, cores
|
|
467
488
|
|
|
468
489
|
def analyze_IRCore(options, show=True):
|
|
469
490
|
"""Main entry."""
|
|
@@ -499,7 +520,31 @@ def analyze_IRCore(options, show=True):
|
|
|
499
520
|
for i, Jside in enumerate(J):
|
|
500
521
|
golden[i].from_json(Jside)
|
|
501
522
|
|
|
502
|
-
output = analyze_petal_cores(options.files, golden, options)
|
|
523
|
+
output, cores = analyze_petal_cores(options.files, golden, options)
|
|
524
|
+
|
|
525
|
+
if show or options.report:
|
|
526
|
+
for C in cores:
|
|
527
|
+
get_golden_axis(C, golden)
|
|
528
|
+
|
|
529
|
+
if options.report:
|
|
530
|
+
document = docx_utils.Document()
|
|
531
|
+
document.add_page_numbers()
|
|
532
|
+
document.styles['Normal'].font.name = "Calibri"
|
|
533
|
+
document.add_heading("Comparing to Golden", 0)
|
|
534
|
+
else:
|
|
535
|
+
document = None
|
|
536
|
+
|
|
537
|
+
F = show_golden_average(golden, cores, "path_temp")
|
|
538
|
+
add_figures_to_doc(document, F, "Temperature along pipe")
|
|
539
|
+
F = show_golden_average(golden, cores, "path_spread")
|
|
540
|
+
add_figures_to_doc(document, F, "Spread along pipe")
|
|
541
|
+
F = show_golden_average(golden, cores, "sensor_avg")
|
|
542
|
+
add_figures_to_doc(document, F, "Sensor avg")
|
|
543
|
+
F = show_golden_average(golden, cores, "sensor_std")
|
|
544
|
+
add_figures_to_doc(document, F, "Sendor std")
|
|
545
|
+
|
|
546
|
+
if document:
|
|
547
|
+
document.save("Compare-to-Golden.docx")
|
|
503
548
|
|
|
504
549
|
if show:
|
|
505
550
|
plt.show()
|
petal_qc/thermal/coreThermal.py
CHANGED
|
@@ -4,6 +4,8 @@ import sys
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from argparse import ArgumentParser
|
|
6
6
|
import json
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
7
9
|
import itkdb_gtk
|
|
8
10
|
import itkdb_gtk.ITkDButils
|
|
9
11
|
import itkdb_gtk.dbGtkUtils
|
|
@@ -19,9 +21,11 @@ except ImportError:
|
|
|
19
21
|
|
|
20
22
|
|
|
21
23
|
from petal_qc.thermal.IRPetalParam import IRPetalParam
|
|
22
|
-
from petal_qc.thermal
|
|
23
|
-
from petal_qc.thermal.
|
|
24
|
-
|
|
24
|
+
from petal_qc.thermal import IRBFile
|
|
25
|
+
from petal_qc.thermal.IRDataGetter import IRDataGetter
|
|
26
|
+
|
|
27
|
+
from petal_qc.thermal.analyze_IRCore import golden_from_json
|
|
28
|
+
from petal_qc.utils.readGraphana import ReadGraphana
|
|
25
29
|
|
|
26
30
|
import gi
|
|
27
31
|
gi.require_version("Gtk", "3.0")
|
|
@@ -162,6 +166,18 @@ class CoreThermal(itkdb_gtk.dbGtkUtils.ITkDBWindow):
|
|
|
162
166
|
|
|
163
167
|
self.irbfile = PSF
|
|
164
168
|
self.param.files =[PSF,]
|
|
169
|
+
|
|
170
|
+
DB = ReadGraphana("localhost")
|
|
171
|
+
irbf = IRBFile.open_file(self.irbfile)
|
|
172
|
+
getter = IRDataGetter.factory(self.param.institute, self.param)
|
|
173
|
+
frames = getter.get_analysis_frame(irbf)
|
|
174
|
+
try:
|
|
175
|
+
X, val = DB.get_temperature(frames[0].timestamp, 3)
|
|
176
|
+
inlet = np.min(val)
|
|
177
|
+
self.entryTemp.set_text("{:.1f}".format(inlet))
|
|
178
|
+
|
|
179
|
+
except ValueError:
|
|
180
|
+
pass
|
|
165
181
|
|
|
166
182
|
def on_golden_set(self, *args):
|
|
167
183
|
"""File chosen from FileChooser."""
|
|
@@ -7,6 +7,7 @@ from datetime import datetime
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
|
|
9
9
|
import dateutil
|
|
10
|
+
import numpy as np
|
|
10
11
|
import matplotlib.pyplot as plt
|
|
11
12
|
|
|
12
13
|
try:
|
|
@@ -23,6 +24,7 @@ from petal_qc.thermal import Petal_IR_Analysis
|
|
|
23
24
|
from petal_qc.thermal import PipeFit
|
|
24
25
|
from petal_qc.thermal.IRDataGetter import IRDataGetter
|
|
25
26
|
from petal_qc.thermal.IRPetalParam import IRPetalParam
|
|
27
|
+
from petal_qc.utils.readGraphana import ReadGraphana
|
|
26
28
|
from petal_qc.utils.utils import output_folder
|
|
27
29
|
|
|
28
30
|
|
|
@@ -70,6 +72,28 @@ def clean_figures():
|
|
|
70
72
|
|
|
71
73
|
__figures__ = {}
|
|
72
74
|
|
|
75
|
+
def get_inlet_temp(irbf, param):
|
|
76
|
+
"""Gets the value of the inlet temperature from Graphana."""
|
|
77
|
+
|
|
78
|
+
out = -9999
|
|
79
|
+
getter = IRDataGetter.factory(param.institute, param)
|
|
80
|
+
DB = ReadGraphana("localhost")
|
|
81
|
+
frames = getter.get_analysis_frame(irbf)
|
|
82
|
+
the_time = frames[0].timestamp
|
|
83
|
+
try:
|
|
84
|
+
X, val = DB.get_temperature(the_time, 5)
|
|
85
|
+
for x, y in zip(X, val):
|
|
86
|
+
print("{} - {:.1f}".format(x, y))
|
|
87
|
+
|
|
88
|
+
imin = np.argmin(val)
|
|
89
|
+
out = val[imin]
|
|
90
|
+
print("{}: T_co2 = {:.1f}".format(X[imin], out))
|
|
91
|
+
|
|
92
|
+
except ValueError:
|
|
93
|
+
out = -9999
|
|
94
|
+
|
|
95
|
+
return out
|
|
96
|
+
|
|
73
97
|
def create_IR_core(options):
|
|
74
98
|
"""Entry point."""
|
|
75
99
|
global __figures__
|
|
@@ -83,13 +107,25 @@ def create_IR_core(options):
|
|
|
83
107
|
print("*** Invalid institute name. ***")
|
|
84
108
|
return None
|
|
85
109
|
|
|
86
|
-
# Set parameters from command line
|
|
87
|
-
params = IRPetal.IRPetalParam(options)
|
|
88
|
-
params.debug = False
|
|
89
|
-
|
|
90
110
|
# Open the sequence file
|
|
91
111
|
print("## ", options.files)
|
|
92
112
|
irbf = IRBFile.open_file(options.files)
|
|
113
|
+
if irbf is None:
|
|
114
|
+
print("Could not fine input file: {}".format(options.files))
|
|
115
|
+
return
|
|
116
|
+
|
|
117
|
+
if options.tco2 <= -999:
|
|
118
|
+
out = get_inlet_temp(irbf, options)
|
|
119
|
+
if out <= -999:
|
|
120
|
+
print("### Cannot get Tcos. Setting to default.")
|
|
121
|
+
P = IRPetalParam()
|
|
122
|
+
out = P.tco2
|
|
123
|
+
|
|
124
|
+
options.tco2 = out
|
|
125
|
+
|
|
126
|
+
# Set parameters from command line
|
|
127
|
+
params = IRPetal.IRPetalParam(options)
|
|
128
|
+
params.debug = False
|
|
93
129
|
|
|
94
130
|
# FInd first image below the threshold or the corresponding frame
|
|
95
131
|
# We will use the pipe obtained from here as the reference
|
|
@@ -153,7 +189,7 @@ def create_IR_core(options):
|
|
|
153
189
|
|
|
154
190
|
# get the framea from where extract the data
|
|
155
191
|
# reorder if needed
|
|
156
|
-
frames = getter.get_analysis_frame(irbf)
|
|
192
|
+
frames = getter.get_analysis_frame(irbf)
|
|
157
193
|
if pipe_order[0]:
|
|
158
194
|
tmp = frames[0]
|
|
159
195
|
frames[0] = frames[1]
|
|
@@ -82,11 +82,15 @@ def create_report(options):
|
|
|
82
82
|
document.add_heading('Temperature along path', level=1)
|
|
83
83
|
document.add_picture(figures[0], True, 12, caption="Petal core .vs. Golden (side 0).")
|
|
84
84
|
document.add_picture(figures[0], True, 12, caption="Petal core .vs. Golden (side 1).")
|
|
85
|
+
for F in figures:
|
|
86
|
+
plt.close(F)
|
|
85
87
|
|
|
86
88
|
figures = plot_profile_and_golden(golden, core, "sensor_avg")
|
|
87
89
|
document.add_heading('Average Temperatur on sensors areas.', level=1)
|
|
88
90
|
document.add_picture(figures[0], True, 12, caption="Sensors .vs. Golden (side 0).")
|
|
89
91
|
document.add_picture(figures[0], True, 12, caption="Sensors .vs. Golden (side 1).")
|
|
92
|
+
for F in figures:
|
|
93
|
+
plt.close(F)
|
|
90
94
|
|
|
91
95
|
ofile = utils.output_folder(options.folder, "{}-thermal.docx".format(options.SN))
|
|
92
96
|
document.save(ofile)
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import sys
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
import datetime
|
|
6
|
+
import numpy as np
|
|
6
7
|
try:
|
|
7
8
|
import petal_qc
|
|
8
9
|
|
|
@@ -16,15 +17,21 @@ from petal_qc.thermal.IRPetalParam import IRPetalParam
|
|
|
16
17
|
from petal_qc.thermal import IRBFile
|
|
17
18
|
|
|
18
19
|
|
|
20
|
+
|
|
19
21
|
options = IRPetalParam()
|
|
20
|
-
options.files = ["
|
|
22
|
+
options.files = [Path("~/tmp/thermal/PPC.008.irb").expanduser().resolve()]
|
|
21
23
|
getter = IRDataGetter.factory(options.institute, options)
|
|
22
24
|
DB = ReadGraphana("localhost")
|
|
23
25
|
irbf = IRBFile.open_file(options.files)
|
|
24
26
|
|
|
25
27
|
frames = getter.get_analysis_frame(irbf)
|
|
26
28
|
print(frames[0].timestamp)
|
|
27
|
-
the_time =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
the_time = frames[0].timestamp
|
|
30
|
+
try:
|
|
31
|
+
X, val = DB.get_temperature(the_time, 5)
|
|
32
|
+
for x, y in zip(X, val):
|
|
33
|
+
print("{} - {:.1f}".format(x, y))
|
|
34
|
+
|
|
35
|
+
print("{:.1f}".format(np.min(val)))
|
|
36
|
+
except ValueError as e:
|
|
37
|
+
print(e)
|
petal_qc/utils/readGraphana.py
CHANGED
|
@@ -31,31 +31,34 @@ class ReadGraphana(object):
|
|
|
31
31
|
if not isinstance(the_time, datetime.datetime):
|
|
32
32
|
the_time = parse(the_time)
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
wnd = int(window/2.0+0.5)
|
|
35
|
+
td = datetime.timedelta(minutes=wnd)
|
|
36
|
+
t1 = the_time - td
|
|
37
|
+
t2 = the_time + td
|
|
37
38
|
|
|
38
39
|
measure="Temp"
|
|
39
40
|
setup="MARTA_APP|MARTA_tt06"
|
|
40
41
|
query = "select location,value from {measure} where (location =~ /.*{location}*/ and time>'{t1}' and time < '{t2}') group by \"location\"".format(
|
|
41
42
|
measure=measure,
|
|
42
43
|
location=setup,
|
|
43
|
-
t1=t1.isoformat()
|
|
44
|
-
t2=t2.isoformat()
|
|
44
|
+
t1=t1.astimezone(datetime.UTC).isoformat(),
|
|
45
|
+
t2=t2.astimezone(datetime.UTC).isoformat()
|
|
46
|
+
)
|
|
45
47
|
|
|
46
48
|
ss = self.client.query(query)
|
|
47
49
|
nitems = 0
|
|
48
50
|
for s in ss:
|
|
51
|
+
|
|
49
52
|
nitems += len(s)
|
|
50
53
|
|
|
51
54
|
if nitems==0:
|
|
52
55
|
raise ValueError(("No data found"))
|
|
53
56
|
|
|
54
57
|
T = []
|
|
58
|
+
X = []
|
|
55
59
|
for s in ss:
|
|
56
60
|
for v in s:
|
|
57
61
|
T.append(v['value'])
|
|
62
|
+
X.append(v['time'])
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
val = np.mean(T)
|
|
61
|
-
return val
|
|
64
|
+
return X, T
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: petal_qc
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
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,4 +1,4 @@
|
|
|
1
|
-
petal_qc/__init__.py,sha256=
|
|
1
|
+
petal_qc/__init__.py,sha256=T6LHv2FfNKEZoPz6lXy-NcguLXFG0cYPK7I-NCR2Ng4,472
|
|
2
2
|
petal_qc/dashBoard.py,sha256=aPugRYhCcAzEBPrCyh8A8QKYaB4Q-_T1q3r5A3J2eog,553
|
|
3
3
|
petal_qc/BTreport/CheckBTtests.py,sha256=4hNP1V-zcFBN5UvWVbx9nAmittF8Jmb5J17L33t68Eg,9086
|
|
4
4
|
petal_qc/BTreport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -8,14 +8,15 @@ petal_qc/metrology/DataFile.py,sha256=PbFqy3-WSj69epV5EjhHc1GKhA8I74FmJYOXUjN0V2
|
|
|
8
8
|
petal_qc/metrology/PetalMetrology.py,sha256=H4MwuQ2QxP_Td9KtMly_-osXT1owigzC7QlmRub7oRo,11886
|
|
9
9
|
petal_qc/metrology/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
petal_qc/metrology/all2csv.py,sha256=KTgEGaediylwkGN7gyWyQqUjU0f9FOa3xF4z1W38EcU,1569
|
|
11
|
-
petal_qc/metrology/analyze_locking_points.py,sha256=
|
|
11
|
+
petal_qc/metrology/analyze_locking_points.py,sha256=FjLte9VgxVMfR-b1DlViWDsa2vl3ZKfCCptyibEjBUY,20519
|
|
12
12
|
petal_qc/metrology/cold_noise.py,sha256=PuTaQ73WrQCJdE9ezS4UFmA3atwCuvM0ZsUOYu1ZIBw,3106
|
|
13
|
+
petal_qc/metrology/compare_Cores.py,sha256=IKJ7lGHfF2NyYasXqMF-IzBLknA2Qp4qFzBVxJbKOX8,2415
|
|
13
14
|
petal_qc/metrology/comparisonTable.py,sha256=6Zmh-x0ahs28ZJQuHMrIiRcblUmTN1_-1otFSRNMPds,1743
|
|
14
15
|
petal_qc/metrology/convert_mitutoyo.py,sha256=HdXQzFL5y7r8qXDzti91VItDQ-y6D9rEAYknn4yHwBs,5449
|
|
15
16
|
petal_qc/metrology/convert_smartscope.py,sha256=es3PoUd5d5rpHebgwsS9nrc3uuy9uFKOQ00ZdU5XHQ0,3836
|
|
16
17
|
petal_qc/metrology/coreMetrology.py,sha256=L_uoxq8ObmmiMSx41gFCdpQnalR-HgaVUPHzhDYsDiE,13610
|
|
17
18
|
petal_qc/metrology/data2csv.py,sha256=2ttMSmfGLPIaOqZGima2dH6sdnSRAFTHlEbSOfW5ebA,1809
|
|
18
|
-
petal_qc/metrology/do_Metrology.py,sha256=
|
|
19
|
+
petal_qc/metrology/do_Metrology.py,sha256=zPryMgu46fmCyuAGtRGs2yqh0OSxnkSo9bsJMxQ80PU,4107
|
|
19
20
|
petal_qc/metrology/flatness4nigel.py,sha256=SUHwn6pCEUWQV_62-_9-VKrmUdL4gVQcSA3aTtYq958,4071
|
|
20
21
|
petal_qc/metrology/gtkutils.py,sha256=1pOTxiE2EZR9zNNNT5cOetga_4NG9DzLaqQPI4c1EzE,3372
|
|
21
22
|
petal_qc/metrology/petal_flatness.py,sha256=MH3ZlSildLokYnjERQG28qqLg3LL8C6rFLT8VbEI_BA,11190
|
|
@@ -24,25 +25,25 @@ petal_qc/metrology/testSummary.py,sha256=0BhcEd1BPz2Mbonzi8nyZOzNSzpUqowBFNl5cVu
|
|
|
24
25
|
petal_qc/metrology/test_paralelism.py,sha256=_j__OdUwdXWM494_9HpGPuPHixMwwVphCcvHEfzWi_k,1981
|
|
25
26
|
petal_qc/thermal/CSVImage.py,sha256=Vt2kYmUsZWkQvxcF8fDda3HO1Rb29kPQHnEoHFCqWYo,2038
|
|
26
27
|
petal_qc/thermal/DebugPlot.py,sha256=OmREFwNDAKgoObDmcgHrB4d8m3bf2znfsKVGsb5rBGQ,2119
|
|
27
|
-
petal_qc/thermal/IRBFile.py,sha256=
|
|
28
|
+
petal_qc/thermal/IRBFile.py,sha256=yScjQrAeB9dnNNO-6_8S34vzrtme0F6y3kwYahMKDxc,22271
|
|
28
29
|
petal_qc/thermal/IRCore.py,sha256=y79YEQrq4q2hSdmYbOF7jjEA-wy50Qun0g_AmrRUmls,3056
|
|
29
|
-
petal_qc/thermal/IRDataGetter.py,sha256=
|
|
30
|
+
petal_qc/thermal/IRDataGetter.py,sha256=L7uX6JF0c253bq_NLt7_ddbjnrOCoLDblfIxE_9YL1o,10834
|
|
30
31
|
petal_qc/thermal/IRPetal.py,sha256=8H1ltpahzJavM65De8OTSedvilXQkr3LkV8mRnTDhLQ,38334
|
|
31
32
|
petal_qc/thermal/IRPetalParam.py,sha256=hrQ9FevzWctvBVHeQ71G0WzllVEa5rYkJom2ezfFYHc,3674
|
|
32
33
|
petal_qc/thermal/PetalColorMaps.py,sha256=6CvJHzRdojLHu3BROYSekHw8g_BJ1lJ_edyhovTIydU,3831
|
|
33
34
|
petal_qc/thermal/Petal_IR_Analysis.py,sha256=8Deh_bJ5B7DdaUV18saboF7fXZ_8Bt1vkUlsk5RqVeo,3910
|
|
34
35
|
petal_qc/thermal/PipeFit.py,sha256=bipXxJGxrwlgbrFv8WJA1Ds7Kj4oUwEyqTIswpgni9o,17214
|
|
35
36
|
petal_qc/thermal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
|
-
petal_qc/thermal/analyze_IRCore.py,sha256=
|
|
37
|
+
petal_qc/thermal/analyze_IRCore.py,sha256=lJsADO4ZisESpJLA97MR9oIbdMKzwlZj9vD6WWj64pg,19577
|
|
37
38
|
petal_qc/thermal/contours.py,sha256=ampCKm4byZYKb_4eJFjIkdFIl2bqVXD2mV13d2XUWlw,8244
|
|
38
|
-
petal_qc/thermal/coreThermal.py,sha256=
|
|
39
|
-
petal_qc/thermal/create_IRCore.py,sha256=
|
|
40
|
-
petal_qc/thermal/create_core_report.py,sha256=
|
|
39
|
+
petal_qc/thermal/coreThermal.py,sha256=veZLvsDXlJdcLz1bFM4Rd9rG2u_UNtpv2l-DirR9Y2M,12765
|
|
40
|
+
petal_qc/thermal/create_IRCore.py,sha256=xLHTyfY0VHHA21ES2b_Ix3JKIyiRQpS1qQBGeLt0Z9Q,7233
|
|
41
|
+
petal_qc/thermal/create_core_report.py,sha256=zCZtTR6ouHRVZQAen_PutCvvDwHE5aSwq95sIv-8htM,4325
|
|
41
42
|
petal_qc/thermal/pipe_back.npz,sha256=yooZuVYtHU541HcV6Gh_5B0BqdYAVEvYAuVvMMSY7Jc,3632
|
|
42
43
|
petal_qc/thermal/pipe_front.npz,sha256=DuwruG9C2Z1rLigqWMApY4Orsf1SGUQGKy0Yan8Bk8A,3697
|
|
43
44
|
petal_qc/thermal/pipe_read.py,sha256=HrAtEbf8pMhJDETzkevodiTbuprIOh4yHv6PzpRoz7Q,5040
|
|
44
45
|
petal_qc/thermal/show_IR_petal.py,sha256=vKb8wm9Y7erAdCb93ODREv2qfSexNMfJpV-67wfOhBw,13159
|
|
45
|
-
petal_qc/thermal/test_Graphana.py,sha256=
|
|
46
|
+
petal_qc/thermal/test_Graphana.py,sha256=fXcqHzgrfZGjSF-WoMLl96G97XjXVnynHYC-5rKw_-c,1032
|
|
46
47
|
petal_qc/thermal/test_coreThermal.py,sha256=YRPK3DGG7Tz66K4Kka3euXgUDzW_JlIqSYicMBhb96E,1516
|
|
47
48
|
petal_qc/utils/Geometry.py,sha256=XwA_aojk880N-jC1_bnMYFK0bcD-L96JPS81NUerJf0,19765
|
|
48
49
|
petal_qc/utils/Progress.py,sha256=gCti4n2xfCcOTlAff5GchabGE5BCwavvDZYYKdbEsXU,4064
|
|
@@ -50,10 +51,10 @@ petal_qc/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
50
51
|
petal_qc/utils/all_files.py,sha256=4ja_DkbTYPY3gUPBAZq0p7KB9lnXZx-OCnpTHg9tm4I,1044
|
|
51
52
|
petal_qc/utils/docx_utils.py,sha256=Eye16PF8W0mPBVdQvgFKWxPYV7-hzBgANPDZtUEjzf8,5805
|
|
52
53
|
petal_qc/utils/fit_utils.py,sha256=3KUGWpBMV-bVDkQHWBigXot8chOpjAVBJ5H5b5dbdjk,5349
|
|
53
|
-
petal_qc/utils/readGraphana.py,sha256
|
|
54
|
+
petal_qc/utils/readGraphana.py,sha256=Ljr3PSkkTw-A8SRfMa77n7RO7ogLewwDy9dkflzKh2M,1869
|
|
54
55
|
petal_qc/utils/utils.py,sha256=CqCsNIcEg6FQb3DN70tmqeLVLlQqsRfDzhfGevlnfBc,4035
|
|
55
|
-
petal_qc-0.0.
|
|
56
|
-
petal_qc-0.0.
|
|
57
|
-
petal_qc-0.0.
|
|
58
|
-
petal_qc-0.0.
|
|
59
|
-
petal_qc-0.0.
|
|
56
|
+
petal_qc-0.0.3.dist-info/METADATA,sha256=4lvnUeqnwBOTiGqowWZZjowXYKI6Dn_5MD9laVn4Uao,943
|
|
57
|
+
petal_qc-0.0.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
58
|
+
petal_qc-0.0.3.dist-info/entry_points.txt,sha256=tkGC458t1_yVr9OHFE1KtJmGQ2wqsbK8WkPWxru4jFk,127
|
|
59
|
+
petal_qc-0.0.3.dist-info/top_level.txt,sha256=CCo1Xe6kLS79PruhsB6bk2CuL9VFtNdNpgJjYUs4jk4,9
|
|
60
|
+
petal_qc-0.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|