petal-qc 0.0.8__py3-none-any.whl → 0.0.10__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.8"
2
+ __version__ = "0.0.10"
3
3
 
4
4
 
5
5
  def coreMetrology():
@@ -23,6 +23,11 @@ def bustapeReport():
23
23
  # from .BTreport.bustapeReport import main
24
24
  main()
25
25
 
26
+ def uploadPetalInformation():
27
+ """Read files from AVS nd create Petal core in PDB."""
28
+ from .metrology.uploadPetalInformation import main
29
+ main()
30
+
26
31
  def dashBoard():
27
32
  """Launches the Core thermal analysis ahd PDB script."""
28
33
  from .dashBoard import main
@@ -255,7 +255,7 @@ def petal_metrology(ifile, options):
255
255
  if not check_spec(delta, 0.050):
256
256
  dbOut["defects"].append({
257
257
  "name": key,
258
- "description": "Delta {} is {:.3f} mm > 0.025 mm.".format(k, delta)
258
+ "description": "Delta {} is {:.3f} mm > 0.050 mm.".format(k, delta)
259
259
  })
260
260
 
261
261
  elif "CHECK_" in key:
@@ -263,7 +263,7 @@ def petal_metrology(ifile, options):
263
263
  if not check_spec(abs(val), 0.050):
264
264
  dbOut["defects"].append({
265
265
  "name": key,
266
- "description": "LOC DIAM delta is {:.3f} mm > 0.025 mm.".format(abs(val))
266
+ "description": "LOC DIAM delta is {:.3f} mm > 0.050 mm.".format(abs(val))
267
267
  })
268
268
  else:
269
269
  if val < 0 or val > 0.012:
@@ -77,17 +77,21 @@ def read_data_files(options):
77
77
  if not label in labels:
78
78
  labels.append(label)
79
79
 
80
- val = get_value(data, options.value)
81
- if "front" in tmp[1].lower():
82
- front[label] = val
83
- else:
84
- back[label] = val
80
+ try:
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
+ except KeyError as E:
87
+ print("Error in {}:\n{}".format(fnam, E))
88
+ continue
85
89
 
86
90
  labels.sort()
87
91
 
88
92
  return front, back, labels
89
93
 
90
- def draw_deltas(data, keys, fnam=None, title="Front"):
94
+ def draw_deltas(data, keys, fnam=None, title="Front", draw_text=True):
91
95
  """Plot the position deltas."""
92
96
  key_table = {"Bot.": "PL01", "Slot": "PL02", "Top": "PL03",
93
97
  "Bot-FD01": "PL01-FD01", "Bot-FD02": "PL01-FD02", "FD01-FD02": "FD01-FD02" }
@@ -123,8 +127,9 @@ def draw_deltas(data, keys, fnam=None, title="Front"):
123
127
  LBL[k].append(label.split('.')[1].lstrip('0'))
124
128
 
125
129
  ax[i].scatter(P[i][:,0], P[i][:,1])
126
- for j in range(len(LBL[i])):
127
- ax[i].text(P[i][j,0], P[i][j,1], LBL[i][j]) #, ha='center', va='top')
130
+ if draw_text:
131
+ for j in range(len(LBL[i])):
132
+ ax[i].text(P[i][j,0], P[i][j,1], LBL[i][j]) #, ha='center', va='top')
128
133
 
129
134
  save_figure(fig, fnam, prefix=title)
130
135
 
@@ -142,10 +147,12 @@ def show_positions(options):
142
147
 
143
148
  front, back, labels = read_data_files(options)
144
149
  val_name = options.value.split('/')[-1]
145
- draw_deltas(front, keys, fnam=options.out, title="{} - Front".format(val_name))
146
- draw_deltas(back, keys, fnam=options.out, title="{} - Back".format(val_name))
150
+ draw_text = not options.no_legend
151
+ draw_deltas(front, keys, fnam=options.out, title="{} - Front".format(val_name), draw_text=draw_text)
152
+ draw_deltas(back, keys, fnam=options.out, title="{} - Back".format(val_name), draw_text=draw_text)
147
153
 
148
- plt.show()
154
+ if not options.no_show:
155
+ plt.show()
149
156
 
150
157
  def show_flatness(options):
151
158
  """Show flatness plots."""
@@ -177,9 +184,10 @@ def show_flatness(options):
177
184
  a.set_ylim(0, 1.2*max(y_lim[0][1], y_lim[1][1]))
178
185
  x_lim = a.get_xlim()
179
186
  a.fill_between(x_lim, 0, 0.050, facecolor="darkseagreen", alpha=0.1)
180
- a.legend(ncol=3, fontsize="x-small")
187
+ if not options.no_legend:
188
+ a.legend(ncol=3, fontsize="x-small")
181
189
 
182
- save_figure(fig, options.out, prefix=opts.prefix)
190
+ save_figure(fig, options.out, prefix=options.prefix)
183
191
 
184
192
  def main(options):
185
193
  """Main entry."""
@@ -204,11 +212,13 @@ def main(options):
204
212
  vback = [back[x] for x in labels]
205
213
  ax.plot(X, vfront, '*', label="Front")
206
214
  ax.plot(X, vback, 'o', label="Back")
207
- ax.legend()
215
+ if not options.no_legend:
216
+ ax.legend()
208
217
 
209
218
  save_figure(fig, options.out, prefix=options.prefix)
210
219
 
211
- plt.show()
220
+ if not options.no_show:
221
+ plt.show()
212
222
 
213
223
 
214
224
  if __name__ == "__main__":
@@ -218,6 +228,8 @@ if __name__ == "__main__":
218
228
  parser.add_argument("--value", default=None, help="Value to plot")
219
229
  parser.add_argument("--prefix", default=None, help="prefix for out file")
220
230
  parser.add_argument("--out", default=None, help="File to store the figure.")
231
+ parser.add_argument("--no-legend", dest="no_legend", default=False, action="store_true", help="Do not draw the legend")
232
+ parser.add_argument("--no-show", dest="no_show", default=False, action="store_true", help="Do not show the figure")
221
233
 
222
234
  opts = parser.parse_args()
223
235
  if len(opts.files) == 0:
@@ -16,7 +16,7 @@ import gi
16
16
  gi.require_version("Gtk", "3.0")
17
17
  from gi.repository import Gtk, GObject, Gio, GLib
18
18
 
19
- __HELP__ = "https://petal-qc.docs.cern.ch"
19
+ __HELP__ = "https://petal-qc.docs.cern.ch/metrology.html"
20
20
 
21
21
  class CommaSeparatedListAction(Action):
22
22
  """Create a list from the comma sepparated numbers at imput."""