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)
make WellMet standalone runnable 1fe983d633d7194a64cf6928044082936790ce4d Aleksei Gerasimov 2021-10-27 16:21:51
qt_gui: prepare qt_box_functions module c500fcd20e7b296262a0566d04aabb7bd1ae9cfa Aleksei Gerasimov 2021-10-25 15:39:56
shapeshare: keep empty file to reserve the name b11f17e13dafc3d58db5ad9f101c0126e0bfd871 Aleksei Gerasimov 2021-10-21 14:48:03
delete sball_old :( 792d9d83fde0f38e7396162788ec8aa922b0fd0c Aleksei Gerasimov 2021-10-21 14:47:06
whitebox: add Z_sum, Z_prod, small clean up faec934bb03c20906c9091fc196cc0daf824b54f Aleksei Gerasimov 2021-10-21 13:48:07
g_models: add neverfall, add sign parameter to Z_prod 129abf19da15a5dfcb5a02614d92a233f914d146 Aleksei Gerasimov 2021-10-21 13:45:47
mplot: add one more qhull plot 32e7003aac4887bd83bfff640093f755b4f6cffe I am 2021-09-14 11:42:56
mplot: add ESREL-related figures cba805ba8e7f3c2337027eec6e760aa9234dfdc2 I am 2021-09-12 10:17:21
mplot.mart: allow set up fill keyword cf94410513091b5f96e0e17e8de2f7a3feee1a03 I am 2021-09-12 10:15:55
mplot: add qhull&density figure a36fb606e9f425742925aa4953c0ae07d6b51409 I am 2021-09-10 15:17:58
qt_plot: send sliced sample box to matplotlib fda486b90c56e77bc88b38d0d94d08a751277cfb I am 2021-09-10 15:01:55
mplot: include Axes3d patch 8f5dc7f04b6c804b5ec169ec7b744a8618b3bb69 I am 2021-09-10 11:05:20
rework mplot module considerably 5343602c63032f6f7fd06701b0883eaabb4fc6c1 I am 2021-09-09 13:24:45
convex_hull: reduce max R to that not overflows everything everytime 2108df698e4d45bfae9d9882d4b4cc62340b03cc Aleksei Gerasimov 2021-07-21 13:56:41
sball: make Sball a little bit more scipy.stats-compatible 9414aceedf826e7fc6e35c722b2eecee81dead1e Aleksei Gerasimov 2021-07-21 13:40:28
convex_hull: fire() function has been reworked. shot() function is introduced 4e6b7546f163a9a32fdb4bf5790f416300b2c1ec Aleksei Gerasimov 2021-07-21 13:11:52
ghull: 1DS integration scheme has been implemented. convex_hull has been divided into convex_hull itself and separated ghull module. 29b21b4fc1396384bf8c9bb21b91f82005850574 Aleksei Gerasimov 2021-07-20 13:26:47
IS_stat: add 1D IS-like helpful sampling function 58416707171522e8129333e8bd93f512c7578879 Aleksei Gerasimov 2021-07-20 11:06:27
convex_hull: orth estimation is ready. Uses QR decomposition. 75f20d8771021b037c360df9c7207b8f46f65d91 Aleksei Gerasimov 2021-07-20 08:25:20
convex_hull: 2FORM za mně je Ready. Orth potřebuje Gram-Schmidtovou ortogonalizaci. Oboje jsou otestovany ve 2D. There is some weirdness with candidates inherited from WIP recent commit. It need to be fixed. ffae78d5a15884476760b8ab759963d7ef8ff5fc Aleksei Gerasimov 2021-07-19 14:48:34
Commit 1fe983d633d7194a64cf6928044082936790ce4d - make WellMet standalone runnable
Author: Aleksei Gerasimov
Author date (UTC): 2021-10-27 16:21
Committer name: Aleksei Gerasimov
Committer date (UTC): 2021-10-27 16:21
Parent(s): c500fcd20e7b296262a0566d04aabb7bd1ae9cfa
Signer:
Signing key:
Signing status: N
Tree: a5e8b33c7204cef021107ea92f32b73ba11e99f5
File Lines added Lines deleted
__main__.py 2 1
plot.py 2 2
qt_gui/__init__.py 0 0
qt_gui/gl_plot.py 0 0
qt_gui/gui_startup.py 41 0
qt_gui/qt_box_functions.py 33 34
qt_gui/qt_gui.py 12 19
qt_gui/qt_plot.py 6 6
qt_gui/qt_testcases.py 77 0
testcases/testcases_2D.py 242 0
testcases/testcases_2D_papers.py 14 11
whitebox.py 6 5
File __main__.py copied from file shapeshare.py (similarity 51%) (mode: 100644) (index 11b2fde..458b7e2)
1 1 #!/usr/bin/env python #!/usr/bin/env python
2 2 # coding: utf-8 # coding: utf-8
3 3
4 # eventual replacement for whitebox
4 from .qt_gui import gui_startup
5
File plot.py changed (mode: 100644) (index 4849f17..437b0d3)
... ... except BaseException as e:
36 36 plot3D = lambda *args, **kwargs:print(plot_error_str) plot3D = lambda *args, **kwargs:print(plot_error_str)
37 37
38 38 try: # pyqtgraph try: # pyqtgraph
39 from . import qt_plot
39 from .qt_gui import qt_plot
40 40 show2D = qt_plot.qt_gui_plot_2d show2D = qt_plot.qt_gui_plot_2d
41 41 except BaseException as e: except BaseException as e:
42 42 show2D_error_str = "show2D import error: " + repr(e) show2D_error_str = "show2D import error: " + repr(e)
 
... ... except BaseException as e:
44 44
45 45 #č tohle vůbec nemusí bežet všude #č tohle vůbec nemusí bežet všude
46 46 try: # pyqtgraph try: # pyqtgraph
47 from . import gl_plot
47 from .qt_gui import gl_plot
48 48 show3D = gl_plot.qt_gui_plot_3d show3D = gl_plot.qt_gui_plot_3d
49 49 except BaseException as e: except BaseException as e:
50 50 show3D_error_str = "show3D import error: " + repr(e) show3D_error_str = "show3D import error: " + repr(e)
File qt_gui/__init__.py copied from file __init__.py (similarity 100%)
File qt_gui/gl_plot.py renamed from gl_plot.py (similarity 100%)
File qt_gui/gui_startup.py added (mode: 100644) (index 0000000..1f799ec)
1 #!/usr/bin/env python
2 # coding: utf-8
3
4
5
6 #from wellmet.samplebox import SampleBox
7 #from wellmet.dicebox import Goal
8 from ..candybox import CandyBox
9 #from wellmet import schemes
10
11 from . import qt_box_functions as gui
12 from . import qt_gui
13
14 wt = gui.select_test_case()
15
16 #č implicitně vložime bombonjeru
17 #č černá skřiňka nejspíš ji bude potřebovat
18 wt.samplebox.sampled_plan = CandyBox(wt.f())
19
20 #č funkce read_box() buď vytvoří Reader object
21 #č kterým nahradí wt.sample_box,
22 #č nebo - je-li uživatel odmitné zvolit nějaký soubor
23 #č ponechá původní samplebox
24 gui.read_box(wt)
25
26 #
27 #schema = schemes.get_all_tn_simplex_schemes(wt.nvar)
28 #
29
30 #
31 #stm_filename = "store/%s_%sD_stm" % (wt.gm_signature, wt.nvar)
32 #
33 #bx = Goal(sample_box, scheme=schema['Grundmann-Möller(dim=2, 5)'],\
34 # tri_space='G', tree_space=None, potential='q_psee', q=0.5, p_norm=2, \
35 # kechato_space='U', shell_budget=1000, outer_budget=100,\
36 # LHS_correction=False, stm_filename=stm_filename)
37 #
38 #wt.sample_box = bx
39 #
40
41 qt_gui.QtGuiPlot2D(wt)
File qt_gui/qt_box_functions.py changed (mode: 100644) (index c0452d6..3e9aa36)
2 2 # coding: utf-8 # coding: utf-8
3 3
4 4 import sys import sys
5 from . import qt_testcases
6 from .. import reader
5 7 import pyqtgraph as pg import pyqtgraph as pg
6 8 from pyqtgraph.Qt import QtGui, QtCore from pyqtgraph.Qt import QtGui, QtCore
7 9
8 10
9 app = pg.mkQApp()
10
11 csv_filter = "CSV files (*.csv)"
12
13 #print(pg.FileDialog.Options.Union.__dict__)
14 filename, __filter = pg.FileDialog.getSaveFileName(
15 parent=None,
16 caption="open/store",
17 directory="",
18 filter=csv_filter + ";;All files(*)",
19 initialFilter=csv_filter,
20 options=pg.FileDialog.Option.DontConfirmOverwrite
21 )
22
23 print(filename)
24
25 def export_to_excel(self):
26 #č já bych nechtěl, aby mně export najednou spadl
27 #č z jakéhokoliv důvodu
28 try:
29 proposal_filename = self.dice_box.guessbox.filename
30 if proposal_filename:
31 proposal_filename += '.xlsx'
32 else:
33 proposal_filename = self.dice_box.gm_signature + '.xlsx'
34 filename, *__ = pg.FileDialog.getSaveFileName(self.stream, 'Export to Excel',\
35 proposal_filename, initialFilter='*.xlsx')
36
37
38
39 self.df.to_excel(filename)
40 except BaseException as e:
41 print(self.__class__.__name__ + ":", repr(e))
42
11 def select_test_case():
12 return qt_testcases.SelectTestCaseWidget().box
13
14
15 def read_box(wt):
16 """
17 Funkce read_box() buď vytvoří Reader object
18 kterým nahradí wt.sample_box,
19 nebo - je-li uživatel odmitné zvolit nějaký soubor
20 ponechá původní samplebox
21 """
22 app = pg.mkQApp()
23 csv_filter = "CSV files (*.csv)"
24 filename, __filter = pg.FileDialog.getSaveFileName(
25 parent=None,
26 caption="open/store",
27 directory="store",
28 #filter=csv_filter,
29 filter=csv_filter + ";;All files(*)",
30 initialFilter=csv_filter,
31 options=pg.FileDialog.Option.DontConfirmOverwrite
32 )
33 if filename:
34 #č Reader vždy dopíše '.csv' na konci souboru
35 #č nechcu to teď měnit
36 if filename[-4:]=='.csv':
37 filename = filename[:-4]
38 #č Reader sám zavolá SampleBox
39 wt.sample_box = reader.Reader(filename, wt.samplebox.sampled_plan)
40
43 41
42
File qt_gui/qt_gui.py copied from file qt_plot.py (similarity 99%) (mode: 100644) (index 6b8bbfa..8aa7ad5)
... ... import pandas as pd # required for estimation graph
16 16 import quadpy import quadpy
17 17
18 18
19 from . import estimation as stm
20 from . import misc
21 from . import stm_df
22 from . import sball
23 from . import schemes
24 from . import convex_hull as khull
19 from .. import estimation as stm
20 from .. import misc
21 from .. import stm_df
22 from .. import sball
23 from .. import schemes
24 from .. import convex_hull as khull
25 25 #č pro mě je zvykem jako ghull označovat objekt třídy Ghull #č pro mě je zvykem jako ghull označovat objekt třídy Ghull
26 26 #č nikoliv čerstvě oddelený modul #č nikoliv čerstvě oddelený modul
27 from .ghull import Ghull, Shell_MC, Shell_IS, Shell_1DS
27 from ..ghull import Ghull, Shell_MC, Shell_IS, Shell_1DS
28 28
29 29
30 def qt_gui_plot_2d(sample_box, space='R', *args, **kwargs):
31 """
32 This function will start Qt graph window in event loop
33 """
34
35 return QtGuiPlot2D(sample_box, space, *args, **kwargs)
36
37 30
38 31 ### Define a top-level widget to hold everything ### Define a top-level widget to hold everything
39 32 class QtGuiPlot2D(QtGui.QMainWindow): class QtGuiPlot2D(QtGui.QMainWindow):
 
... ... class QtGuiPlot2D(QtGui.QMainWindow):
103 96 # should be INHERITED by gl_plot # should be INHERITED by gl_plot
104 97 def initialize_matplotlib_menu(self): def initialize_matplotlib_menu(self):
105 98 try: # entire optional functionality try: # entire optional functionality
106 from .mplot import show_ax, show_ax3d, show_fig
107 from .mplot import maxes
108 from .mplot import maxes3d
109 from .mplot import mfigs
110 from .mplot import misc as mmisc
99 from ..mplot import show_ax, show_ax3d, show_fig
100 from ..mplot import maxes
101 from ..mplot import maxes3d
102 from ..mplot import mfigs
103 from ..mplot import misc as mmisc
111 104 self.matplotlib_menu = self.bar.addMenu("Matplotlib") self.matplotlib_menu = self.bar.addMenu("Matplotlib")
112 105 self.matplotlib_actions = [] self.matplotlib_actions = []
113 106
File qt_gui/qt_plot.py renamed from qt_plot.py (similarity 99%) (mode: 100644) (index 6b8bbfa..2a088a1)
... ... import pandas as pd # required for estimation graph
16 16 import quadpy import quadpy
17 17
18 18
19 from . import estimation as stm
20 from . import misc
21 from . import stm_df
22 from . import sball
23 from . import schemes
24 from . import convex_hull as khull
19 from .. import estimation as stm
20 from .. import misc
21 from .. import stm_df
22 from .. import sball
23 from .. import schemes
24 from .. import convex_hull as khull
25 25 #č pro mě je zvykem jako ghull označovat objekt třídy Ghull #č pro mě je zvykem jako ghull označovat objekt třídy Ghull
26 26 #č nikoliv čerstvě oddelený modul #č nikoliv čerstvě oddelený modul
27 27 from .ghull import Ghull, Shell_MC, Shell_IS, Shell_1DS from .ghull import Ghull, Shell_MC, Shell_IS, Shell_1DS
File qt_gui/qt_testcases.py added (mode: 100644) (index 0000000..038a5ce)
1 import sys
2
3 from ..testcases import testcases_2D, testcases_2D_papers
4 import pyqtgraph as pg
5 from pyqtgraph.Qt import QtGui, QtCore, QtWidgets
6
7
8 class TestCasesListWidget(QtGui.QListWidget):
9 def __init__(self, module, parent=None):
10 self.module = module
11 super().__init__(parent)
12 self.addItems(module.__all__)
13
14 def extract_selected_item(self):
15 item = self.currentItem()
16 if item is None:
17 return getattr(self.module, self.module.__all__[0])()
18 else:
19 item_str = self.currentItem().text()
20 return getattr(self.module, item_str)()
21
22
23 class SelectTestCaseWidget(pg.LayoutWidget):
24 def __init__(self, parent=None):
25 #č nejdřív vytvořiť apku
26 self.app = pg.mkQApp("WellMet")
27 #
28 super().__init__(parent)
29
30 self.setup()
31
32 #č zobraziť
33 self.show()
34 #č a spustit smyčku
35 self.app.exec_()
36
37 def setup(self):
38 self.setWindowTitle("Select testcase")
39 self.box = None
40
41 self.setup_tabs()
42 self.addWidget(self.tabs, row=0, col=0, rowspan=1, colspan=2)
43
44 self.btn_exit = QtGui.QPushButton('Exit')
45 self.addWidget(self.btn_exit, row=1, col=0)
46 self.btn_exit.clicked.connect(self.exit)
47
48 self.btn_choose = QtGui.QPushButton('Next')
49 self.addWidget(self.btn_choose, row=1, col=1)
50 self.btn_choose.clicked.connect(self.choose)
51
52 def exit(self):
53 self.app.quit()
54 sys.exit()
55
56 def choose(self):
57 tab_index = self.tabs.currentIndex()
58 if tab_index == 0:
59 self.box = self.tab_2d_papers.extract_selected_item()
60 elif tab_index == 1:
61 self.box = self.tab_2d.extract_selected_item()
62 else:
63 raise
64 self.app.quit()
65
66 def setup_tabs(self):
67 # Initialize tab screen
68 self.tabs = QtWidgets.QTabWidget(self)
69
70 # Add tabs
71 self.tab_2d_papers = TestCasesListWidget(testcases_2D_papers, self)
72 self.tabs.addTab(self.tab_2d_papers,"Well-known 2D testcases")
73
74 self.tab_2d = TestCasesListWidget(testcases_2D, self)
75 self.tabs.addTab(self.tab_2d,"2D testcases")
76
77
File testcases/testcases_2D.py added (mode: 100644) (index 0000000..b08cccf)
1 #!/usr/bin/env python
2 # coding: utf-8
3
4 #оӵ Тӧдьы кабъёс (ящикьёс) эскером
5
6 from .. import whitebox
7 from .. import g_models as gm
8 from .. import f_models
9 import scipy.stats as stats
10
11 import numpy as np
12
13 f = f_models.SNorm(2)
14 h = f_models.UnCorD((stats.norm(-12,5), stats.norm(12,5)))
15 #č pro různorodost
16 gew = f_models.Nataf((stats.gumbel_r, stats.weibull_min(c=1.5)), [[1,0.8], [0.8,1]])
17 #gew = f_models.Nataf((stats.norm, stats.norm), [[1,0.8], [0.8,1]])
18 #gew = f_models.Nataf((stats.gumbel_r, stats.gumbel_l), [[1,0.8], [0.8,1]])
19 #č uniforma je na [0, 1], takže v cajku
20 u = f_models.UnCorD((stats.uniform, stats.uniform))
21
22 __all__ = []
23
24 #č zde ten __all__ těžko dohlídáme
25 #č budeme přidávat do seznamu postupně
26 def add(str):
27 __all__.append(str)
28
29
30 # HyperRovina, куда ж без неё?
31 # Gauß
32 #############
33 # g= a*X1 + b*X2 + c
34 # becames
35 # gm = Linear_nD(betas=(a,b,c))
36 add('plane_2D')
37 def plane_2D():
38 return whitebox.HyperPlane(betas=(0.7,-1,2.5))
39
40
41
42 # nobody knows whats going on there
43 """ parametry pravdepodobnostniho rozdeleni pro Z_min s Weib. velicinami
44 wb_scales=(1,1) - tuple of Weibull scale parameters, len(wb_scales)==nvar
45 shape = 5
46 je třeba zadat buď pf_exact, nebo konštantu u funkce minima Z_min """
47 # g= min(X1, X2, X3, X4) + c
48 add('weibull_min_2D')
49 def weibull_min_2D():
50 return whitebox.Weibull_Z_min(wb_scales=(1.5,0.9), shape=4, const=-2.5)
51 #whitebox.Weibull_Z_min(wb_scales=(1.5,0.9), shape=4, pf_exact=1.0e-6)
52
53
54
55 # neither Gauß knows whats going on there
56 #whitebox.Gaussian_Z_sumexp(nvar=2, pf_exact=1.0e-6)
57
58
59
60
61 # je třeba zadat buď pf_exact, nebo konštantu u funkce Z_sumsq
62 # g = np.sum(sample**2, axis=1) - self._const
63 add('sumsq_2D')
64 def sumsq_2D():
65 return whitebox.SNorm_Z_sumsq(nvar=2, const=9.2)
66 #whitebox.SNorm_Z_sumsq(nvar=2, pf_exact=1.0e-6)
67
68
69
70 # libustka
71 add('ball_2D')
72 def ball_2D():
73 return whitebox.SNorm_S_ball(nvar=2, r=5)
74
75
76
77
78 """suma velicin plus beta*sqrt(Nvar. )
79 Pro IID Gaussian ma tohle ind. spol. beta = beta
80 The same as Linear_nD, but defined via
81 beta in sense of reliability index"""
82 # Z_sum s divokým rozdělením
83 # pro obyčejný norm dist viz. HyperPlane
84 add('sum_2D')
85 def sum_2D():
86 return whitebox.WhiteBox(gew, gm.Z_sum(nvar=2, beta_exact=2))
87
88
89
90 # soucin velicin plus nějaká konstanta
91 # g= X1 * X2 * X3 * X4 + c
92 add('prod_2D_1')
93 add('prod_2D_5')
94 def prod_2D_1():
95 return whitebox.WhiteBox(f, gm.Z_prod(const=1))
96 def prod_2D_5():
97 return whitebox.WhiteBox(f, gm.Z_prod(const=5))
98
99
100
101 # min velicin plus nějaká konstanta
102 # g= min(X1, X2, X3, X4) + c
103 add('min_2D')
104 def min_2D():
105 return whitebox.WhiteBox(f, gm.Z_min(const=5))
106
107
108
109
110
111 # g = np.sum(np.exp(-(sample**2)), axis=1) + self._const
112 add('sumexp_2D')
113 def sumexp_2D():
114 return whitebox.WhiteBox(f, gm.Z_sumexp(const=5))
115
116
117
118 """
119 c = 0.5 # wave amplitude in Gaussian space
120 d = 3.0 # average of sine fiunction in Gaussian space
121 k = 6 # number of sine waves (design points)
122 """
123 add('sinball_2D')
124 def sinball_2D():
125 return whitebox.WhiteBox(f, gm.S_ballSin2D(c=0.5, d=3.0, k=6))
126
127
128
129
130
131 # g = np.sum(sample**2, axis=1) - self._const
132 add('nataf_sumsq_2D')
133 def nataf_sumsq_2D():
134 return whitebox.WhiteBox(gew, gm.Z_sumsq(const=9.2))
135
136
137
138
139 # obecný S_ball bez výpočtu pf
140 add('nataf_ball_2D')
141 def nataf_ball_2D():
142 return whitebox.WhiteBox(gew, gm.S_ball(r=5))
143
144
145
146
147 # kruznicka
148 add('circle_2D')
149 def circle_2D():
150 return whitebox.WhiteBox(f, gm.ConicSection(l=2, e=0, teta=-np.pi/4, c=(-3,1), sign=1))
151
152
153 # Fajvka
154 # člověk se tu bez půllitry nevýzná
155 # viz. conic_section_boundaries_test.py pro inspiraciju
156 add('five_2D')
157 def five_2D():
158 return whitebox.WhiteBox(h, gm.ConicSection(l=.1, e=1.1, teta=-np.pi/4, c=(-3,1), sign=1))
159
160
161 # Exp_P
162 # g = y - 1./np.exp(x)**5
163 # g = y - self._k/np.exp(x)**self._pow
164 # k tomuhlenstomu by bylo možně výtvořiť bílou skřiňku (pro výpočet pf)
165 add('exp_P_2D')
166 def exp_P_2D():
167 return whitebox.WhiteBox(u, gm.Exp_P(k=1., pow=5))
168
169
170
171
172 # Sin2D
173 # g = self._kx * x + self._ky * y + np.sin(self._kxsin*x) + self._const
174 add('sin_2D')
175 def sin_2D():
176 return whitebox.WhiteBox(f, gm.Sin2D(kx=-1/4., ky=-1, kxsin=5, const=5))
177
178
179
180
181
182 # Prod_FourBetas
183 # g = beta^2/2 - |x1 * x2|
184 #whitebox.WhiteBox(f, gm.Prod_FourBetas(beta=2.0))
185
186
187
188 """ BlackSwan2D
189 a = 2.0 # boundary for x1
190 b = 5.0 # boundary for x2
191 y = np.where(sim[:,0] <= a, sim[:,0], sim[:,1])
192 # pro x1 <= a y = x1
193 # pro x1 > a y = x2
194 g = b - y # failure for b<y"""
195 #whitebox.WhiteBox(f, gm.BlackSwan2D(a=2.0, b=5.0))
196
197
198
199 """ Metaballs2D
200 # sebemenší parametrizace
201 y1 = 4/9*(x1 + 2 )**2 + 1/25 * (x2 )**2
202 y2 = 1/4*(x1 - 2.5)**2 + 1/25 * (x2-0.5)**2
203 g = 30.0/( y1**2 + 1.0 ) + 20.0/( y2**2 + 1.0 ) - self._const"""
204 #whitebox.WhiteBox(f, gm.Metaballs2D(const=5))
205
206
207
208
209 """ Logistic2D
210 # sebemenší parametrizace
211 y1 = self._c1 - x1
212 y2 = self._c2 + x2
213 y3 = 1.0/(1+np.exp(-2.0*y2)) - 0.5
214
215 if self.easy_version:
216 g = np.minimum(y1,y2) # easy version for SuS
217 else:
218 g = np.minimum(y1,y3) # difficult version for SuS"""
219 #whitebox.WhiteBox(f, gm.Logistic2D(c1=5, c2=4, easy_version=True))
220
221
222
223
224 """ CosExp2D
225 # sebemenší parametrizace
226 s = self._s
227 # g = cos((np.exp(-xm-s ))*xm) * np.exp(-(x +s )/3)
228 g = np.cos( ( np.exp(-sample[:,0] - s ) )*sample[:,0]) * np.exp( -(sample[:,0] + s )/3 ) """
229 #whitebox.WhiteBox(f, gm.CosExp2D(s=5))
230
231
232
233 """ FourBranch2D
234 g1 = k1 + 0.1*(x1 - x2)**2 - (x1 + x2)/np.sqrt(2)
235 g2 = k1 + 0.1*(x1 - x2)**2 + (x1 + x2)/np.sqrt(2)
236 g3 = (x1 - x2) + k2/np.sqrt(2)
237 g4 = (x2 - x1) + k2/np.sqrt(2) #č byl tu překlep v jednom članku
238 g = np.min((g1, g2, g3, g4), axis=0)"""
239 #whitebox.WhiteBox(f, gm.FourBranch2D(k1=3, k2=7))
240
241
242
File testcases/testcases_2D_papers.py renamed from testcases_2D.py (similarity 88%) (mode: 100644) (index 3063a1b..eeb3598)
... ... of different well-known 2D problems
7 7 """ """
8 8
9 9 import numpy as np import numpy as np
10 from . import g_models as gm
11 from . import f_models
12 from .whitebox import WhiteBox
10 from .. import g_models as gm
11 from .. import f_models
12 from ..whitebox import WhiteBox
13 13 import scipy.stats as stats import scipy.stats as stats
14 14 from scipy import integrate # for Pareto tail from scipy import integrate # for Pareto tail
15 15
16 __all__ = [
17 'uniform_branin_2D',
18 'snorm_four_branch_2D',
19 'snorm_four_branch_2D_2',
20 'snorm_piecewise_2D_linear',
21 'piecewise_pareto_tail',
22 'snorm_min_2D_linear',
23 'snorm_min_2D_logistic',
24 ]
25
16 26 f = f_models.SNorm(2) f = f_models.SNorm(2)
17 27 # Uniform-uniform # Uniform-uniform
18 28 # from scipy: "In the standard form, the distribution is uniform on [0, 1]." # from scipy: "In the standard form, the distribution is uniform on [0, 1]."
19 29 u = f_models.UnCorD((stats.uniform, stats.uniform)) u = f_models.UnCorD((stats.uniform, stats.uniform))
20 30
21 testcases = []
31
22 32
23 33 """ """
24 34 I would like to use function definitions to clearly isolate ones testcases I would like to use function definitions to clearly isolate ones testcases
 
... ... def uniform_branin_2D():
31 41 wt.pf_exact_method = 'known value' #"some guys said me that" it's 0.256 wt.pf_exact_method = 'known value' #"some guys said me that" it's 0.256
32 42 wt.description = "Rescaled Branin function" wt.description = "Rescaled Branin function"
33 43 return wt return wt
34 testcases.append(uniform_branin_2D())
35 44
36 45 # Four branch system # Four branch system
37 46 def snorm_four_branch_2D(): def snorm_four_branch_2D():
 
... ... def snorm_four_branch_2D():
40 49 wt.pf_exact_method = 'known value' #"some guys said me that" wt.pf_exact_method = 'known value' #"some guys said me that"
41 50 wt.description = "Four branch system from some paper" wt.description = "Four branch system from some paper"
42 51 return wt return wt
43 testcases.append(snorm_four_branch_2D())
44 52
45 53
46 54 def snorm_four_branch_2D_2(): def snorm_four_branch_2D_2():
 
... ... def snorm_four_branch_2D_2():
50 58 #wt.pf_exact_method = 'known value' #"some guys said me that" it's 0.256 #wt.pf_exact_method = 'known value' #"some guys said me that" it's 0.256
51 59 wt.description = "Four branch system from another paper" wt.description = "Four branch system from another paper"
52 60 return wt return wt
53 testcases.append(snorm_four_branch_2D_2())
54 61
55 62
56 63
 
... ... def snorm_piecewise_2D_linear():
62 69 wt = WhiteBox(f, gm.piecewise_2D_linear) wt = WhiteBox(f, gm.piecewise_2D_linear)
63 70 wt.description = "Breitung. Piecewise linear function" wt.description = "Breitung. Piecewise linear function"
64 71 return wt return wt
65 testcases.append(snorm_piecewise_2D_linear())
66 72
67 73
68 74
 
... ... def piecewise_pareto_tail():
98 104 wt.pf_exact_method = 'FORM-type thought-three beta points' wt.pf_exact_method = 'FORM-type thought-three beta points'
99 105 wt.description = "Breitung. Pareto tail" wt.description = "Breitung. Pareto tail"
100 106 return wt return wt
101 testcases.append(piecewise_pareto_tail())
102 107
103 108
104 109
 
... ... def snorm_min_2D_linear():
107 112 wt = WhiteBox(f, gm.Logistic2D()) wt = WhiteBox(f, gm.Logistic2D())
108 113 wt.description = "Breitung. 2D linear (easy version for SuS)" wt.description = "Breitung. 2D linear (easy version for SuS)"
109 114 return wt return wt
110 testcases.append(snorm_min_2D_linear())
111 115
112 116 def snorm_min_2D_logistic(): def snorm_min_2D_logistic():
113 117 wt = WhiteBox(f, gm.Logistic2D(easy_version=False)) wt = WhiteBox(f, gm.Logistic2D(easy_version=False))
114 118 wt.description = "Breitung. Logistic 2D function (hard version for SuS)" wt.description = "Breitung. Logistic 2D function (hard version for SuS)"
115 119 return wt return wt
116 testcases.append(snorm_min_2D_logistic())
117 120
118 121
119 122
File whitebox.py changed (mode: 100644) (index 2c4e7cc..07fb851)
... ... from . import f_models
30 30 import copy import copy
31 31 from . import g_models from . import g_models
32 32
33 from . import plot
34 33
35 34
36 35 class WhiteBox: class WhiteBox:
 
... ... class WhiteBox:
130 129 return getattr(wt.sample_box, attr) return getattr(wt.sample_box, attr)
131 130
132 131 # just plot, green points, red points... # just plot, green points, red points...
133 plot2D = plot.plot2D
134 plot3D = plot.plot3D
135 show2D = plot.show2D
136 show3D = plot.show3D
132 # commented out in order to not import
133 # matplotlib and pyqtgraph unnecessarly
134 #plot2D = plot.plot2D
135 #plot3D = plot.plot3D
136 #show2D = plot.show2D
137 #show3D = plot.show3D
137 138
138 139
139 140 def get_2D_boundary(wt, nrod=100, viewport_sample=None, viewport_space='R'): def get_2D_boundary(wt, nrod=100, viewport_sample=None, viewport_space='R'):
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