Subject | Hash | Author | Date (UTC) |
---|---|---|---|
whitebox: implement method to .get_sensitivities() from 2D boundary | 5729723cfe5c93658c3739fbfec384e135b44073 | I am | 2023-03-09 22:14:27 |
simplex.SeparationAxis: make an perfectionism-driven change | 8278c48915c326e7731f1934732550c5b9c18e64 | I am | 2023-03-09 21:51:18 |
simplex.SeparationAxis: little fix for an hypotetical issue | 838e476387c31f9c6847cf7ae8a2a01514038a03 | I am | 2023-03-09 15:19:48 |
simplex._Sense: bugfix | 3ae53e8b178107b8beb6ad960ec683c8d38a3b3c | I am | 2023-03-07 23:23:36 |
simplex._Sense: totally rework, finalized vectors are introduced | 829ba58a93481541a58cd4a9f6dae0ba9fb611c6 | I am | 2023-03-07 13:33:38 |
simplex: preliminary commit of an _Sense's auxiliary class - brand new SeparationAxis | c0bbb714400df48abf7a398e018c5626803bf024 | I am | 2023-03-04 10:17:12 |
simplex._Sense: one more optimization | a51f4ba65ad4a55ecc74fd82a6e011a4eeed8a5d | I am | 2023-02-26 15:21:23 |
qt_gui.qt_plot: implement sensitivity-related Arrows class | b5365ae3ca3ab0ed8018e60d4e8711c5c30e4d96 | I am | 2023-02-26 14:31:10 |
simplex._Sense: rename "sensibility" to sensitivity | a9d56d5386730263eb27e6e31f07b99bab0620fb | I am | 2023-02-26 14:29:54 |
g_models: add quadratic | 013b4ddc108b94061eaebc1a10d18427f10a34d4 | I am | 2023-02-24 08:04:12 |
simplex._Sense: one more performance trick | 59b423cca53b9975da67d876110927f233506de8 | I am | 2023-02-24 08:03:23 |
simplex: implement separability-based sensibility analysis (new brand _Sense class) | 9c5d58f2301893ceaec1b0e90bff76035cfa15b2 | I am | 2023-02-23 18:49:11 |
dicebox.circumtri.CirQTri: switch to GaussCubatureIntegration | 5b52dd25cb7a997af4953230116deb9efc577d56 | I am | 2023-02-11 04:32:48 |
simplex: implement GaussCubatureIntegration in the most memory-friendly way | 689d253ae7e2a22242258fd5bef0a069caf7cf75 | I am | 2023-02-11 04:31:11 |
convex_hull.QHullCubature: implement memory-friendly outside (chi) integration | ad8210a04b1e0903de7435cad16b1304707d0e6e | I am | 2023-02-09 22:22:05 |
qt_gui.qt_plot: require box recommendation to show next point | 6f726047f7f08e884359020eaa1eac6f6cc125d2 | I am | 2023-02-09 11:51:44 |
dicebox.circumtri.CirQTri.get_circum_node: limit circumcenter by explore radius, not by just R | 136ec73bb06da16c1f2bce64b3c349be4c8ba975 | I am | 2023-02-09 03:09:51 |
dicebox.circumtri: implement new brand CirQTri box | 5879b8ad6317c65aa9481b59f76b6159f19e247a | I am | 2023-02-09 01:29:10 |
simplex.FullCubatureIntegration: store simplex probabilities in sorted dicts | c0da90731ff3ede47d9b4eec0ad9b28a29027167 | I am | 2023-02-09 01:23:14 |
dicebox.circumtri: exploratory: even better idea | 811ab11cd7172ff4a3807992f4928be2e8068ec0 | I am | 2023-02-08 15:31:23 |
File | Lines added | Lines deleted |
---|---|---|
wellmet/whitebox.py | 50 | 1 |
File wellmet/whitebox.py changed (mode: 100644) (index 4b3c7d9..0a36430) | |||
... | ... | from .samplebox import SampleBox | |
33 | 33 | from . import f_models | from . import f_models |
34 | 34 | import copy | import copy |
35 | 35 | from . import g_models | from . import g_models |
36 | from . import misc as wmisc | ||
36 | 37 | ||
37 | 38 | ||
38 | 39 | ||
... | ... | class WhiteBox: | |
171 | 172 | bounds_R = wt.get_2D_R_boundary(nrod, (xmin, xmax), (ymin, ymax)) | bounds_R = wt.get_2D_R_boundary(nrod, (xmin, xmax), (ymin, ymax)) |
172 | 173 | # transformuji na seznam vzorků | # transformuji na seznam vzorků |
173 | 174 | return [wt.f_model.new_sample(bounds_R[i], extend=True) for i in range(len(bounds_R))] | return [wt.f_model.new_sample(bounds_R[i], extend=True) for i in range(len(bounds_R))] |
174 | |||
175 | |||
176 | |||
177 | def get_sensitivities(wt, nrod=200, G_radius=7, space='R'): | ||
178 | #č nejdřív musíme získat relevantní ve skutečném prostoru rámec | ||
179 | view_sample = wmisc.get_isodistances(wt.f_model, G_radius, nrod) | ||
180 | view_sample_R = view_sample.R | ||
181 | |||
182 | #č jakože tímto vyfiltrujeme nejen NaN, ale i nekonečna? | ||
183 | xmin = np.ma.masked_invalid(view_sample_R[:,0]).min() | ||
184 | xmax = np.ma.masked_invalid(view_sample_R[:,0]).max() | ||
185 | ymin = np.ma.masked_invalid(view_sample_R[:,1]).min() | ||
186 | ymax = np.ma.masked_invalid(view_sample_R[:,1]).max() | ||
187 | |||
188 | #č skoro hotovo. Jsme připravení získat seznam hraničních bodů od g_modelu | ||
189 | boundaries = wt.get_2D_R_boundary(nrod, (xmin, xmax), (ymin, ymax)) | ||
190 | |||
191 | sensitivity = np.zeros(2) | ||
192 | # boundaries are instances of an obscure Ingot class. | ||
193 | # Relicts from the WellMet's childhood | ||
194 | for boundary in boundaries: | ||
195 | #č podle ono to tam musí implicitně vzít podle R | ||
196 | sample = wt.f_model.new_sample(boundary, extend=True) | ||
197 | sample_space = getattr(sample, space) | ||
198 | vectors = np.diff(sample_space, axis=0) | ||
199 | #č k těm hustotám můžeme podstupovat několika způsoby | ||
200 | #č buď zprůměrovat uzly, v nich napočítat hustoty. | ||
201 | #č Nebo napočítat hustoty v tam, kde je máme, | ||
202 | #č zprůměrovat už jen hustoty. | ||
203 | #č Jdeme na tu druhou variantu | ||
204 | pdf = sample.pdf(space) | ||
205 | pdf[:-1] += pdf[1:] | ||
206 | #pdf /= 2 | ||
207 | pdf = pdf[:-1] | ||
208 | |||
209 | #č pokud nebudeme chtit nic křeslit, | ||
210 | #č tak samotné vektory ani nepotřebujeme | ||
211 | np.square(vectors, out=vectors) | ||
212 | |||
213 | #č zdá se, že ani délky nepotřebujeme | ||
214 | #lengths = np.sum(vectors, axis=1) | ||
215 | #vectors /= lengths | ||
216 | |||
217 | vectors *= pdf.reshape(-1,1) | ||
218 | |||
219 | sensitivity += np.sum(vectors, axis=0)[:2] | ||
220 | |||
221 | sensitivity /= np.sum(sensitivity) | ||
222 | y, x = sensitivity | ||
223 | return x, y | ||
175 | 224 | ||
176 | 225 | ||
177 | 226 |