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)
convex_hull: move QHull from simplex module e5c67ce54fa4c9f3ce15714ebeff7d363d918494 I am 2021-04-17 19:04:00
schemes: comment out dups 8d22480a42926c3a78e62a07be4418e1f8ba350f I am 2021-04-16 23:35:53
convex_hull: split DirectHull into simplified DirectHull itself and CompleteHull b109bbdc325a2a88bf22e9893fa162690bf190f9 I am 2021-04-16 23:26:03
rework convex hull 60185dce0403ba941e849a60b5e43da6ce1fffd4 I am 2021-04-12 17:09:25
sball: add .get_random_directions() function d41131f28937e40eb853a30047de3cfc43cf5fa8 I am 2021-03-24 03:24:41
mplot: plot2D swithed to matplotlib 366326fb53bcbc54d7e6fb108b9dc256833bf679 I am 2021-03-18 01:44:07
three-ways image WIP a2987cde393c4e795342f6dc40d5920760b468d4 I am 2021-03-17 16:37:18
Ghull is ready e1a49fe0cb390ce9664e8f892c1da6d30231cc99 I am 2021-03-16 14:29:09
simplex: finish Ghull 5cb6d06a1c77cdb0cc1d3e83cfb217924b2345f1 I am 2021-03-03 23:06:13
simplex.Ghull: WIP 043724e7d4fe0c25ac698becf6498bc2abb8bf29 I am 2021-03-03 17:06:08
sball: je naimplementována třída Shell b335ba64be48582ca2f31baf035d0f5c6c75090c I am 2021-03-03 13:45:02
sball: new gamma-based solution. Keep the old version as well b6ac51b6b08ca2e7d5c398fa56c5a9a0832ab301 I am 2021-02-24 10:55:11
mart: add convergence plot 85a9ef727d15fc6567b7b0a594ed52cef9fe5680 I am 2021-02-22 23:32:34
mart: add basic plot and scatter functions 20e04c27db7ee3ac3a6418300eb4fc1ef532a1c7 I am 2021-02-22 14:45:31
mart: add convex hull related functions 5284e4c1c747fe25d220e7e3a6a9803d8bc6d4a1 I am 2021-02-21 20:57:52
axes3d_: draw only bottom pane 5a24020e052a7adbc17485b4c9c74d7eea801765 Alex 2021-02-12 20:50:09
mart3d: tri surface fix 2f1889070cea6c97937e00d76ce029744c9f8d07 Alex 2021-02-12 10:01:59
mart3d: add plot_wireframe 8b21a8ca659e4f2146459ea5f4cc006535f51308 I am 2021-02-12 04:45:56
mart and mart3d: add new functions fdbfd002214bf7ab7be8df8e90d6b96b62c82d13 I am 2021-02-10 17:18:02
qt_plot: update slider on redraw, add simplex estimation with no graphics 7b392cd9ee8487a620466fe757a17c7fcfff2770 I am 2021-02-09 23:00:32
Commit e5c67ce54fa4c9f3ce15714ebeff7d363d918494 - convex_hull: move QHull from simplex module
Author: I am
Author date (UTC): 2021-04-17 19:04
Committer name: I am
Committer date (UTC): 2021-04-17 19:04
Parent(s): 8d22480a42926c3a78e62a07be4418e1f8ba350f
Signer:
Signing key:
Signing status: N
Tree: e246a9678b447a3b9887f5108f80467c8d4f1479
File Lines added Lines deleted
convex_hull.py 138 1
qt_plot.py 1 1
File convex_hull.py changed (mode: 100644) (index 8e960e2..a83cd27)
... ... import numpy as np
6 6 from . import sball from . import sball
7 7 #from . import f_models #from . import f_models
8 8 from scipy import stats from scipy import stats
9 from scipy import spatial
9 10 from .candybox import CandyBox from .candybox import CandyBox
10 11
11 12
 
... ... class GBall:
49 50 def npoints(hull): def npoints(hull):
50 51 return len(hull.sample) return len(hull.sample)
51 52
53 @property
54 def nsimplex(hull):
55 return 1
56
52 57 #def update(hull): pass #def update(hull): pass
53 58
54 59 def is_inside(hull, nodes): def is_inside(hull, nodes):
 
... ... class BrickHull: #č nebo BoundingBrick
142 147 def npoints(hull): def npoints(hull):
143 148 return len(hull.sample) return len(hull.sample)
144 149
150 @property
151 def nsimplex(hull):
152 return hull.sample.nvar*2
153
145 154 @property @property
146 155 def A(hull): def A(hull):
147 156 hull._update() hull._update()
 
... ... class DirectHull:
224 233 def npoints(hull): def npoints(hull):
225 234 return len(hull.sample) return len(hull.sample)
226 235
236 @property
237 def nsimplex(hull):
238 return len(hull.direct_plan)
239
227 240 @property @property
228 241 def A(hull): def A(hull):
229 242 return hull.direct_plan return hull.direct_plan
 
... ... class CompleteHull:
331 344 def npoints(hull): def npoints(hull):
332 345 return len(hull.sample) return len(hull.sample)
333 346
347 @property
348 def nsimplex(hull):
349 return 2 * (len(hull.direct_plan) + hull.sample.nvar)
350
334 351 @property @property
335 352 def A(hull): def A(hull):
336 353 hull._update() hull._update()
 
... ... class CompleteHull:
404 421 return hull.sample.f_model.new_sample(fire_G, space='G') return hull.sample.f_model.new_sample(fire_G, space='G')
405 422
406 423
424 class QHull:
425 def __init__(self, sample, space='G', incremental=True):
426 self.sample = sample
427 self.incremental = incremental
428 self.space = space
429
430 def regen(self):
431 points = getattr(self.sample, self.space)
432 self.convex_hull = spatial.ConvexHull(points, incremental=self.incremental)
433
434 def enough_points(self): return self.sample.nvar < self.sample.nsim
435
436
437 def __getattr__(self, attr):
438 #č branime se rekurzii
439 # defend against recursion
440 #оӵ рекурсилы пезьдэт!
441 if attr == 'convex_hull':
442 #č zkusme rychle konvexní obálky sestavit
443 #č a ihned ji vrátit
444 self.regen()
445 return self.convex_hull
446
447 elif attr == 'A':
448 return self.convex_hull.equations[:,:-1]
449 elif attr == 'b':
450 return self.convex_hull.equations[:,-1]
451
452 elif attr == 'points':
453 if self.enough_points():
454 return self.convex_hull.points
455 else:
456 return getattr(self.sample, self.space)
457
458 elif attr == 'npoints':
459 if self.enough_points():
460 return self.convex_hull.npoints
461 else:
462 return len(self.sample)
463
464 elif attr == 'nsimplex':
465 if self.enough_points():
466 return self.convex_hull.nsimplex
467 else:
468 return 0
469
470
471 #ё По всем вопросам обращайтесь
472 #ё на нашу горячую линию
473 else:
474 self._update() #č dycky čerstý chleba!
475 return getattr(self.convex_hull, attr)
476
477
478 #č nejsem jist, jestli ten update vůbec dělat.
479 #č lze navrhnout třidu aj tak, že sama bude hlídat změny.
480 #č Jenomže, co kdybychom ten automatický update nechtěli?
481 def _update(self):
482 if self.convex_hull.npoints < self.sample.nsim:
483 if self.incremental:
484 points = getattr(self.sample, self.space)
485 self.convex_hull.add_points(points[self.convex_hull.npoints:])
486 else:
487 self.regen()
488
489
490 def is_inside(self, nodes):
491 if self.enough_points():
492 self._update()
493 x = getattr(nodes, self.space)
494
495 #E [normal, offset] forming the hyperplane equation of the facet (see Qhull documentation for more)
496 A = self.convex_hull.equations[:,:-1]
497 b = self.convex_hull.equations[:,-1]
498
499 # N=ns, E - number of hyperplane equations
500 ExN = A @ x.T + np.atleast_2d(b).T
501 mask = np.all(ExN < 0, axis=0)
502 return mask
503 else:
504 return np.full(len(nodes), False)
505
506 def is_outside(hull, nodes):
507 return ~hull.is_inside(nodes)
508
509 def get_design_points(hull):
510 hull._update()
511 sample_model = -hull.A * hull.b.reshape(-1,1)
512 return hull.sample.f_model.new_sample(sample_model, space=hull.space)
513
514
515 # shortcut for Ghull
516 # valid only if space==G
517 def get_r(hull):
518 if hull.space=='G':
519 if hull.enough_points():
520 hull._update()
521 b = hull.convex_hull.equations[:,-1]
522 return -np.nanmax(b)
523 else:
524 return 0
525 else:
526 return 0
527
528 def fire(hull, ns):
529 if hull.space == 'G':
530 A = hull.equations[:,:-1]
531 b = hull.equations[:,-1]
532
533 to_fire = np.argmax(b)
534 a = A[to_fire]
535 fire_from = stats.norm.cdf(hull.get_r())
536 t = np.linspace(fire_from, 1, ns)
537 t = stats.norm.ppf(t)
538 fire_G = t.reshape(-1,1) @ a.reshape(1,-1)
539
540 return hull.sample.f_model.new_sample(fire_G, space='G')
541
542
407 543 #č mým úkolem při návrhu této třidy je pořádně všecko zkomplikovat. #č mým úkolem při návrhu této třidy je pořádně všecko zkomplikovat.
408 544 #č Dostávám za to peníze. #č Dostávám za to peníze.
409 545 #č Takže. Udělám 3 druhů estimátorů #č Takže. Udělám 3 druhů estimátorů
 
... ... class Ghull:
442 578
443 579 # shell_estimation -22: inner, -3: shell, -11: outer # shell_estimation -22: inner, -3: shell, -11: outer
444 580 shell_estimation = {-22:shell.ps, -3: shell.p_shell, -11: shell.pf} shell_estimation = {-22:shell.ps, -3: shell.p_shell, -11: shell.pf}
445 global_stats = {"r":r, "R":R, "inner":shell.ps, "shell":shell.p_shell, "outer":shell.pf}
581 global_stats = {"nsim":self.sample.nsim, "nsimplex": self.hull.nsimplex, \
582 "r":r, "R":R, "inner":shell.ps, "shell":shell.p_shell, "outer":shell.pf}
446 583 return shell_estimation, global_stats return shell_estimation, global_stats
447 584
448 585 def integrate(self, nis): def integrate(self, nis):
File qt_plot.py changed (mode: 100644) (index 7012152..7a5fe07)
... ... class HullEstimationWidget(pg.LayoutWidget):
3083 3083 elif hull_model == 'QHull': elif hull_model == 'QHull':
3084 3084 space = self.param.getValues()['space'][0] space = self.param.getValues()['space'][0]
3085 3085 #č tento widget pokažde generuje obálku znovu #č tento widget pokažde generuje obálku znovu
3086 return stm.six.QHull(sample, space, incremental=False)
3086 return khull.QHull(sample, space, incremental=False)
3087 3087 else: else:
3088 3088 raise ValueError("HullEstimationWidget: co to je za obálku?") raise ValueError("HullEstimationWidget: co to je za obálku?")
3089 3089
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