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)
move diceboxes to the dedicated drawer 31c7d30ed43f04b9469df843f909814c062adf5e I am 2022-12-04 21:27:37
reader: finally, add new Store class for the estimations 673b7daa8213807d0217089b3317674595156f6d I am 2022-12-03 17:46:22
f_models.SNorm: hotfix 5f364d1770e18d18fb810760b6207c905b551762 I am 2022-12-02 21:33:48
f_models: rewrite SNorm in lazy way. Old SNorm class renamed to SNormClassic 3b6805b2a1d0bce88960bc016bbe74bb5274810b I am 2022-12-02 21:11:37
simplex: implement CircumCenter class 0a1a67122854cfb331f696163f22cfc67331f3e8 I am 2022-12-01 01:40:38
voronoi.ContactVoronoi: add explore_couple() method 72f4dffa5e8e7ee3165df4648f6a35d75d6678a3 I am 2022-11-29 11:59:07
voronoi: almost finished 00b697466c226212aeb1ea76a717cf3db48c3187 I am 2022-11-28 16:28:48
voronoi: WIP 29c59822f96df4efd6d1c6555a6fa083a869a2c8 I am 2022-11-28 11:14:50
voronoi: WIP, clean up 8e776235f7603a9bc7f3d8254976224a81bb153e I am 2022-11-27 19:56:34
voronoi: WIP 41e506eacb502853a1cf70023e7b276539579af7 I am 2022-11-27 13:03:08
convex_hull: optimize orth basis generation 4ebfde2955aa792fb31075bf9ac8af718ae07b29 I am 2022-11-26 15:35:21
voronoi: WIP 8f7f3bca7c4333ab579e057438c8c64208d1f60e I am 2022-11-26 11:22:55
voronoi: remove the code already moved to wireframe module fe57b4b699e8689d35afb510f704019152566f09 I am 2022-11-25 09:25:55
qt_gui.qt_pairwise.ContactWidget: show Qhull request at most once. db6af332a70786759692175384f4b7e779b4caca I am 2022-11-16 13:26:04
wireframe.LinearSolver: polytope handle hotfix bc48de3193ce9be482cc4dd068a26f48ea1e0203 I am 2022-11-16 13:24:41
qt_gui.qt_pairwise.ContactWidget: add LP methods 8dbd480ca80aabe1c7e0e689780767b78c86c1d1 I am 2022-11-16 11:33:32
wireframe: implement two LP solvers 8aecd55104ce85ccccf872ebef0052a5937415b5 I am 2022-11-16 11:32:31
qt_gui.qt_pairwise.ContactWidget: add Gabriel adjacency 86eaf302b176612fad072a2248e2c724d32be755 I am 2022-11-16 06:17:53
wireframe: implement Gabriel adjacency f0a74b4f28cec6c2ddc68d6811e0a812fc829d63 I am 2022-11-16 06:16:58
qt_gui.qt_pairwise.ContactWidget: reflect updated wireframe b00a9be23d92d999e0020426a7a5caa1206c5862 I am 2022-11-16 03:56:57
Commit 31c7d30ed43f04b9469df843f909814c062adf5e - move diceboxes to the dedicated drawer
Author: I am
Author date (UTC): 2022-12-04 21:27
Committer name: I am
Committer date (UTC): 2022-12-04 21:27
Parent(s): 673b7daa8213807d0217089b3317674595156f6d
Signer:
Signing key:
Signing status: N
Tree: d69109dff4770909fda290eb3dabc6ab69a37a20
File Lines added Lines deleted
wellmet/dicebox/__init__.py 0 0
wellmet/dicebox/censoring.py 0 0
wellmet/dicebox/goal.py 75 97
wellmet/qt_gui/qt_dicebox.py 1 1
File wellmet/dicebox/__init__.py copied from file wellmet/__init__.py (similarity 100%)
File wellmet/dicebox/censoring.py renamed from wellmet/blackbox.py (similarity 100%)
File wellmet/dicebox/goal.py renamed from wellmet/dicebox.py (similarity 95%) (mode: 100644) (index 750fd88..b686600)
... ... import numpy as np
15 15 from scipy import spatial from scipy import spatial
16 16 from scipy import stats from scipy import stats
17 17 import pickle import pickle
18 from . import IS_stat
19 from .candybox import CandyBox
18 from .. import IS_stat
19 from ..candybox import CandyBox
20 20 from scipy import optimize # for BlackSimpleX from scipy import optimize # for BlackSimpleX
21 21
22 22
23 from .samplebox import SampleBox # for candidates packing
24 from .ghull import Ghull
25 from . import simplex as sx
26 from . import convex_hull as khull
27 from . import lukiskon as lk
28 from . import reader # for Goal
29 from . import estimation as stm # for KechatoLukiskon
23 from ..samplebox import SampleBox # for candidates packing
24 from ..ghull import Ghull
25 from .. import simplex as sx
26 from .. import convex_hull as khull
27 from .. import lukiskon as lk
28 from .. import reader # for Goal
29 from .. import estimation as stm # for KechatoLukiskon
30 30 import collections #E for Counter in MinEnergyCensoredSampling import collections #E for Counter in MinEnergyCensoredSampling
31 31
32 32
 
... ... class DiceSimpleX:
1902 1902
1903 1903
1904 1904
1905
1906
1907
1908
1909
1910
1911
1912
1905 1913 class KickPointVoronoi(DiceBox): class KickPointVoronoi(DiceBox):
1906 1914 """ """
1907 1915 Goal Goal
 
... ... class KickPointVoronoi(DiceBox):
1956 1964 #č a zaroveň je nominuje na soutež. #č a zaroveň je nominuje na soutež.
1957 1965 #č na vstupu assess_candidates musí být CandyBox #č na vstupu assess_candidates musí být CandyBox
1958 1966 #č s jíž nastaveným event_id #č s jíž nastaveným event_id
1959 #assess_candidates = Chrt.assess_candidates
1967 assess_candidates = Chrt.assess_candidates
1960 1968 _nominate = Chrt._nominate _nominate = Chrt._nominate
1961 1969
1962 1970 #č explicitně převezmu některé funkce #č explicitně převezmu některé funkce
 
... ... class KickPointVoronoi(DiceBox):
1970 1978 _invalidate_simplex = Razitko._invalidate_simplex _invalidate_simplex = Razitko._invalidate_simplex
1971 1979
1972 1980
1973 def __init__(bx, sample_object, ghull, tri_space='G', tree_space=None,\
1974 sampling_space=None, kechato_space='U', potential='q_psee', q=0.5,\
1981 #č míží nám sampling_space: Ghull umí vzorkovat outside pouze v G prostoru
1982 #č quadpy umístí integráční bodíky v prostoru triangulace.
1983 def __init__(bx, sample_object, scheme, tri_space='G', tree_space=None,\
1984 kechato_space='U', potential='q_psee', q=0.5,\
1975 1985 p_norm=2, shell_budget=1000, outer_budget=100,\ p_norm=2, shell_budget=1000, outer_budget=100,\
1976 1986 LHS_correction=False, stm_filename=None): LHS_correction=False, stm_filename=None):
1977 1987
1978 bx.ghull = ghull
1988 bx.scheme = scheme
1979 1989 bx.tri_space = tri_space bx.tri_space = tri_space
1980 1990 if tree_space is None: if tree_space is None:
1981 1991 bx.tree_space = tri_space bx.tree_space = tri_space
1982 1992 else: else:
1983 1993 bx.tree_space = tree_space bx.tree_space = tree_space
1984 1994
1985 if sampling_space is None:
1986 bx.sampling_space = tri_space
1987 else:
1988 bx.sampling_space = sampling_space
1989
1990 1995
1991 1996 bx.kechato_space = kechato_space bx.kechato_space = kechato_space
1992 1997 bx.shell_budget = shell_budget bx.shell_budget = shell_budget
 
... ... class KickPointVoronoi(DiceBox):
2130 2135 def _handle_candidates(bx): def _handle_candidates(bx):
2131 2136 #č A ještě... AUKCE, AUCTION #č A ještě... AUKCE, AUCTION
2132 2137 # Election - selection # Election - selection
2133 for candidates in bx.candidates_index.values():
2134 bids = getattr(candidates, bx.potential)
2135 if len(bids):
2136 bid = np.nanmax(bids)
2137 # side effect
2138 if bid > bx.highest_bid:
2139 #č pokud neprovadíme optimalizaci v simplexech
2140 #č tak nám stačí jednoduše assessovat
2141 bx.assess_candidates(candidates)
2138 for key, cached_bid in reversed(bx.candidates_index.cache.items()):
2139 # side effect
2140 if cached_bid > bx.highest_bid:
2141 #č pokud neprovadíme optimalizaci v simplexech
2142 #č tak nám stačí jednoduše assessovat
2143 bx.assess_candidates(bx.candidates_index[key])
2144 #č tím se mi aktualizuje cache
2145 bx.candidates_index[key] = bx.candidates_index[key]
2142 2146
2143 2147 # probably, we shouldn't purge user candidates (if they are) # probably, we shouldn't purge user candidates (if they are)
2144 2148 # just every time evaluate them # just every time evaluate them
 
... ... class KickPointVoronoi(DiceBox):
2148 2152 # bx.assess_candidates(bx.candidates) # bx.assess_candidates(bx.candidates)
2149 2153
2150 2154
2151 def assess_candidates(bx, candidates):
2152 #č nikdo to nepouživá, ale se mi nějaký takový parameter libí.
2153 candidates.nsim_stamp = np.full(len(candidates), bx.nsim)
2154
2155 candidates_tree = getattr(candidates, bx.tree_space)
2156 dd, ii = bx.tree.query(candidates_tree, k=1, p=bx.p_norm)
2157
2158 # from scipy documentation:
2159 # [dd] Missing neighbors are indicated with infinite distances.
2160 # [ii] Missing neighbors are indicated with self.n
2161
2162 #č mǐ radši budeme předpokladat nulovou vzdálenost a třeba nulového souseda
2163 #č ne, radší posledného souseda
2164 #č pokud ten chytrej strom si myslí, že nějaký kandidat nemá spolubydlu
2165 mask = ii == bx.nsim
2166 if np.any(mask): #č ať mě to neznervozňuje
2167 ii[mask] = bx.nsim - 1
2168 dd[mask] = 0
2169 bx._logger(msg="cKDTree zlobí", orphan_candidates=candidates[mask], P=candidates[mask].P)
2170
2171 # the most agressive potential ever
2172 candidates.dd = dd
2173
2174 if bx.potential in ('psee', 'fee', 'fee2'):
2175 #оӵ кучапи
2176 #č pejskovej potenciál
2177 #č psí-kučapí není invariántní vůči lineárním transformácím
2178
2179 PDFs = bx.sample_box.pdf(bx.tree_space)
2180 # teď máme hustoty kandidatů a prislušejicích jím vzorků
2181 PDF = PDFs[ii]
2182 pdf = candidates.pdf(bx.tree_space)
2183
2184 tree_Pdf_mean = (pdf+PDF)/2
2185 tree_Pdf_gmean = np.sqrt(pdf*PDF)
2186 volume = np.power(dd, bx.nvar)
2187 candidates.psee = tree_Pdf_gmean * volume
2188 candidates.fee = tree_Pdf_mean * volume * np.power(pdf/PDF, 1/(bx.nvar+1))
2189 candidates.fee2 = tree_Pdf_mean * volume * np.power(pdf/PDF, 1/(bx.nvar*2))
2190
2191 elif bx.potential == 'ksee': # ksee
2192 #оӵ кечато
2193 #č koťatko-káčátkovej potenciál
2194 #č ksí-kěčató není invariántní vůčí rotacím
2195 ksee = np.empty(len(candidates))
2196 for i in np.unique(ii):
2197 # doufám, že je to legální
2198 ksee[i==ii] = lk.kechato_potential(bx.f_model[i], candidates[i==ii], kechato_space=bx.kechato_space)
2199 candidates.ksee = ksee
2200
2201 elif bx.potential == 'q_psee': #č kup si
2202 #оӵ кучапи
2203 #č pejskovej potenciál
2204 #č psí-kučapí není invariántní vůči lineárním transformácím
2205
2206 PDFs = bx.sample_box.pdf(bx.tree_space)
2207 # teď máme hustoty kandidatů a prislušejicích jím vzorků
2208 PDF = PDFs[ii]
2209 pdf = candidates.pdf(bx.tree_space)
2210
2211 volume = np.power(dd, bx.nvar)
2212 candidates.psee = np.sqrt(pdf*PDF) * volume
2213 candidates.q_psee = pdf**bx.q * PDF**(1-bx.q) * volume
2214
2215
2216
2217 # prepare to elections
2218 bx._nominate(candidates)
2219 2155
2220 2156
2221 2157 def _ghull_outside_callback(bx, outside_nodes): def _ghull_outside_callback(bx, outside_nodes):
 
... ... class KickPointVoronoi(DiceBox):
2347 2283 #č takže musíme sami lepit nové etikety #č takže musíme sami lepit nové etikety
2348 2284 bx.global_stats['nsim'] = bx.nsim bx.global_stats['nsim'] = bx.nsim
2349 2285
2286 failsi = bx.failsi
2287
2350 2288 if 'tri' in dir(bx): if 'tri' in dir(bx):
2351 2289 #č Tri.get_pf_estimation() vrací: #č Tri.get_pf_estimation() vrací:
2352 2290 # 'TRI_estimation': tri_estimation, 'global_stats': {mix, failure}, \ # 'TRI_estimation': tri_estimation, 'global_stats': {mix, failure}, \
 
... ... class KickPointVoronoi(DiceBox):
2365 2303 estimations['ghull_estimation'] = bx.ghull_estimation estimations['ghull_estimation'] = bx.ghull_estimation
2366 2304
2367 2305 #č hrozně důležitý. Těšíme se na csv-čko. #č hrozně důležitý. Těšíme se na csv-čko.
2368 bx.global_stats = {**bx.global_stats, **estimations['global_stats']}
2306 bx.global_stats.update(estimations['global_stats'])
2307 bx.global_stats['success_points'] = len(failsi[~failsi])
2308 bx.global_stats['failure_points'] = len(failsi[failsi])
2369 2309 bx.global_stats['success'] = tri_estimation[0] bx.global_stats['success'] = tri_estimation[0]
2370
2310 bx.global_stats['candidates_sets'] = len(bx.candidates_index)
2311 estimations['global_stats'].update(bx.global_stats)
2371 2312 return estimations return estimations
2372 2313
2373 2314
 
... ... class KickPointVoronoi(DiceBox):
2386 2327
2387 2328 global_stats = bx.global_stats global_stats = bx.global_stats
2388 2329 # outside dodá Ghull # outside dodá Ghull
2330 global_stats['success_points'] = len(failsi[~failsi])
2331 global_stats['failure_points'] = len(failsi[failsi])
2389 2332 global_stats['success'] = tri_estimation[0] global_stats['success'] = tri_estimation[0]
2390 2333 global_stats['failure'] = tri_estimation[1] global_stats['failure'] = tri_estimation[1]
2391 2334 global_stats['mix'] = tri_estimation[2] global_stats['mix'] = tri_estimation[2]
2392 2335 global_stats['vertex_estimation'] = vertex_estimation global_stats['vertex_estimation'] = vertex_estimation
2393 2336 global_stats['weighted_vertex_estimation'] = weighted_vertex_estimation global_stats['weighted_vertex_estimation'] = weighted_vertex_estimation
2394 2337 global_stats['nsimplex'] = 0 global_stats['nsimplex'] = 0
2338 global_stats['tn_scheme'] = bx.scheme.name
2339 global_stats['tn_scheme_points'] = bx.scheme.points.shape[1]
2340 global_stats['newly_invalidated'] = 0
2341 global_stats['newly_estimated'] = 0
2342 global_stats['simplex_stats'] = 0
2343 global_stats['candidates_sets'] = len(bx.candidates_index)
2395 2344 global_stats['ncoplanar'] = 0 global_stats['ncoplanar'] = 0
2396 2345
2397 2346 return {'TRI_overall_estimations': tri_estimation, \ return {'TRI_overall_estimations': tri_estimation, \
 
... ... class KickPointVoronoi(DiceBox):
2424 2373 reader.export_estimation(bx.stm_filename, bx.global_stats) reader.export_estimation(bx.stm_filename, bx.global_stats)
2425 2374
2426 2375
2376 #č boom-body klidně můžou spadat dovnitř orth obálky.
2377 #č Ale to nevadí, kandidati za vnější kryžnicí nejsou špatní, že?
2378 def boom(self, ns):
2379 # rand_dir: prepare ns random directions on a unit d-sphere
2380 rand_dir = sball.get_random_directions(ns, self.sample.nvar) #random directions
2381
2382 #č deme od vnější .get_R() kružnici směrem ven
2383 r = self.get_R()
2384
2385 if r < max_R_ever:
2386 R = max_R_ever
2387 else:
2388 R = r + 10
2389 r = np.linspace(self.get_R(), max_R_ever, ns, endpoint=True)
2390 nodes_G = rand_dir*r[:,None]
2391
2392 nodes = self.sample.f_model.new_sample(nodes_G, space='G')
2393 return nodes
2394
2395
2396
2397
2398 def get_R(self):
2399 return self._R
2400 #sum_squared = np.sum(np.square(self.sample.G), axis=1)
2401 #index = np.argmax(sum_squared)
2402 #return np.sqrt(np.nanmax(sum_squared))
2403
2404
2427 2405 ##č nie treba počítat odhady v každem kroku ##č nie treba počítat odhady v každem kroku
2428 2406 ##č ale zas, taky že chceme do článků davat nějaké diagramy ##č ale zas, taky že chceme do článků davat nějaké diagramy
2429 2407 # #
File wellmet/qt_gui/qt_dicebox.py changed (mode: 100644) (index ecb41a6..74db06c)
... ... import sys
2 2 import numpy as np import numpy as np
3 3 from .. import schemes from .. import schemes
4 4 from ..candybox import CandyBox from ..candybox import CandyBox
5 from ..dicebox import Goal, Razitko, DiceBox
5 from ..dicebox.goal import Goal, Razitko, DiceBox
6 6 import pyqtgraph as pg import pyqtgraph as pg
7 7 from pyqtgraph.Qt import QtCore, QtWidgets from pyqtgraph.Qt import QtCore, QtWidgets
8 8
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