@@ -805,11 +805,14 @@ def proportional_fit_plot(self):
805805 popt , pcov = self .get_cvf ().prop_data (np .array (self .get_xr ()), np .array (y_values ))
806806 self .get_cvf ().prop_fit (self .get_x_plot (), * popt )
807807 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().prop_fit (self .get_xr (), * popt ))
808- except (RuntimeError , Exception , Warning , TypeError ):
808+ except (RuntimeError , Exception , Warning , TypeError ) as e :
809809 # logging.error(traceback.format_exc())
810- r2 = 0
811- popt = 0
812- pcov = 0
810+ if __debug__ :
811+ r2 = 0
812+ popt = 0
813+ pcov = 0
814+ else :
815+ raise e
813816
814817 if r2 > bestr2 :
815818
@@ -875,11 +878,14 @@ def quadratic_fit_plot(self):
875878 self .get_cvf ().quad_fit (self .get_x_plot (), * popt )
876879 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().quad_fit (self .get_xr (), * popt ))
877880
878- except (RuntimeError , Exception , Warning , TypeError ):
881+ except (RuntimeError , Exception , Warning , TypeError ) as e :
879882 # logging.error(traceback.format_exc())
880- r2 = 0
881- popt = 0
882- pcov = 0
883+ if __debug__ :
884+ r2 = 0
885+ popt = 0
886+ pcov = 0
887+ else :
888+ raise e
883889
884890 if r2 > bestr2 :
885891
@@ -946,21 +952,23 @@ def cubic_fit_plot(self):
946952 popt , pcov = self .get_cvf ().cubic_data (np .array (self .get_xr ()), np .array (y_values ))
947953 self .get_cvf ().cubic_fit (self .get_x_plot (), * popt )
948954 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().cubic_fit (self .get_xr (), * popt ))
949- except (RuntimeError , Exception , Warning , TypeError ):
955+ except (RuntimeError , Exception , Warning , TypeError ) as e :
950956 # logging.error(traceback.format_exc())
951- r2 = 0
952- popt = 0
953- pcov = 0
957+ if not __debug__ :
958+ r2 = 0
959+ popt = 0
960+ pcov = 0
961+ else :
962+ raise e
954963
955964 if r2 > bestr2 :
956965
957966 bestr2 = r2
958967 bestscale = self .get_x ()[self .get_y ().index (y_values )]
959968 y = y_values
960- poptbest . append ( popt )
969+ poptbest = popt
961970 pcovbest = pcov
962971 self .set_yr (np .array (y ))
963- print (poptbest )
964972 self .set_curve (self .get_cvf ().cubic_fit (np .array (self .get_x_plot ()), * poptbest ))
965973 self .set_popt ('y = {}x^3 + {}x^2 + {}x + {}' .format (* np .round (poptbest , 3 )))
966974
@@ -1016,11 +1024,14 @@ def quartic_fit_plot(self):
10161024 popt , pcov = self .get_cvf ().quartic_data (np .array (self .get_xr ()), np .array (y_values ))
10171025 self .get_cvf ().quartic_fit (self .get_x_plot (), * popt )
10181026 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().quartic_fit (self .get_xr (), * popt ))
1019- except (RuntimeError , Exception , Warning , TypeError ):
1027+ except (RuntimeError , Exception , Warning , TypeError ) as e :
10201028 # logging.error(traceback.format_exc())
1021- r2 = 0
1022- popt = 0
1023- pcov = 0
1029+ if not __debug__ :
1030+ r2 = 0
1031+ popt = 0
1032+ pcov = 0
1033+ else :
1034+ raise e
10241035
10251036 if r2 > bestr2 :
10261037
@@ -1084,11 +1095,14 @@ def quintic_fit_plot(self):
10841095 popt , pcov = self .get_cvf ().quintic_data (np .array (self .get_xr ()), np .array (y_values ))
10851096 self .get_cvf ().quintic_fit (self .get_x_plot (), * popt )
10861097 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().quintic_fit (self .get_xr (), * popt ))
1087- except (RuntimeError , Exception , Warning , TypeError ):
1098+ except (RuntimeError , Exception , Warning , TypeError ) as e :
10881099 # logging.error(traceback.format_exc())
1089- r2 = 0
1090- popt = 0
1091- pcov = 0
1100+ if not __debug__ :
1101+ r2 = 0
1102+ popt = 0
1103+ pcov = 0
1104+ else :
1105+ raise e
10921106
10931107 if r2 > bestr2 :
10941108
@@ -1153,11 +1167,14 @@ def power_fit_plot(self):
11531167 popt , pcov = self .get_cvf ().power_data (np .array (self .get_xr ()), np .array (y_values ))
11541168 self .get_cvf ().power_fit (self .get_x_plot (), * popt )
11551169 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().power_fit (self .get_xr (), * popt ))
1156- except (RuntimeError , Exception , Warning , TypeError ):
1170+ except (RuntimeError , Exception , Warning , TypeError ) as e :
11571171 # logging.error(traceback.format_exc())
1158- r2 = 0
1159- popt = 0
1160- pcov = 0
1172+ if not __debug__ :
1173+ r2 = 0
1174+ popt = 0
1175+ pcov = 0
1176+ else :
1177+ raise e
11611178
11621179 if r2 > bestr2 :
11631180
@@ -1222,11 +1239,14 @@ def inverse_fit_plot(self):
12221239 popt , pcov = self .get_cvf ().inverse_data (np .array (self .get_xr ()), np .array (y_values ))
12231240 self .get_cvf ().inverse_fit (self .get_x_plot (), * popt )
12241241 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().inverse_fit (self .get_xr (), * popt ))
1225- except (RuntimeError , Exception , Warning , TypeError ):
1242+ except (RuntimeError , Exception , Warning , TypeError ) as e :
12261243 # logging.error(traceback.format_exc())
1227- r2 = 0
1228- popt = 0
1229- pcov = 0
1244+ if not __debug__ :
1245+ r2 = 0
1246+ popt = 0
1247+ pcov = 0
1248+ else :
1249+ raise e
12301250
12311251 if r2 > bestr2 :
12321252
@@ -1292,11 +1312,14 @@ def inverse_squared_fit_plot(self):
12921312 popt , pcov = self .get_cvf ().insq_data (np .array (self .get_xr ()), np .array (y_values ))
12931313 self .get_cvf ().insq_fit (self .get_x_plot (), * popt )
12941314 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().insq_fit (self .get_xr (), * popt ))
1295- except (RuntimeError , Exception , Warning , TypeError ):
1315+ except (RuntimeError , Exception , Warning , TypeError ) as e :
12961316 # logging.error(traceback.format_exc())
1297- r2 = 0
1298- popt = 0
1299- pcov = 0
1317+ if not __debug__ :
1318+ r2 = 0
1319+ popt = 0
1320+ pcov = 0
1321+ else :
1322+ raise e
13001323
13011324 if r2 > bestr2 :
13021325
@@ -1362,11 +1385,14 @@ def naturalexp_fit_plot(self):
13621385 popt , pcov = self .get_cvf ().nexp_data (np .array (self .get_xr ()), np .array (y_values ))
13631386 self .get_cvf ().nexp_fit (self .get_x_plot (), * popt )
13641387 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().nexp_fit (self .get_xr (), * popt ))
1365- except (RuntimeError , Exception , Warning , TypeError ):
1388+ except (RuntimeError , Exception , Warning , TypeError ) as e :
13661389 # logging.error(traceback.format_exc())
1367- r2 = 0
1368- popt = 0
1369- pcov = 0
1390+ if not __debug__ :
1391+ r2 = 0
1392+ popt = 0
1393+ pcov = 0
1394+ else :
1395+ raise e
13701396
13711397 if r2 > bestr2 :
13721398
@@ -1494,11 +1520,14 @@ def log10_fit_plot(self):
14941520 popt , pcov = self .get_cvf ().b10log_data (np .array (self .get_xr ()), np .array (y_values ))
14951521 self .get_cvf ().b10log_fit (self .get_x_plot (), * popt )
14961522 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().b10log_fit (self .get_xr (), * popt ))
1497- except (RuntimeError , Exception , Warning , TypeError ):
1523+ except (RuntimeError , Exception , Warning , TypeError ) as e :
14981524 # logging.error(traceback.format_exc())
1499- r2 = 0
1500- popt = 0
1501- pcov = 0
1525+ if not __debug__ :
1526+ r2 = 0
1527+ popt = 0
1528+ pcov = 0
1529+ else :
1530+ raise e
15021531
15031532 if r2 > bestr2 :
15041533
@@ -1565,11 +1594,14 @@ def inverseexp_fit_plot(self):
15651594 popt , pcov = self .get_cvf ().invexp_data (np .array (self .get_xr ()), np .array (y_values ))
15661595 self .get_cvf ().invexp_fit (self .get_x_plot (), * popt )
15671596 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().invexp_fit (self .get_xr (), * popt ))
1568- except (RuntimeError , Exception , Warning , TypeError ):
1597+ except (RuntimeError , Exception , Warning , TypeError ) as e :
15691598 # logging.error(traceback.format_exc())
1570- r2 = 0
1571- popt = 0
1572- pcov = 0
1599+ if not __debug__ :
1600+ r2 = 0
1601+ popt = 0
1602+ pcov = 0
1603+ else :
1604+ raise e
15731605
15741606 if r2 > bestr2 :
15751607
@@ -1635,11 +1667,14 @@ def sin_fit_plot(self):
16351667 popt , pcov = self .get_cvf ().sine_data (np .array (self .get_xr ()), np .array (y_values ))
16361668 self .get_cvf ().sine_fit (self .get_x_plot (), * popt )
16371669 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().sine_fit (self .get_xr (), * popt ))
1638- except (RuntimeError , Exception , Warning , TypeError ):
1670+ except (RuntimeError , Exception , Warning , TypeError ) as e :
16391671 # logging.error(traceback.format_exc())
1640- r2 = 0
1641- popt = 0
1642- pcov = 0
1672+ if not __debug__ :
1673+ r2 = 0
1674+ popt = 0
1675+ pcov = 0
1676+ else :
1677+ raise e
16431678
16441679 if r2 > bestr2 :
16451680
@@ -1705,11 +1740,14 @@ def cos_fit_plot(self):
17051740 popt , pcov = self .get_cvf ().cosine_data (np .array (self .get_xr ()), np .array (y_values ))
17061741 self .get_cvf ().cosine_fit (self .get_x_plot (), * popt )
17071742 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().cosine_fit (self .get_xr (), * popt ))
1708- except (RuntimeError , Exception , Warning , TypeError ):
1743+ except (RuntimeError , Exception , Warning , TypeError ) as e :
17091744 # logging.error(traceback.format_exc())
1710- r2 = 0
1711- popt = 0
1712- pcov = 0
1745+ if not __debug__ :
1746+ r2 = 0
1747+ popt = 0
1748+ pcov = 0
1749+ else :
1750+ raise e
17131751
17141752 if r2 > bestr2 :
17151753
@@ -1775,11 +1813,14 @@ def gaussian_fit_plot(self):
17751813 popt , pcov = self .get_cvf ().gauss_data (np .array (self .get_xr ()), np .array (y_values ))
17761814 self .get_cvf ().gauss_fit (self .get_x_plot (), * popt )
17771815 r2 = self .get_cvf ().r_squared (np .array (y_values ), self .get_cvf ().gauss_fit (self .get_xr (), * popt ))
1778- except (RuntimeError , Exception , Warning , TypeError ):
1816+ except (RuntimeError , Exception , Warning , TypeError ) as e :
17791817 # logging.error(traceback.format_exc())
1780- r2 = 0
1781- popt = 0
1782- pcov = 0
1818+ if not __debug__ :
1819+ r2 = 0
1820+ popt = 0
1821+ pcov = 0
1822+ else :
1823+ raise e
17831824
17841825 if r2 > bestr2 :
17851826
0 commit comments