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)
IS_stat: add get_IS_estimation() function d048b4cd4e90d8440e7ff2a3ad86bc0f3c160d4f I am 2021-06-26 19:55:14
spring: new brand hustý modul pro vyrovnání odhadů 3fc5eb00de1eb65cff2db71640c340602687f52f I am 2021-06-25 00:52:06
convex_hull.Ghull.rvs: hloupá chyba 7494eef4e2621ac9651037cd4a99e9f570704dee I am 2021-06-21 01:37:49
convex_hull.Ghull.rvs: ensure at least one node outside 1c6d05935c83d11637ae566528cf65eb384215b5 I am 2021-06-19 19:04:40
convex_hull.Ghull: add nonGaussian hulls support, fix MC integration 3e10c2cefff5f3e204c1d4118b195e37023a5a57 I am 2021-06-19 17:44:09
mart: add qhull polygon c3da6bdd1b6412f178c828c1eb1a6368a02eb74c I am 2021-06-18 23:27:48
dicebox.Goal: implement csv export odhadů abdb28f509e664c039a6e5ca4bf1036d00957349 I am 2021-06-15 15:06:15
reader: add export_estimation function. Jednoduchý jako busy ef8fcada4b01be8db29836aa09459d8a7ef382b6 I am 2021-06-15 03:08:53
convex_hull: add meaningless method 96a86b7eabceb15e6c937932c2002409c2df0178 I am 2021-06-14 16:35:39
dicebox: new brand box named Goal is ready 725c2561b62769af6034c690005d1d22e6af41c7 I am 2021-06-05 13:40:15
convex_hull: last node fix in fire() function ca938c11398dfb2e16441b989902dab1558336b3 I am 2021-06-05 13:25:55
convex_hull: small fix for QHull under single simplex integration b0b236cd14ae614ecd1310b8c7cfcafe8d1b0851 I am 2021-05-30 05:57:45
convex_hull: ensure Ghull to always have some nodes for expansion 7110d521d9fece58639a359c83773df904b1177f I am 2021-05-29 07:03:49
dicebox: throw away plot dependency, simplify increment function 1cf0c481b8df1937ff7eda6e0373d5d6a72387db I am 2021-05-28 16:42:19
simplex: add JustCubatureTriangulation class separated from Shull ea291f9deee9f3b5b8615ae1f14a49aecd327461 I am 2021-05-28 16:39:58
mart: add convex_hull routines 90105552e7aecf3df8e84a1f5c4bdc1b04be249b I am 2021-04-25 20:11:34
convex_hull.Ghull: try to outthink OS's memory management 116444dc08cc0261e149de02f21f14f74dc8816b I am 2021-04-25 08:02:25
convex_hull.Ghull: in case of memory error divide ns by 3 0f629139f7926107b0b4eeb55452e745a2c23487 I am 2021-04-25 06:50:02
convex_hull: memory failsafe integration 7624e4b81526d3944f1a5ac74d298dee792c3085 I am 2021-04-24 08:06:27
simplex: delete ghull-related stuff (moved to convex_hull module already) f514adf959a9a2a9b7806b3cde81f78faf04539d I am 2021-04-19 17:04:54
Commit d048b4cd4e90d8440e7ff2a3ad86bc0f3c160d4f - IS_stat: add get_IS_estimation() function
Author: I am
Author date (UTC): 2021-06-26 19:55
Committer name: I am
Committer date (UTC): 2021-06-26 19:55
Parent(s): 3fc5eb00de1eb65cff2db71640c340602687f52f
Signer:
Signing key:
Signing status: N
Tree: 00be3c5ef1b88cc5232298de3b3329c4bdbe6d54
File Lines added Lines deleted
IS_stat.py 78 1
File IS_stat.py changed (mode: 100644) (index e556c1e..cb3c179)
... ... import collections # for defaultdict
11 11 from .candybox import CandyBox from .candybox import CandyBox
12 12 from scipy import stats # for sample_like() from scipy import stats # for sample_like()
13 13 from . import f_models # for sample_like() from . import f_models # for sample_like()
14 from .spring import get_spring_solution # for new IS function, for ISSI in future
15
16
17 #č chcu udělat menší IS funkci s výrovnáním odhadů
18 #č Síce tohle už umí ISSI,
19 #č třída ale neočekává celkovou pravděpodobnost odlišnou od nuly.
20 #č Taky jeji funkcionalita je hodně přebytečná pro Ghull.
21 #č Zkratka, chcu funkci, která by na vstupu brala:
22 #č 1. vahy IS (tj. funkce nebude řešít souřadnice a hustoty)
23 #č 2. roušku (omezíme se na nejčastější případ dvou vzajemně vyloučujících jevů) a
24 #č 3. celkovou pravděpodobnost
25 #č a posleze vracela výrovnané odhady
26
27 def get_IS_estimation(weights, mask, p_overall=1):
28 """Function calculates Importance Sampling estimators
29 of two mutually excludive events (typical for indicator or Heaviside step function).
30 It performs correction based on a priory known overall probability.
31 It takes numpy array of IS weghts (PDF / weighting function density),
32 numpy boolean array and a priory known overall probability.
33 Returns corrected estimators for true_event and false_event"""
34
35 #č vstupní kontroly
36 if np.all(mask): #č všecko je pravda - není co řešit
37 return p_overall, 0
38 if not np.any(mask): #č není žádná pravda - není žádné překvapení
39 return 0, p_overall
40
41 Nsim = len(weights)
42 # there are two events:
43 true_masked = weights[mask]
44 false_masked = weights[~mask]
45 #č podle IS vzorečků
46 #č když uživatel bude hodně snažit, tak
47 #č v mat. očekaváních může zajistit nuly
48 #č nechcu zatím řešit
49 true_mean = np.sum(true_masked)/Nsim
50 false_mean = np.sum(false_masked)/Nsim
51 if (true_mean + false_mean) == p_overall:
52 return true_mean, false_mean
53 #č podle toho, co vidím ve vzorcích - mám pocit, že se
54 #č nůlový rozptyl může vyskytnout pouze v případě Nsim == 1, což
55 #č zde od uživatele neočakávám. Nebo spolu s nulovým průměrem,
56 #č který zatím taky nechcu řešit.
57 #č (Ten ISSI je teda hrozně перемудрёный, řeší bůhvíco)
58 #č Zde to nepotřebujem, udělame všecko jednoduše.
59 true_var = (np.sum(true_masked**2)/Nsim - true_mean**2) / Nsim
60 false_var = (np.sum(false_masked**2)/Nsim - false_mean**2) / Nsim
61
62 #č pošleme to pružině. Ta je obecnější, na větší počet jevů
63 #č proto bere jako vstup numpy matice
64 lenghts = np.array((true_mean, false_mean))
65 flexibilities = np.array((true_var, false_var))
66 #č vrací taky numpy
67 ls = get_spring_solution(lenghts, flexibilities, L=p_overall)
68 #č rozbalíme
69 #č (na rovinu, dělám to jen aby pak kód bylo možné jednoduše přečíst)
70 true_corrected_mean, false_corrected_mean = ls
71
72 return true_corrected_mean, false_corrected_mean #(*ls,)
73
74
75
76
77 #č ISS a ISSI by bylo vhod předělat na spring a
78 #č vyhodit ty blbosti s půlením intervalů.
79 #č Nechám to na potom, po zakroku by bylo potřebné
80 #č všecko dobře otestovat, teď na to nemám ani kapacitu, ani zajem
81 #č Goal&Ghull ISSI nepotřebuje.
14 82
15 83 # bisect function is taken from somewhere in internet. # bisect function is taken from somewhere in internet.
16 84 # https://www.quora.com/How-does-one-correctly-compare-two-floats-in-Python-to-test-if-they-are-equal # https://www.quora.com/How-does-one-correctly-compare-two-floats-in-Python-to-test-if-they-are-equal
 
... ... def IS_like(f_plan, sampling_space='G', weights=None, nis=1000, d=1, design=None
175 243
176 244
177 245
178
246 #č krucinal, vůbec si nepamatuji,
247 #č co znaméná "TrueIS".
248 #č Navíc, nemůžu najít žadné použití v kódu.
249 #č Ty brďo, jaktože mám zde nějakou třídu,
250 #č která není nikde použitá?
251 #č Zřejmě, že mimo jiného pracuje se souřadnicemi.
252 #č Má nějakou alfu, která "not used", je to asi něco hodně starého.
253 #č Má metody pro výpočet vah a pro výpočet odhadů s nevím proč
254 #č úpravenými vzorečky.
255 #č Ok, kdyby něco, budem vědět.
179 256 class TrueIS: class TrueIS:
180 257 def __init__(self, f, IS_mode='G'): def __init__(self, f, IS_mode='G'):
181 258 self.f_sample = f() self.f_sample = f()
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