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)
qt_plot:TriEstimationGraph: WIP 58d98e0775b55bda449c4c7b7e7eac1a2f573097 I am 2020-11-04 02:32:37
plot: messages fix 336481a61c2d8ac302437b65f641c7d39767c7ea I am 2020-11-04 02:32:08
plot: no more that annoying error message 3929e09841abea504e152935bb6009a57eb8f7a9 I am 2020-11-04 01:24:50
qt_plot.SimpleSimplexEstimationGraph: context menu reworked 28eed9a1b3dad2e3d4441383640e83312c7fac9c I am 2020-11-04 01:13:14
qt_plot: start in box's tri_space by default 909b86f0cb63713bbc02028e93cfbbea1f53071c I am 2020-11-03 19:40:34
qt_plot: ConvexHull2D added bc95406166c081db1df39c60099b908bf24aa16e I am 2020-11-03 19:33:28
dicebox.Chrt.assess_candidates: hračky s hustotama 0fa8f1fe51cebbca7010f3c8cda13525dfbb8fd6 I am 2020-11-03 03:38:52
dicebox: get_pf_estimations() fix 6eda04f0abf77b2586b599dd72c82e438464be4d I am 2020-11-03 02:21:37
dicebox: Erjee class added ef1a9e5b9c0de5d842e2580d3fe7c669d68d95f5 I am 2020-11-03 01:16:04
dicebox.Chrt: .get_pf_estimation() added 7b6685587ad2d7922ae12520c9aede226febe219 I am 2020-10-27 16:05:32
simplex.Shull: нельзя так просто взять и написать IS интегровалку 128ee86c97c82e555fb8b94a90eaa071f873737a I am 2020-10-27 16:03:07
simplex.Shull: move sball sampling distribution to the conter of convex_hull 5703fa4c8e4e70965040e9381cf888220ac543dc I am 2020-10-26 21:03:34
gl_plot: show first 3 dims of nD problems eedca2d89211340a8c2f1131b35c83c65f8f3bc7 Alex 2020-10-26 18:38:21
dicebox.Chrt: explore .convex_hull for gl_plot f2b7777c01638a72b8ca3b38aa3d75bfd55bbdc0 Alex 2020-10-26 18:37:17
gl_plot.ConvexHull: ConvexHull reabilitation 188903a3b14611f8a36d22120fc5fd398d7a79b2 Alex 2020-10-26 17:46:32
blackbox.OptimizedCensoringSampling: double adding to ConvexHull fix (only historical meaning) ddd2fbdf40aed2840a66685e30c6e3aa8078b11f Alex 2020-10-26 17:42:24
restore blackbox version from 16.9.20 5947a853d65c32afaf5151a9b04e738f3c27fbeb Alex 2020-10-26 17:12:00
dicebox: add fee and fee2 criteria 54b3e5bcc54f17fa5695653a73e66a8d0f9d84b1 I am 2020-10-25 21:31:37
simplex.Shull: dirty hack to eliminate looping at very beginnig, where Shull cannot hit convex_hull 792607729c198940b8b8c7bece5be846f41a351e I am 2020-10-25 18:14:29
f_models: 1D input error fix 022d2024ff3a3114c8e73c977892992cdb6e0512 I am 2020-10-25 09:20:12
Commit 58d98e0775b55bda449c4c7b7e7eac1a2f573097 - qt_plot:TriEstimationGraph: WIP
Author: I am
Author date (UTC): 2020-11-04 02:32
Committer name: I am
Committer date (UTC): 2020-11-04 02:32
Parent(s): 336481a61c2d8ac302437b65f641c7d39767c7ea
Signer:
Signing key:
Signing status: N
Tree: 907eb72a68494c0f28f8a0251794a35cc79f9a92
File Lines added Lines deleted
qt_plot.py 75 116
File qt_plot.py changed (mode: 100644) (index 7fe1406..ee2008a)
... ... class QtGuiPlot2D(QtGui.QMainWindow):
175 175
176 176 #č graphy už nemusí jít po stm widgetech #č graphy už nemusí jít po stm widgetech
177 177 dock = QtGui.QDockWidget("TRI_overall estimation graph", self) dock = QtGui.QDockWidget("TRI_overall estimation graph", self)
178 dock.setWidget(TriEstimationGraph(self, tri_estimation_name='TRI_overall_estimations'))
178 dock.setWidget(TriEstimationGraph(self.sample_box, 'TRI_overall_estimations', self, dock))
179 179 self.dockables.append(dock) self.dockables.append(dock)
180 180 self.tabifyDockWidget(self.dockables[0], dock) self.tabifyDockWidget(self.dockables[0], dock)
181 181
 
... ... def get_estimation_data(estimations, metric):
870 870
871 871
872 872
873 class TriEstimationGraph(pg.PlotWidget):
874 def __init__(self, samplebox_item, tri_estimation_name='TRI_current_estimations', parent=None, *args, **kwargs):
875 super().__init__(parent)
876 self.sb_item = samplebox_item
877 self.sb_item.box_runned.connect(self.redraw)
878 self.sb_item.estimation_added.connect(self.redraw)
879
880 self.black_box = samplebox_item.sample_box
881 self.tri_estimation_name = tri_estimation_name
882 self.setBackground('w')
883
884 # creates instance of LegendItem
885 # and saves it into plotItem.legend
886 self.legend = self.addLegend()
887
888 x = y = () # zde jen vytvoříme kostru, nakrmime daty v .redraw()
889
890 #self.pen_f = self.plot(x, y, fillLevel=0, brush='r') # red
891 pen = pg.mkPen(color=(255, 0, 0), width=3)#, style=QtCore.Qt.DashLine)
892 self.pen_f = self.plot(x, y, pen=pen) # red
893 self.pen_mix = self.plot(x, y, fillLevel=0, brush=(255, 165, 0)) # orange
894 self.pen_outside = self.plot(x, y, fillLevel=0, brush=0.8) # grey
895 self.pen_success = self.plot(x, y, fillLevel=0, brush='g') # green
896 self.legend.addItem(self.pen_success, "success domain estimation")
897 self.legend.addItem(self.pen_outside, "out of sampling domain estimation")
898 self.legend.addItem(self.pen_mix, "mixed simplices measure")
899 self.legend.addItem(self.pen_f, "failure domain estimation")
900
901 self.pen_vertex = self.plot(x, y, pen='c', name='simple')
902 self.pen_weighted_vertex = self.plot(x, y, pen=(170, 170, 255), name='weighted')
903 self.legend.addItem(self.pen_vertex, "simple pf estimation")
904 self.legend.addItem(self.pen_weighted_vertex, "weighted pf estimation")
905
906 self.pen_exact = self.plot(x, y, pen='b') # blue
907 #self.legend.addItem(self.pen_exact)
908
909 self.setLogMode(False, True)
910
911 self.redraw()
912
913
914 def redraw(self):
915 try: # тут всё что угодно может пойти не так
916 data = self.black_box.guessbox.estimations[self.tri_estimation_name]
917 x = data[0]
918 # it can be effectively done with pandas
919 df = pd.DataFrame(data[1])
920 # -1 = 'out', 0=success, 1=failure, 2=mix
921 df.rename(columns={-1:'out', 0:'success', 1:'failure', 2:'mix'}, inplace=True)
922
923 # Update the data
924 # když se někde objeví nula se zapnutým LogModem - qtpygraph hned spadne a není možne ten pad zachytit
925 def nonzero(data): return np.where(data > 0, data, 1)
926 self.pen_f.setData(np.array(x)[df.failure.to_numpy() > 0], df.failure.to_numpy()[df.failure.to_numpy() > 0])
927 self.pen_mix.setData(x, nonzero(df.failure))
928 self.pen_outside.setData(x, nonzero(df.failure+df.mix))
929 self.pen_success.setData(x, nonzero(df.failure+df.mix+df.out)) # kontrolu, zda je to 1, nechame uživateli
930
931 self.pen_exact.setData((min(x),max(x)), (self.black_box.pf_exact, self.black_box.pf_exact))
932
933
934 if 'vertex_estimation' in self.black_box.guessbox.estimations:
935 data = self.black_box.guessbox.estimations['vertex_estimation']
936 x, y = (*data,)
937 # Update the data
938
939 self.pen_vertex.setData(x, nonzero(np.array(y)))
940
941 if 'weighted_vertex_estimation' in self.black_box.guessbox.estimations:
942 data = self.black_box.guessbox.estimations['weighted_vertex_estimation']
943 x, y = (*data,)
944 # Update the data
945
946 self.pen_weighted_vertex.setData(x, nonzero(np.array(y)))
947
948
949
950 except BaseException as e:
951 print(self.__class__.__name__ + ":", repr(e))
952
953
954
955
956 # pen_f.opts['logMode']
957 # pen_outside.setLogMode(False, False)
958 #setLogMode(False, False)
959
960
961
962
963 873
964 874 class SimpleSimplexEstimationGraph(pg.PlotWidget): class SimpleSimplexEstimationGraph(pg.PlotWidget):
965 def __init__(self, black_box, samplebox_item, parent=None, *args, **kwargs):
966 super().__init__(parent)
967 self.sb_item = samplebox_item
968 self.sb_item.box_runned.connect(self.redraw)
969 self.sb_item.estimation_added.connect(self.redraw)
875 def __init__(self, dice_box, stream=None, parent=None, *args, **kwargs):
876 super().__init__(parent, *args, **kwargs)
877 self.stream = stream
878 if stream is not None:
879 self.stream.box_runned.connect(self.redraw)
880 self.stream.estimation_added.connect(self.redraw)
970 881
971 self.black_box = black_box
882 self.dice_box = dice_box
972 883
884 self.setup_context_menu()
885 self.setup()
886
887 def setup_context_menu(self):
973 888 # creates instance of LegendItem # creates instance of LegendItem
974 889 # and saves it into plotItem.legend # and saves it into plotItem.legend
975 890 self.legend = self.addLegend() self.legend = self.addLegend()
 
... ... class SimpleSimplexEstimationGraph(pg.PlotWidget):
977 892 self.plotItem.ctrl.xGridCheck.setChecked(True) self.plotItem.ctrl.xGridCheck.setChecked(True)
978 893 self.plotItem.ctrl.yGridCheck.setChecked(True) self.plotItem.ctrl.yGridCheck.setChecked(True)
979 894
980 self.setup_context_menu()
981
982 self.setup()
983
984 def setup_context_menu(self):
985 895 # delete build-in Transforms (with Log_x and Log_y) options, # delete build-in Transforms (with Log_x and Log_y) options,
986 896 # they can cause uncachable exception (on any zero in data) and crash # they can cause uncachable exception (on any zero in data) and crash
987 897 self.plotItem.ctrlMenu.removeAction(self.plotItem.ctrlMenu.actions()[0]) self.plotItem.ctrlMenu.removeAction(self.plotItem.ctrlMenu.actions()[0])
 
... ... class SimpleSimplexEstimationGraph(pg.PlotWidget):
993 903 self.legend_chk.setCheckable(True) self.legend_chk.setCheckable(True)
994 904 self.legend_chk.triggered.connect(lambda: self.legend.setVisible(self.legend_chk.isChecked())) self.legend_chk.triggered.connect(lambda: self.legend.setVisible(self.legend_chk.isChecked()))
995 905 self.custom_menu.addAction(self.legend_chk) self.custom_menu.addAction(self.legend_chk)
906 # apply custom menu option
907 self.legend.setVisible(self.legend_chk.isChecked())
996 908
997 909 self.proxy_chk = QtGui.QAction("Proxy", self.custom_menu) self.proxy_chk = QtGui.QAction("Proxy", self.custom_menu)
998 910 self.proxy_chk.setCheckable(True) self.proxy_chk.setCheckable(True)
 
... ... class SimpleSimplexEstimationGraph(pg.PlotWidget):
1022 934 def export_to_excel(self): def export_to_excel(self):
1023 935 pass pass
1024 936
937
938
939 # self.legend.addItem(self.pen_success, "success domain estimation")
940 # self.legend.addItem(self.pen_outside, "out of sampling domain estimation")
941 # self.legend.addItem(self.pen_mix, "mixed simplices measure")
942 # self.legend.addItem(self.pen_f, "failure domain estimation")
943
1025 944 def setup(self, *args, **kwargs): def setup(self, *args, **kwargs):
1026 945 self.clear() self.clear()
1027 946 self.setBackground('w') self.setBackground('w')
1028 947 x = y = () # zde jen vytvoříme kostru, nakrmime daty v .redraw() x = y = () # zde jen vytvoříme kostru, nakrmime daty v .redraw()
1029 948
1030 #self.plotItem.ctrlMenu.actions()[3].
1031
1032 # apply custom menu option
1033 self.legend.setVisible(self.legend_chk.isChecked())
1034
1035 949 if self.log_y_chk.isChecked(): if self.log_y_chk.isChecked():
1036 950 self.setLogMode(y=True) self.setLogMode(y=True)
1037 951 #self.pen_f = self.plot(x, y, fillLevel=0, brush='r') # red #self.pen_f = self.plot(x, y, fillLevel=0, brush='r') # red
 
... ... class SimpleSimplexEstimationGraph(pg.PlotWidget):
1049 963 self.pen_mix = self.plot(x, y, fillLevel=0, brush=(255, 165, 0)) # orange self.pen_mix = self.plot(x, y, fillLevel=0, brush=(255, 165, 0)) # orange
1050 964 self.pen_f = self.plot(x, y, fillLevel=0, brush='r') # red self.pen_f = self.plot(x, y, fillLevel=0, brush='r') # red
1051 965
1052 self.pen_vertex = self.plot(x, y, pen='c', name='simple')
1053 self.pen_weighted_vertex = self.plot(x, y, pen=(170, 170, 255), name='weighted')
966 self.pen_vertex = self.plot(x, y, pen='c', name="simple pf estimation")
967 self.pen_weighted_vertex = self.plot(x, y, pen=(170, 170, 255), name="weighted pf estimation")
1054 968 try: try:
1055 exact_name = self.black_box.pf_exact_method
969 exact_name = self.dice_box.pf_exact_method
1056 970 except: except:
1057 971 exact_name = "" exact_name = ""
1058 972 self.pen_exact = self.plot(x, y, pen='b', name=exact_name) # blue self.pen_exact = self.plot(x, y, pen='b', name=exact_name) # blue
 
... ... class SimpleSimplexEstimationGraph(pg.PlotWidget):
1072 986 # bere co chce a jak chce # bere co chce a jak chce
1073 987 # ne že by to bylo nějak šetrný # ne že by to bylo nějak šetrný
1074 988 # estimation je slovníkem # estimation je slovníkem
1075 for estimation in self.black_box.estimations:
989 for estimation in self.dice_box.estimations:
1076 990 # nsim musí mäť každej odhad # nsim musí mäť každej odhad
1077 991 # pokud nemá - je třeba jej prostě opravit # pokud nemá - je třeba jej prostě opravit
1078 992 nsim = estimation['nsim'] nsim = estimation['nsim']
 
... ... class SimpleSimplexEstimationGraph(pg.PlotWidget):
1110 1024 self.pen_outside.setData(x, df.failure+df.mix+df.out) self.pen_outside.setData(x, df.failure+df.mix+df.out)
1111 1025 self.pen_success.setData(x, df.failure+df.mix+df.out+df.success) # kontrolu, zda je to 1, nechame uivateli self.pen_success.setData(x, df.failure+df.mix+df.out+df.success) # kontrolu, zda je to 1, nechame uivateli
1112 1026
1113 self.pen_vertex.setData(*get_estimation_data(self.black_box.estimations, 'vertex_estimation'))
1114 self.pen_weighted_vertex.setData(*get_estimation_data(self.black_box.estimations, 'weighted_vertex_estimation'))
1027 self.pen_vertex.setData(*get_estimation_data(self.dice_box.estimations, 'vertex_estimation'))
1028 self.pen_weighted_vertex.setData(*get_estimation_data(self.dice_box.estimations, 'weighted_vertex_estimation'))
1115 1029
1116 1030 if (xmax - xmin) > 0: if (xmax - xmin) > 0:
1117 1031 if hasattr(self.black_box, 'pf_exact'): if hasattr(self.black_box, 'pf_exact'):
1118 1032 # poslední. I když spadne, tak už nikomu moc nevadí # poslední. I když spadne, tak už nikomu moc nevadí
1119 self.pen_exact.setData((xmin,xmax), (self.black_box.pf_exact, self.black_box.pf_exact))
1033 self.pen_exact.setData((xmin,xmax), (self.black_box.pf_exact, self.dice_box.pf_exact))
1120 1034
1121 1035 except BaseException as e: except BaseException as e:
1122 1036 print(self.__class__.__name__ + ":", repr(e)) print(self.__class__.__name__ + ":", repr(e))
 
... ... class SimpleSimplexEstimationGraph(pg.PlotWidget):
1131 1045
1132 1046
1133 1047
1134
1135
1048 class TriEstimationGraph(SimpleSimplexEstimationGraph):
1049 def __init__(self, dice_box, tri_estimation_name='TRI_overall_estimations', stream=None, parent=None, *args, **kwargs):
1050 self.tri_estimation_name = tri_estimation_name
1051 super().__init__(dice_box, stream, parent, *args, **kwargs)
1052
1053
1054
1055 def redraw(self):
1056 try: # тут всё что угодно может пойти не так
1057 data = self.dice_box.guessbox.estimations[self.tri_estimation_name]
1058 x = data[0]
1059 # it can be effectively done with pandas
1060 df = pd.DataFrame(data[1])
1061 # -1 = 'out', 0=success, 1=failure, 2=mix
1062 df.rename(columns={-1:'out', 0:'success', 1:'failure', 2:'mix'}, inplace=True)
1063
1064 # Update the data
1065 # když se někde objeví nula se zapnutým LogModem - qtpygraph hned spadne a není možne ten pad zachytit
1066 def nonzero(data): return np.where(data > 0, data, 1)
1067 self.pen_f.setData(np.array(x)[df.failure.to_numpy() > 0], df.failure.to_numpy()[df.failure.to_numpy() > 0])
1068 self.pen_mix.setData(x, nonzero(df.failure))
1069 self.pen_outside.setData(x, nonzero(df.failure+df.mix))
1070 self.pen_success.setData(x, nonzero(df.failure+df.mix+df.out)) # kontrolu, zda je to 1, nechame uživateli
1071
1072 self.pen_exact.setData((min(x),max(x)), (self.dice_box.pf_exact, self.dice_box.pf_exact))
1073
1074
1075 if 'vertex_estimation' in self.dice_box.guessbox.estimations:
1076 data = self.dice_box.guessbox.estimations['vertex_estimation']
1077 x, y = (*data,)
1078 # Update the data
1079
1080 self.pen_vertex.setData(x, nonzero(np.array(y)))
1081
1082 if 'weighted_vertex_estimation' in self.dice_box.guessbox.estimations:
1083 data = self.dice_box.guessbox.estimations['weighted_vertex_estimation']
1084 x, y = (*data,)
1085 # Update the data
1086
1087 self.pen_weighted_vertex.setData(x, nonzero(np.array(y)))
1088
1089
1090
1091 except BaseException as e:
1092 print(self.__class__.__name__ + ":", repr(e))
1093
1094
1136 1095
1137 1096
1138 1097
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