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)
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
mart: WIP 81d970b1e515032f0414d1cc4c6d7473f187d162 I am 2021-02-09 19:38:36
mart3d: add scatter_points() 26644c64e3b996b68e1ee133e4531380d4e00090 I am 2021-02-08 18:03:51
mart3d: new matplotlib-support module 8b6b13937a0694998e0b4de7b8a96d89abecc64a I am 2021-02-08 13:47:56
gmodels: increased no of discretization points in boundary for Pareto function 7f12597e2d15b2564d612a014fd75492663043dd Miroslav Vořechovský 2021-02-05 15:28:32
gmodels.py added boundary for Pareto function e7bc61e9c5854bc4cff0ee05b651b4b7ede4e0a1 Miroslav Vořechovský 2021-02-05 15:14:52
improved estimation of pf for Pareto Example 427602319f6a81e896b7aa50fd8947c5a1a91873 Miroslav Vořechovský 2021-02-05 14:15:41
dicebox.Razitko: little fixes 0e3f9147a40b7008ddec0893c3965136bac7fedf I am 2021-02-05 12:32:27
f_models.UnCorD.sample_pdf: Rn pdf fix 66cf81e4fc0bb2c6dab506cef5309c5da65a7f2c I am 2021-02-05 12:31:22
dicebox.Razitko: TRI_overall_estimations workaround 4b8146b788d0a857330c1894b5cf1c8d332103ce I am 2021-02-05 09:13:16
dicebox.Razitko: new DiceBox d9c1c9cdec94601bce9e81861ce1d4dfb5393481 I am 2021-02-05 08:04:28
simplex.Triangulation: little changes dc1efc3a081073d57be0f7a06330eb97f9634447 I am 2021-02-05 08:02:57
schemes: fix 126ba1c061474b3a9c02ce66d109ef6f8a39703a Alex 2021-02-03 08:28:28
schemes: new module af427a6a8c5e26f5b4a5930af188e40c882f9863 I am 2021-02-03 08:00:06
simplex: rework Triangulation, add FullCubatureTriangulation bdbb5a64a868cbf7c60d2bfeb8729e54bc81d347 I am 2021-02-03 05:14:32
Commit 5284e4c1c747fe25d220e7e3a6a9803d8bc6d4a1 - mart: add convex hull related functions
Author: I am
Author date (UTC): 2021-02-21 20:57
Committer name: I am
Committer date (UTC): 2021-02-21 20:57
Parent(s): 5a24020e052a7adbc17485b4c9c74d7eea801765
Signer:
Signing key:
Signing status: N
Tree: 11d2c1d8566c44553472dc6c079d55f61656fefd
File Lines added Lines deleted
mart.py 71 0
mart3d.py 48 1
File mart.py changed (mode: 100644) (index 3110b2f..2fae30c)
... ... def plot_boundaries(ax, fmt='-b', nrod=200, **kwargs):
91 91 return lines return lines
92 92
93 93
94
95
96 def convex_plot(ax, fmt='-m', ns=100, **kwargs):
97 if ax.sample_box.nvar == 2:
98 simplices = ax.sample_box.convex_hull.simplices
99 # convex hull should be made in the same space as triangulation,
100 # Will we take coordinates in the triangulation space, I guess?
101 sampled_plan_tri = getattr(ax.sample_box, ax.sample_box.tri_space)
102
103 # hmm...
104 lines = []
105 if ax.space == ax.sample_box.tri_space:
106 for simplex in simplices:
107 xy = sampled_plan_tri[simplex]
108 x, y = xy.T
109 lines.append(ax.plot(x, y, fmt, **kwargs))
110
111 else:
112 #оӵ кулэ ӧвӧл обновлять экран карыны
113 for simplex in simplices:
114 start_id, end_id = simplex
115
116 x_bound = np.linspace(sampled_plan_tri[start_id,0], sampled_plan_tri[end_id,0], ns, endpoint=True)
117 y_bound = np.linspace(sampled_plan_tri[start_id,1], sampled_plan_tri[end_id,1], ns, endpoint=True)
118
119 # sample compatible
120 #оӵ малы транспонировать кароно? Озьы кулэ!
121 bound_tri = np.vstack((x_bound, y_bound)).T
122 #č vytvořme sample
123 bound = ax.sample_box.f_model.new_sample(bound_tri, space=ax.sample_box.tri_space)
124
125 xy = getattr(bound, ax.space)
126 x, y = xy.T
127 lines.append(ax.plot(x, y, fmt, **kwargs))
128
129
130 return lines
131
132
133
94 134 def isočáry(ax, space, ngrid=200, limits=None): def isočáry(ax, space, ngrid=200, limits=None):
95 135 if limits is None: if limits is None:
96 136 xmin, xmax = ax.get_xlim() xmin, xmax = ax.get_xlim()
 
... ... def isočáry(ax, space, ngrid=200, limits=None):
110 150 levels = misc.isolevels_2d(Z, const, np.flip(r_levels), from_top=False) levels = misc.isolevels_2d(Z, const, np.flip(r_levels), from_top=False)
111 151
112 152 return ax.contour(X, Y, Z.reshape(ngrid, ngrid), levels, linewidths=lw, colors=[[96/255, 64/255, 96/255], [0.5, 0.25, 0.5], [161/255, 72/255, 162/255]])#, alpha=0.5) colors: h=300, s=50% return ax.contour(X, Y, Z.reshape(ngrid, ngrid), levels, linewidths=lw, colors=[[96/255, 64/255, 96/255], [0.5, 0.25, 0.5], [161/255, 72/255, 162/255]])#, alpha=0.5) colors: h=300, s=50%
153
154
155
156
157 def center_spines(ax):
158 # Move the left and bottom spines to x = 0 and y = 0, respectively.
159 ax.spines["left"].set_position(("data", 0))
160 ax.spines["bottom"].set_position(("data", 0))
161
162 # Show the left and bottom spines
163 ax.spines["left"].set_visible(True)
164 ax.spines["bottom"].set_visible(True)
165
166 # Hide the top and right spines.
167 ax.spines["top"].set_visible(False)
168 ax.spines["right"].set_visible(False)
169
170 # Draw arrows (as black triangles: ">k"/"^k") at the end of the axes. In each
171 # case, one of the coordinates (0) is a data coordinate (i.e., y = 0 or x = 0,
172 # respectively) and the other one (1) is an axes coordinate (i.e., at the very
173 # right/top of the axes). Also, disable clipping (clip_on=False) as the marker
174 # actually spills out of the axes.
175 ax.plot(1, 0, ">k", transform=ax.get_yaxis_transform(), clip_on=False)
176 ax.plot(0, 1, "^k", transform=ax.get_xaxis_transform(), clip_on=False)
177
178
179 def fix_locator(ax, loc):
180 loc_x = mpl.ticker.FixedLocator(loc)
181 ax.xaxis.set_major_locator(loc_x)
182 loc_y = mpl.ticker.FixedLocator(loc)
183 ax.yaxis.set_major_locator(loc_y)
File mart3d.py changed (mode: 100644) (index 538b059..04326fe)
... ... import numpy as np
9 9 from matplotlib import colors from matplotlib import colors
10 10 import matplotlib.tri as mtri import matplotlib.tri as mtri
11 11
12 from .simplex import is_outside
13
12 14 # copied from simplex module # copied from simplex module
13 15 # just don't want every time import simplex and its dependencies # just don't want every time import simplex and its dependencies
14 16 def get_events(sx, simplices=None): def get_events(sx, simplices=None):
 
... ... def scatter_points(ax3d, zs=None, **kwargs):
62 64 sample = getattr(ax3d.sample_box, ax3d.space) sample = getattr(ax3d.sample_box, ax3d.space)
63 65 nsim = len(sample) nsim = len(sample)
64 66 if zs is not None: if zs is not None:
65 x, y = sample[:,:2].T
67 x, y = sample[:,:2].T
66 68 elif ax3d.sample_box.nvar == 2: elif ax3d.sample_box.nvar == 2:
67 69 x, y = sample[:,:2].T x, y = sample[:,:2].T
68 70 #zs = ax3d.sample_box.pdf(ax3d.space) #zs = ax3d.sample_box.pdf(ax3d.space)
 
... ... def density_surface(ax3d, **kwargs):
151 153
152 154 return ax3d.plot_surface(X, Y, Z, **kwargs) return ax3d.plot_surface(X, Y, Z, **kwargs)
153 155
156
157 def density_colored_surface(ax3d, colors=('#7735C2', '#808080'), **kwargs):
158 xmin, xmax = ax3d.get_xlim()
159 ymin, ymax = ax3d.get_ylim()
160
161 inside_color, outside_color = colors
154 162
163 if 'rcount' in kwargs:
164 ngrid = kwargs['rcount']
165 else:
166 ngrid = 50
167
168 x = np.linspace(xmin, xmax, ngrid)
169 y = np.linspace(ymin, ymax, ngrid)
170 X, Y = np.meshgrid(x, y)
171 XY = np.vstack((X.flatten(), Y.flatten())).T
172 z = ax3d.sample_box.sample_pdf(XY, ax3d.space)
173 Z = z.reshape(ngrid, ngrid)
174
175 # for facecolors
176 _x = np.linspace(xmin, xmax, ngrid-1, endpoint=False) + (xmax-xmin)/(ngrid-1)/2
177 _y = np.linspace(ymin, ymax, ngrid-1, endpoint=False) + (ymax-ymin)/(ngrid-1)/2
178 _X, _Y = np.meshgrid(_x, _y)
179 _XY = np.vstack((_X.flatten(), _Y.flatten())).T
180 facecolors = np.full(len(_XY), inside_color)
181 mask = is_outside(ax3d.sample_box.convex_hull, _XY)
182 facecolors[mask] = outside_color
183 facecolors = facecolors.reshape(ngrid-1, ngrid-1)
184
185 return ax3d.plot_surface(X, Y, Z, facecolors = facecolors, **kwargs)
155 186
156 187
157 188 def tri_surface(ax3d, **kwargs): def tri_surface(ax3d, **kwargs):
 
... ... def tri_colored_surfaces(ax3d, **kwargs):
202 233 if np.any(events==2): if np.any(events==2):
203 234 surf.append(ax3d.plot_trisurf(x, y, triangles[events==2], z, color=tri_colors[2], **kwargs)) surf.append(ax3d.plot_trisurf(x, y, triangles[events==2], z, color=tri_colors[2], **kwargs))
204 235 return surf return surf
236
237
238
239 def wall(ax3d, lines2d, zmin=0, zmax=1, **kwargs):
240 surf = list()
241 for line2d in lines2d:
242 x = line2d.get_xdata()
243 y = line2d.get_ydata()
244 _x = np.concatenate((x, x))
245 _y = np.concatenate((y, y))
246 _z = np.concatenate([np.full(len(x), zmin), np.full(len(x), zmax)])
247 tri = mtri.Triangulation(_x, _z)
248 triangles = tri.get_masked_triangles()
249 surf.append(ax3d.plot_trisurf(_x, _y, _z, triangles=triangles, **kwargs))
250
251
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