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)
dicebox.circumtri: implement "holyday", breaks the greatest safe simplex 14f067d43cde14f990e7a4136b61c548f3acde92 I am 2023-01-04 16:28:51
simplex: implement FullCubatureIntegration 072927115a8a641f89b39265085eb6cac27aa492 I am 2023-01-04 16:27:39
dicebox.circumtri: use mixed facet outside nodes as candidates only. 03c1c974dafa8ff041f032c89149da7fc5b90b39 I am 2023-01-03 15:55:57
shell: use query() method of the convex hull 321a3fab33684cb9bef3c2344200c6519b595bb0 I am 2023-01-03 15:54:45
convex_hull.QHull: implement query() method. Use myshovskych sheme as fallback bc79a6fbee4d488211bf55c88702f39a0126be1b I am 2023-01-03 15:53:00
dicebox.circumtri: handle singular matrix error of CircumCenter 8207789777268039e7a866a594191063c6429c04 I am 2023-01-02 23:56:40
simplex.CubatureIntegration: check for non-finite simplex volumes 3a1473c7452c7dc3a9299ed88520412eb31924c1 I am 2023-01-02 22:51:14
dicebox.circumtri: return to psi potential 9db1f5b0e412ae871ae5f5fbb5ff214a8ddd7f45 I am 2023-01-02 22:20:28
dicebox.circumtri: bughunting 5f9d2b9e4d8077c9e4552d47bf1da789d8cfbcf8 I am 2022-12-29 15:02:14
dicebox.circumtri: process filtered integration nodes as candidates too 315e2f9700d93f1379985dafa818b44df53422a2 I am 2022-12-29 13:51:52
dicebox.circumtri: return back weighted entropy 0424243e29a600ecb1d046631badbc9797e11369 I am 2022-12-28 19:11:30
qt_gui.qt_graph_widgets: reflect renewed simplex estimators 90c83c7c7e6e58d6b9044db1a5e55f9a8a7dd7cd I am 2022-12-28 16:15:40
dicebox: rework CircumTri e360b2f092c11a42b5ac1081061f2891bff3d8de I am 2022-12-28 15:52:28
simplex: make _Triangulation more clean; rework CubatureIntegration fb7dd9fef8592944fbd93a3f07b44c2355d45e20 I am 2022-12-28 15:48:20
introduce shell module, clean version of ghull b13e9b2b15d109770e0c3fbdd5bb7b2a3b5bf5fc I am 2022-12-28 15:45:27
qt_gui.qt_plot.CandidatesWidget: regression fix a75874b5a53e7b420672b582f3ff415b17a32e9b I am 2022-12-23 12:19:51
qt_gui.qt_pairwise.ContactWidget: add mask function 6f88fec7db92e5cd21826a06f42a609a3e03cb6b I am 2022-12-21 15:20:01
qt_gui.qt_pairwise.ContactWidget: add option for mixed pairs only adjacency search. 2f87e8a18908de607b8abc0779448ca3095c134c I am 2022-12-21 14:30:23
qt_gui.qt_dicebox: reflect changes in CircumTri class 9821d389240a383f0b13b7dd92cd501e1c40c537 I am 2022-12-15 09:36:16
dicebox.circumtri: employ _Exploration class. Keep naive CircumTri class in renamed module b8605fb24d55b3296ceac34afba541a5b7ee3070 I am 2022-12-15 09:33:59
Commit 14f067d43cde14f990e7a4136b61c548f3acde92 - dicebox.circumtri: implement "holyday", breaks the greatest safe simplex
Author: I am
Author date (UTC): 2023-01-04 16:28
Committer name: I am
Committer date (UTC): 2023-01-04 16:28
Parent(s): 072927115a8a641f89b39265085eb6cac27aa492
Signer:
Signing key:
Signing status: N
Tree: 496097d137716744eef3ef3ff56cadb86a0a7a7d
File Lines added Lines deleted
wellmet/dicebox/_exploration.py 4 0
wellmet/dicebox/circumtri.py 143 10
wellmet/qt_gui/qt_dicebox.py 15 5
File wellmet/dicebox/_exploration.py changed (mode: 100644) (index 5099431..41e448f)
... ... class _Exploration:
28 28 def __call__(bx): def __call__(bx):
29 29 if bx.nsim < 1: # je to legální if bx.nsim < 1: # je to legální
30 30 return bx.f_model.new_sample([], space='G', extend=True) return bx.f_model.new_sample([], space='G', extend=True)
31 elif bx.holydays and not bx.nsim % bx.holydays:
32 bx._logger(msg='holyday!')
33 return bx.holyday()
31 34 elif bx.to_refine > bx.to_explore: elif bx.to_refine > bx.to_explore:
32 35 bx._logger(msg='refine!') bx._logger(msg='refine!')
33 36 return bx.refine() return bx.refine()
 
... ... ExplorationLog = namedtuple('ExplorationLog', (
87 90
88 91
89 92 class DumbExploration(_Exploration): class DumbExploration(_Exploration):
93 holydays = 0
90 94
91 95 #č hull musí být v G prostoru s auto_update=True #č hull musí být v G prostoru s auto_update=True
92 96 def __init__(bx, sample_box, q=10): def __init__(bx, sample_box, q=10):
File wellmet/dicebox/circumtri.py changed (mode: 100644) (index d69f288..c733b99)
... ... TriEstimation = namedtuple('TriEstimation', (
28 28 *shell.ShellEstimation._fields, *shell.ShellEstimation._fields,
29 29 'success_points', 'success_points',
30 30 'failure_points', 'failure_points',
31 'success',
32 *sx.FastCubatureEstimation._fields[2:],
31 *sx.CubatureEstimation._fields[2:],
32 'p_sum',
33 33 'max_potential' 'max_potential'
34 34 )) ))
35 35
36 36
37 class CircumTri(_Exploration):
37 class FullCircumTri(_Exploration):
38 38
39 39 #č míží nám sampling_space: Ghull umí vzorkovat outside pouze v G prostoru #č míží nám sampling_space: Ghull umí vzorkovat outside pouze v G prostoru
40 40 #č quadpy umístí integráční bodíky v prostoru triangulace. #č quadpy umístí integráční bodíky v prostoru triangulace.
41 41 def __init__(bx, sample_box, scheme, q=10, psi_q=0.5, circumcenters_only=True, def __init__(bx, sample_box, scheme, q=10, psi_q=0.5, circumcenters_only=True,
42 store_candidates_metainformation=False, shell_budget=1000):
42 holydays=10, store_candidates_metainformation=False, shell_budget=1000):
43 43
44 44 bx.sample_box = sample_box bx.sample_box = sample_box
45 45 bx.scheme = scheme bx.scheme = scheme
 
... ... class CircumTri(_Exploration):
54 54 bx.circumcenters_only = circumcenters_only bx.circumcenters_only = circumcenters_only
55 55 bx.q = q bx.q = q
56 56 bx.psi_q = psi_q bx.psi_q = psi_q
57
57 bx.holydays = holydays
58 58
59 59 bx.direct_plan = quadpy.un.mysovskikh_1(bx.nvar).points bx.direct_plan = quadpy.un.mysovskikh_1(bx.nvar).points
60 60 bx.sball = sball.Sball(bx.nvar) bx.sball = sball.Sball(bx.nvar)
 
... ... class CircumTri(_Exploration):
76 76 # kind of interface to CandidatesWidget # kind of interface to CandidatesWidget
77 77 bx.candidates_index = {} bx.candidates_index = {}
78 78 bx.potential_index = ValueSortedDict() bx.potential_index = ValueSortedDict()
79 bx.global_potential_index = ValueSortedDict()
79 80
80 81 bx.regen() bx.regen()
81 82
 
... ... class CircumTri(_Exploration):
87 88 return {'sample_box':bx.sample_box, 'scheme':bx.scheme.name, return {'sample_box':bx.sample_box, 'scheme':bx.scheme.name,
88 89 'shell_budget':bx.shell_budget, 'shell_budget':bx.shell_budget,
89 90 'circumcenters_only':bx.circumcenters_only, 'circumcenters_only':bx.circumcenters_only,
90 'q':bx.q, 'psi_q':bx.psi_q}
91 'q':bx.q, 'psi_q':bx.psi_q, 'holydays':bx.holydays}
91 92
92 93 def __repr__(bx): def __repr__(bx):
93 94 return "%s(**%s)"%(bx.__class__.__name__, repr(bx.init_parameters())) return "%s(**%s)"%(bx.__class__.__name__, repr(bx.init_parameters()))
 
... ... class CircumTri(_Exploration):
106 107 return bx.f_model(1) return bx.f_model(1)
107 108
108 109
110 def holyday(bx):
111 if len(bx.candidates_index):
112 # return node with the greatest potential
113 key, value = bx.global_potential_index.peekitem()
114 return bx.candidates_index[key]
115 else:
116 bx._logger(msg='triangulation does not exist yet. Fallback to random sample')
117 return bx.f_model(1)
118
109 119 def regen(bx): def regen(bx):
110 120 """ """
111 121 regen() recreates data structures of the box. regen() recreates data structures of the box.
 
... ... class CircumTri(_Exploration):
117 127
118 128 bx.candidates_index.clear() bx.candidates_index.clear()
119 129 bx.potential_index.clear() bx.potential_index.clear()
130 bx.global_potential_index.clear()
120 131
121 132 bx._regen_outside() bx._regen_outside()
122 133 bx._regen_inside() bx._regen_inside()
 
... ... class CircumTri(_Exploration):
183 194
184 195
185 196
197 #č teď je to kolbek, který volá Triangulation
198 def _on_safe_added(bx, simplex, indices, vertices_model, nodes, vol):
199
200 try:
201 circum_center = bx.CC.get_circumcenter(vertices_model)
202 except BaseException as e:
203 bx._logger(repr(e), msg='CircumCenter error')
204 return
205 r = distance.euclidean(circum_center, vertices_model[0])
206 circum_node = bx.f_model.new_sample(circum_center, space=bx.tri_space)
207 #č můžeme nechat numpy pole z jednoho prvku. Můžeme zredukovat na float
208 #circum_pdf = circum_node.pdf(bx.tri_space)
209 circum_pdf = float(circum_node.pdf(bx.tri_space))
210
211
212 PDF = bx.Tri.PDF[indices]
213 max_PDF = np.max(PDF)
214
215 circum_potential = r**bx.nvar * circum_pdf**bx.psi_q * max_PDF**(1-bx.psi_q)
216
217 if not np.isfinite(circum_potential):
218 return
219
220 result_node = circum_node
221 result_potential = circum_potential
222
223 if bx.store_candidates_metainformation:
224 result_node = CandyNodes(result_node)
225 result_node.potential = result_potential
226
227 bx.candidates_index[simplex] = result_node
228 bx.global_potential_index[simplex] = result_potential
229
230
231
186 232 #č teď je to kolbek, který volá Triangulation #č teď je to kolbek, který volá Triangulation
187 233 def _on_mixed_added(bx, simplex, indices, vertices_model, nodes, _vol, fr, wfr, _mfpdf): def _on_mixed_added(bx, simplex, indices, vertices_model, nodes, _vol, fr, wfr, _mfpdf):
188 234
 
... ... class CircumTri(_Exploration):
246 292
247 293 bx.candidates_index[simplex] = result_node bx.candidates_index[simplex] = result_node
248 294 bx.potential_index[simplex] = result_potential bx.potential_index[simplex] = result_potential
295 bx.global_potential_index[simplex] = result_potential
249 296
250 297
251 298
 
... ... class CircumTri(_Exploration):
255 302 #č sx.on_delete_simplex(indices=indices) #č sx.on_delete_simplex(indices=indices)
256 303 def _invalidate_simplex(bx, simplex): def _invalidate_simplex(bx, simplex):
257 304 bx.potential_index.pop(simplex, None) bx.potential_index.pop(simplex, None)
305 bx.global_potential_index.pop(simplex, None)
258 306 bx.candidates_index.pop(simplex, None) bx.candidates_index.pop(simplex, None)
259 307
260 308
 
... ... class CircumTri(_Exploration):
285 333
286 334 def __regen_inside(bx): def __regen_inside(bx):
287 335 try: try:
288 bx.Tri = sx.CubatureIntegration(bx.samplebox, bx.scheme,\
336 if bx.holydays:
337 Integrator = sx.FullCubatureIntegration
338 else:
339 Integrator = sx.FastCubatureIntegration
340
341 bx.Tri = Integrator(bx.samplebox, bx.scheme,\
289 342 tri_space=bx.tri_space, incremental=True,\ tri_space=bx.tri_space, incremental=True,\
343 on_safe_added=bx._on_safe_added,\
290 344 on_mixed_added=bx._on_mixed_added,\ on_mixed_added=bx._on_mixed_added,\
291 345 on_delete_simplex=bx._invalidate_simplex) on_delete_simplex=bx._invalidate_simplex)
292 346
 
... ... class CircumTri(_Exploration):
351 405 try: try:
352 406 mask = bx.is_mixed(bx.convex_hull.simplices[i]) mask = bx.is_mixed(bx.convex_hull.simplices[i])
353 407 if not np.any(mask): if not np.any(mask):
354 return
408 return
355 409 outside_nodes = outside_nodes[mask] outside_nodes = outside_nodes[mask]
356 410 d = d[mask] d = d[mask]
357 411
 
... ... class CircumTri(_Exploration):
381 435 bx.candidates_index[-1] = outside_node bx.candidates_index[-1] = outside_node
382 436 bx.potential_index.pop(-1) bx.potential_index.pop(-1)
383 437 bx.potential_index[-1] = max_node_potential bx.potential_index[-1] = max_node_potential
438 bx.global_potential_index.pop(-1)
439 bx.global_potential_index[-1] = max_node_potential
384 440
385 441
386 442
 
... ... class CircumTri(_Exploration):
401 457 bx.candidates_index.pop(-1, None) bx.candidates_index.pop(-1, None)
402 458 #č těch kastomných slovníků se bojím... #č těch kastomných slovníků se bojím...
403 459 bx.potential_index.pop(-1, None) bx.potential_index.pop(-1, None)
460 bx.global_potential_index.pop(-1, None)
404 461 #bx.rating_index.pop(-1, None) #bx.rating_index.pop(-1, None)
405 462 bx.potential_index[-1] = 0 #č pro callback bx.potential_index[-1] = 0 #č pro callback
463 bx.global_potential_index[-1] = 0 #č pro callback
406 464
407 465 bx.shell_stats = bx.ghull.get_shell_estimation() bx.shell_stats = bx.ghull.get_shell_estimation()
408 466
 
... ... class CircumTri(_Exploration):
416 474
417 475
418 476
477 def get_pf_estimation(bx):
478 failsi = bx.failsi
479
480 success_points = len(failsi[~failsi])
481 failure_points = len(failsi[failsi])
482
483 if len(bx.candidates_index):
484 __key, max_potential = bx.potential_index.peekitem()
485 else:
486 max_potential = -1
487
488 if 'tri' in dir(bx):
489 tri_estimation = bx.Tri.get_pf_estimation()
490
491 bx.p_mixed = tri_estimation.mix
492 outside = bx.shell_estimation.outside
493 p_sum = outside + tri_estimation.failure + bx.p_mixed + tri_estimation.success
494
495 return TriEstimation(bx.nsim, #č musíme sami lepit nové etikety, neboť
496 *bx.shell_stats[1:], #č Ghull spouštíme sporadicky
497 *bx.shell_estimation,
498 success_points,
499 failure_points,
500 *tri_estimation[2:],
501 p_sum,
502 max_potential
503 )
504
505
506 #оӵ триангуляци ӧвӧл, иськем...
507 inside = bx.shell_estimation.inside
508
509 #č může se stát, že první dvě tečky už hned májí různé barvy,
510 #č ale žádnej simplex ještě nemáme.
511 #č takže celou skříňku prostě bereme jako simplex
512 event, event_id, fr, wfr = sx.get_simplex_event(bx, weighting_space=bx.tri_space)
513 # -1=outside, 0=success, 1=failure, 2=mix
514 tri_estimation = {0:0, 1:0, 2:0}
515 tri_estimation[event_id] = inside
516
517 success = tri_estimation[0]
518 failure = tri_estimation[1]
519 bx.p_mixed = mixed = tri_estimation[2]
520
521 return TriEstimation(bx.nsim, #č musíme sami lepit nové etikety, neboť
522 *bx.shell_stats[1:], #č Ghull spouštíme sporadicky
523 *bx.shell_estimation,
524 success_points,
525 failure_points,
526
527 success,
528 failure,
529 mixed,
530 inside * fr,
531 inside * wfr,
532 inside * wfr,
533 0, # nsimplex
534 #sx.tn_scheme.name,
535 bx.scheme.points.shape[1],
536 0, #sx.newly_invalidated,
537 0, #sx.newly_estimated,
538 0, #len(sx.failure_simplices),
539 0, #len(sx.mixed_simplices),
540 0, #len(sx.tri.coplanar),
541
542 1,
543 max_potential
544 )
545
546
547
548 class FastCircumTri(FullCircumTri):
549
419 550 def get_pf_estimation(bx): def get_pf_estimation(bx):
420 551 failsi = bx.failsi failsi = bx.failsi
421 552
 
... ... class CircumTri(_Exploration):
442 573 success_points, success_points,
443 574 failure_points, failure_points,
444 575 success, success,
445 *tri_estimation[2:],
576 *tri_estimation[3:],
577 1,
446 578 max_potential max_potential
447 579 ) )
448 580
 
... ... class CircumTri(_Exploration):
466 598 *bx.shell_estimation, *bx.shell_estimation,
467 599 success_points, success_points,
468 600 failure_points, failure_points,
469 success,
470 601
602 success,
471 603 failure, failure,
472 604 mixed, mixed,
473 605 inside * fr, inside * fr,
 
... ... class CircumTri(_Exploration):
482 614 0, #len(sx.mixed_simplices), 0, #len(sx.mixed_simplices),
483 615 0, #len(sx.tri.coplanar), 0, #len(sx.tri.coplanar),
484 616
617 1,
485 618 max_potential max_potential
486 619 ) )
487 620
File wellmet/qt_gui/qt_dicebox.py changed (mode: 100644) (index 496e068..f8e3f97)
... ... import numpy as np
3 3 from .. import schemes from .. import schemes
4 4 from ..candybox import CandyBox from ..candybox import CandyBox
5 5 from ..dicebox.goal import Goal, Razitko, DiceBox from ..dicebox.goal import Goal, Razitko, DiceBox
6 from ..dicebox.circumtri import CircumTri
6 from ..dicebox.circumtri import FullCircumTri, FastCircumTri
7 7 from ..dicebox._exploration import DumbExploration from ..dicebox._exploration import DumbExploration
8 8 import pyqtgraph as pg import pyqtgraph as pg
9 9 from pyqtgraph.Qt import QtCore, QtWidgets from pyqtgraph.Qt import QtCore, QtWidgets
 
... ... class CircumTriWidget(pg.parametertree.ParameterTree):
96 96 q = np.log(self.box.nvar) / self.box.nvar**2 q = np.log(self.box.nvar) / self.box.nvar**2
97 97 params.append({'name': 'psi_q', 'type': 'float', \ params.append({'name': 'psi_q', 'type': 'float', \
98 98 'title': "psi_q", \ 'title': "psi_q", \
99 'limits': (0, 1), 'value': q, 'default': q,\
99 'limits': (0, 1), 'value': 0.5, 'default': q,\
100 100 'tip': "Used for psi potential calculation"}) 'tip': "Used for psi potential calculation"})
101 101
102 102 params.append({'name': 'shell_budget', 'type': 'int', \ params.append({'name': 'shell_budget', 'type': 'int', \
 
... ... class CircumTriWidget(pg.parametertree.ParameterTree):
104 104 'limits': (1, float('inf')), 'value': 1000, 'default': 1000,\ 'limits': (1, float('inf')), 'value': 1000, 'default': 1000,\
105 105 'tip': "Number of annulus candidates"}) 'tip': "Number of annulus candidates"})
106 106
107 params.append({'name': 'holydays', 'type': 'int', \
108 'title': "holydays", \
109 'limits': (0, float('inf')), 'value': 10, 'default': 10,\
110 'tip': "Every n-th point is sacrificed to the greatest safe simplex. 0 to switch off"})
111
107 112
108 113 ### Create tree of Parameter objects ### Create tree of Parameter objects
109 114 # I don't know why that signals do not work for me # I don't know why that signals do not work for me
 
... ... class CircumTriWidget(pg.parametertree.ParameterTree):
141 146
142 147 scheme = schemes.get_tn_scheme(self.scheme, self.box.nvar, self.degree) scheme = schemes.get_tn_scheme(self.scheme, self.box.nvar, self.degree)
143 148
144 self.box.sample_box = CircumTri(
149 if self.holydays:
150 Box = FullCircumTri
151 else:
152 Box = FastCircumTri
153
154 self.box.sample_box = Box(
145 155 self.box.sample_box, #č rekurze) self.box.sample_box, #č rekurze)
146 156 scheme, scheme,
147 157 #potential_mode=self.potential_mode, #potential_mode=self.potential_mode,
 
... ... class CircumTriWidget(pg.parametertree.ParameterTree):
149 159 q=self.q, q=self.q,
150 160 psi_q=self.psi_q, psi_q=self.psi_q,
151 161 shell_budget=self.shell_budget, shell_budget=self.shell_budget,
152 circumcenters_only=self.circumcenters_only
153 #weighted_entropy=self.weighted_entropy
162 circumcenters_only=self.circumcenters_only,
163 holydays=self.holydays
154 164 ) )
155 165
156 166
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