iam-git / WellMet (public) (License: MIT) (since 2021-08-31) (hash sha1)
WellMet is pure Python framework for spatial structural reliability analysis. Or, more specifically, for "failure probability estimation and detection of failure surfaces by adaptive sequential decomposition of the design domain".
List of commits:
Subject Hash Author Date (UTC)
qt_gui: improve GRaph to show r-R bounds 59fa5bde7be2197b1f739bd1f829f927cef62603 I am 2023-01-17 14:26:16
dicebox.circumtri: calculate event's radia c6868cfbde7c8a86b73217da544f60e94a117bd8 I am 2023-01-16 06:12:34
simplex.Triangulation.get_averaged_mixed_normals: implement deep averaging 6dfb056e477479331c7a903ea52a98301fca4e71 I am 2023-01-15 23:26:43
replace flatten() by reshape(-1) everywhere. The former always allocates new array 97b35c989a5ad8e459bb60133222d50c7f78e1f0 I am 2023-01-15 12:04:30
qt_gui.qt_gui: explicitly export sample_box to console's namespace dd2e50245157082ddb645b693a8a8c573215d50c I am 2023-01-15 11:42:01
replace everywhere np.bool by just bool (it looks like newer numpy dropped it) ac208f89bbf0ad76d38790686041ea778a9b6376 I am 2023-01-15 11:31:56
simplex._Triangulation: implement averaged gradients() f6608597cf490dd6cf1a6af3b7d8e6d0a72732d9 I am 2023-01-15 09:37:14
add line and two lines problems for sensitivity analysis 0c620f7960399ed8b34e02d663772d0eb34e66f1 I am 2023-01-14 08:30:56
simplex.FullCubatureIntegration.get_sensitivities: do not normalize global gradient c648c484a5599a00236ab70c36cdf407c24f5306 I am 2023-01-14 04:51:16
simplex: implement sensitivities 65056319c51fd93deb76ce14e52c08869dfc04a2 I am 2023-01-13 11:27:46
mplot.maxes: prepare GRaph plot 68774535915af3deaf6104a0bbe9b3c4d24c0cec I am 2023-01-12 02:43:20
mplot.mgraph.tri_estimation_plot: use planar vertex estimator 1d300fa56248be9cdab5a4e5b0d4372f68fd5255 I am 2023-01-11 15:48:28
mplot.mart: implement lsf_boundary() contouring 8642d2f0c043f4e71af1cc45b9e25da326afd3ca I am 2023-01-11 05:20:00
mplot.mart.setup_labels: make labels more adaptive 60cd0b34a67b38df1c730dddc9e0771139818f33 I am 2023-01-11 04:35:47
simplex._SamplingTriangulation: self reference fix 79204ff15cba7c5ca24bb5b48e2073058acf00ae I am 2023-01-11 03:21:34
testcases.testcases_2D: add pf for rastrigin 4f3b35fe18496fcb9f59860174c876cb7a82749a I am 2023-01-10 23:39:45
dicebox.circumtri: fix initialization on ED loading. Use simple potential for space filling c02656e588a164685c4a750ce865c4b50f716563 I am 2023-01-10 23:37:30
simplex.FullCubatureIntegration.get_failure_moments: negative probabilities fix 27dd6bb1e5bb0eb1e28eef88e28913d1eca461da I am 2023-01-10 20:16:09
add more nD problems from literature 2380cdbdcf17dd5e0af19506c6f7bb1e838de03b I am 2023-01-10 06:13:56
f_models: implement Norm class 698c3216b1c8a0e2d57bfb33340a7ea8758d4e63 I am 2023-01-09 23:13:48
Commit 59fa5bde7be2197b1f739bd1f829f927cef62603 - qt_gui: improve GRaph to show r-R bounds
Author: I am
Author date (UTC): 2023-01-17 14:26
Committer name: I am
Committer date (UTC): 2023-01-17 14:26
Parent(s): c6868cfbde7c8a86b73217da544f60e94a117bd8
Signer:
Signing key:
Signing status: N
Tree: f7502f69953e41cd7213abaf62daac7813a1b31e
File Lines added Lines deleted
wellmet/qt_gui/qt_graph_widgets.py 181 2
wellmet/qt_gui/qt_gui.py 10 7
File wellmet/qt_gui/qt_graph_widgets.py changed (mode: 100644) (index 8d87e3a..6cde4d2)
... ... def update_xrange(plot_widget, xmax):
52 52
53 53
54 54 class GRaph(pg.PlotWidget): class GRaph(pg.PlotWidget):
55 def __init__(self, stream, parent=None, *args, **kwargs):
55 update_xrange = update_xrange
56
57 def __init__(self, stream, box_data=None, parent=None, *args, **kwargs):
56 58 super().__init__(parent, *args, **kwargs) super().__init__(parent, *args, **kwargs)
57 59 #č tím potokem je myšleno hlavní okínko #č tím potokem je myšleno hlavní okínko
58 60 self.stream = stream self.stream = stream
61 self.box_data = box_data
62 if box_data is not None:
63 box_data.estimations_updated.connect(self.stm_replot)
64 self.setup_context_menu(box_data.TRI_menu)
65
59 66 self.stream.box_runned.connect(self.replot) self.stream.box_runned.connect(self.replot)
60 67 self.stream.slice_changed.connect(self.replot) self.stream.slice_changed.connect(self.replot)
61 68
62 69 self.stream.redraw_called.connect(self.redraw) self.stream.redraw_called.connect(self.redraw)
63 70
64
65 71 self.redraw() self.redraw()
66 72
67 73
68 74
75
76
77
69 78 def redraw(self): def redraw(self):
70 79 self.clear() self.clear()
71 80 self.setBackground('w') self.setBackground('w')
72 81 #č y limita v podstatě znemožní Log y graf #č y limita v podstatě znemožní Log y graf
73 82 #size=self.w.px_size*1.5 #size=self.w.px_size*1.5
83
84 # box part
74 85 pos = () #np.empty((nsim, 4)) pos = () #np.empty((nsim, 4))
75 86 size = self.stream.px_size * 2 size = self.stream.px_size * 2
76 87 self.failures = self.plot(pos, pen=None, symbol='x', symbolPen='r',\ self.failures = self.plot(pos, pen=None, symbol='x', symbolPen='r',\
 
... ... class GRaph(pg.PlotWidget):
94 105 symbolSize=size, name='Nodes') symbolSize=size, name='Nodes')
95 106 self.nodes.setZValue(80) self.nodes.setZValue(80)
96 107
108
109 self.f_max_ruler = self.addLine(y=0, pen='r')
110 self.f_min_ruler = self.addLine(y=0, pen='r')
111
112 pen = pg.mkPen(color='b', width=1.5) # blue
113 if hasattr(self.stream.sample_box, 'r_exact'):
114 exact_name = "r_exact"
115 y = self.stream.sample_box.r_exact
116 self.r_exact = self.addLine(y=y, pen=pen, name=exact_name)
117 #č aby se nám něco zobrazovalo v legendu
118 self.r_exact_PR = self.plot((), (), pen=pen, name=exact_name)
119 self.f_min_ruler.show()
120
121 if hasattr(self.stream.sample_box, 'R_exact'):
122 exact_name = "R_exact"
123 y = self.stream.sample_box.R_exact
124 self.R_exact = self.addLine(y=y, pen=pen, name=exact_name)
125 #č aby se nám něco zobrazovalo v legendu
126 self.R_exact_PR = self.plot((), (), pen=pen, name=exact_name)
127 self.f_max_ruler.show()
128 else:
129 self.f_max_ruler.hide()
130
97 131 self.replot() self.replot()
98 132
99 133
134
135 # estimation part
136 if self.box_data is not None:
137 x = y = () # zde jen vytvoříme kostru, nakrmime daty v .redraw()
138
139 #xkcd_green = (167, 255, 181) # xkcd:light seafoam green #a7ffb5
140 green = (159, 255, 173)
141 xkcd_red = (253, 193, 197) # xkcd: pale rose (#fdc1c5)
142 red = xkcd_red #(253, 0, 17)
143 #xkcd_cream = (255, 243, 154) # let's try xkcd: dark cream (#fff39a)
144 cream = (255, 242, 159)
145 grey = (233, 233, 233)
146
147 self.r_success = self.plot(x, y)
148 self.r_success.setZValue(-1000)
149 self.R_success = self.plot(x, y)
150 self.R_success.setZValue(-1000)
151
152 self.fill_s = pg.FillBetweenItem(self.r_success, self.R_success)
153 #self.fill_mix.setData(name="mixed simplices measure")
154 self.fill_s.setBrush(green)
155 self.fill_s.setZValue(-1000)
156 self.addItem(self.fill_s)
157
158 self.r_f = self.plot(x, y)
159 self.r_f.setZValue(-500)
160 self.R_f = self.plot(x, y)
161 self.R_f.setZValue(-500)
162
163 self.fill_f = pg.FillBetweenItem(self.r_f, self.R_f)
164 #self.fill_mix.setData(name="mixed simplices measure")
165 self.fill_f.setBrush(red)
166 self.fill_f.setZValue(-500)
167 self.addItem(self.fill_f)
168
169 self.r_mix = self.plot(x, y)
170 self.r_mix.setZValue(-150)
171 self.R_mix = self.plot(x, y)
172 self.R_mix.setZValue(-150)
173
174 self.fill_mix = pg.FillBetweenItem(self.r_mix, self.R_mix)
175 #self.fill_mix.setData(name="mixed simplices measure")
176 self.fill_mix.setBrush(cream)
177 self.fill_mix.setZValue(-150)
178 self.addItem(self.fill_mix)
179
180 self.r = self.plot(x, y)
181 self.r.setZValue(-10)
182 self.R = self.plot(x, y)
183 self.R.setZValue(-10)
184
185 #self.pen_outside = self.plot(x, y)
186 self.fill_outside = pg.FillBetweenItem(self.r, self.R)
187 #self.fill_outside.setData(name="out of sampling domain estimation")
188 self.fill_outside.setBrush(grey)
189 self.fill_outside.setZValue(-10)
190 self.addItem(self.fill_outside)
191
192 self.stm_replot(self.box_data.df)
193
194
195
196
197
100 198 def replot(self): def replot(self):
101 199 nsim = self.stream.slider.value() nsim = self.stream.slider.value()
102 200
 
... ... class GRaph(pg.PlotWidget):
113 211 if hasattr(sample_box, 'failsi'): #č to je normálně sample_box if hasattr(sample_box, 'failsi'): #č to je normálně sample_box
114 212 failsi = sample_box.failsi failsi = sample_box.failsi
115 213
214 if np.any(failsi):
215 f_radia = lengths[failsi]
216 if hasattr(self.stream.sample_box, 'R_exact'):
217 self.f_max_ruler.setPos(np.max(f_radia))
218 self.f_max_ruler.show()
219 self.f_min_ruler.setPos(np.min(f_radia))
220 self.f_min_ruler.show()
221 else:
222 self.f_max_ruler.hide()
223 self.f_min_ruler.hide()
224
116 225 try: # proxy denotes implicitly-known values try: # proxy denotes implicitly-known values
117 226 proxy = sample_box.proxy.astype(bool) proxy = sample_box.proxy.astype(bool)
118 227 except AttributeError: except AttributeError:
 
... ... class GRaph(pg.PlotWidget):
133 242 else: #č není to teda sample_box... else: #č není to teda sample_box...
134 243 #č snad se nám povede nakreslit aspoň tečky? #č snad se nám povede nakreslit aspoň tečky?
135 244 self.draw(self.nodes, pos) self.draw(self.nodes, pos)
245 self.f_max_ruler.hide()
246 self.f_min_ruler.hide()
136 247
137 248
138 249 @staticmethod @staticmethod
 
... ... class GRaph(pg.PlotWidget):
149 260
150 261
151 262
263 def setup_context_menu(self, menu):
264 # creates instance of LegendItem
265 # and saves it into plotItem.legend
266 self.legend = self.addLegend()
267
268 self.plotItem.ctrl.xGridCheck.setChecked(True)
269 self.plotItem.ctrl.yGridCheck.setChecked(True)
270
271 # delete build-in Transforms (with Log_x and Log_y) options,
272 # they can cause uncachable exception (on any zero in data) and crash
273 self.plotItem.ctrlMenu.removeAction(self.plotItem.ctrlMenu.actions()[0])
274
275 #č já se bojím. radší to uložím
276 self.custom_menu = self.plotItem.vb.menu.addMenu("TRI options")
277
278 self.plotItem.vb.menu.addMenu(menu)
279
280 self.legend_chk = QtGui.QAction("Legend", self.custom_menu)
281 self.legend_chk.setCheckable(True)
282 self.legend_chk.triggered.connect(lambda: self.legend.setVisible(self.legend_chk.isChecked()))
283 self.custom_menu.addAction(self.legend_chk)
284 # apply custom menu option
285 self.legend.setVisible(self.legend_chk.isChecked())
286
287 self.laction = QtGui.QAction("Show labels", self.custom_menu)
288 self.laction.triggered.connect(self.show_labels)
289 self.custom_menu.addAction(self.laction)
290
291
292 def show_labels(self):
293 self.setLabel('left', "Distsnce from origin in G space")
294 self.setLabel('bottom', "Number of simulations")
295
296
297 @staticmethod
298 def _set_data(plot_item, serie):
299 x, y = serie.index.to_numpy() - 1, serie.to_numpy()
300 mask = y >= 0
301 plot_item.setData(x[mask], y[mask])
302
303
304 def stm_replot(self, df):
305 if len(df) < 2: #č nevím proč hazí chyby. Asi kvůli zadané širce.
306 return
307
308 if 'r' in df:
309 self._set_data(self.r, df['r'])
310 self._set_data(self.R, df['R'])
311
312 if 'r_safe' in df:
313 self._set_data(self.r_success, df['r_safe'])
314 self._set_data(self.R_success, df['R_safe'])
315
316 if 'r_mixed' in df:
317 self._set_data(self.r_mix, df['r_mixed'])
318 self._set_data(self.R_mix, df['R_mixed'])
319
320
321 if 'r_failure' in df:
322 self._set_data(self.r_f, df['r_failure'])
323 self._set_data(self.R_f, df['R_failure'])
324
325
326 xmax = df.index.max()
327 self.update_xrange(xmax*1.02)
328
329
330
152 331
153 332
154 333
File wellmet/qt_gui/qt_gui.py changed (mode: 100644) (index 2aba2a2..8cebfb0)
... ... class QtGuiWindow(QtWidgets.QMainWindow):
261 261
262 262 #č graphy už nemusí jít po stm widgetech #č graphy už nemusí jít po stm widgetech
263 263 self.setup_graph_widgets() self.setup_graph_widgets()
264
265 dock = QtWidgets.QDockWidget("GRaph", self)
266 dock.setWidget(gw.GRaph(self, dock))
267 self.dockables.append(dock)
268 self.tabifyDockWidget(self.dockables[0], dock)
269
270 264
271 265
272 266 dock = dock_l = QtWidgets.QDockWidget("Box tree", self) dock = dock_l = QtWidgets.QDockWidget("Box tree", self)
 
... ... class QtGuiWindow(QtWidgets.QMainWindow):
292 286
293 287 def setup_graph_widgets(self): def setup_graph_widgets(self):
294 288 if not hasattr(self.sample_box, 'estimations'): if not hasattr(self.sample_box, 'estimations'):
289 dock = QtWidgets.QDockWidget("GRaph", self)
290 dock.setWidget(gw.GRaph(self, None, dock))
291 self.dockables.append(dock)
292 self.tabifyDockWidget(self.dockables[0], dock)
293
295 294 return return
296 295
297 296 if hasattr(self.sample_box, 'box_estimations'): if hasattr(self.sample_box, 'box_estimations'):
 
... ... class QtGuiWindow(QtWidgets.QMainWindow):
330 329 dock.setWidget(gw.VoronoiEstimationGraph(self.sample_box, self, dock)) dock.setWidget(gw.VoronoiEstimationGraph(self.sample_box, self, dock))
331 330 self.dockables.append(dock) self.dockables.append(dock)
332 331 self.tabifyDockWidget(self.dockables[0], dock) self.tabifyDockWidget(self.dockables[0], dock)
333
332
333 dock = QtWidgets.QDockWidget("GRaph", self)
334 dock.setWidget(gw.GRaph(self, self.box_estimation_data, dock))
335 self.dockables.append(dock)
336 self.tabifyDockWidget(self.dockables[0], dock)
334 337
335 338 csv_filter = "CSV files (*.csv)" csv_filter = "CSV files (*.csv)"
336 339 npy_filter = "NumPy binary files (*.npy)" npy_filter = "NumPy binary files (*.npy)"
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/iam-git/WellMet

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/iam-git/WellMet

Clone this repository using git:
git clone git://git.rocketgit.com/user/iam-git/WellMet

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main