Commit 055d4960 authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[CHANGE POINT TEST] improve management of crash mode, to avoid crashing all...

[CHANGE POINT TEST] improve management of crash mode, to avoid crashing all the run (issues with test with scale parameter)
parent 7a35e1f1
No related merge requests found
Showing with 12 additions and 5 deletions
+12 -5
...@@ -207,9 +207,9 @@ def full_altitude_year_hypercube__without_trend_extended(): ...@@ -207,9 +207,9 @@ def full_altitude_year_hypercube__without_trend_extended():
only_first_one = False only_first_one = False
nb_data_reduced_for_speed = False nb_data_reduced_for_speed = False
altitudes = ALL_ALTITUDES[3:-6] altitudes = ALL_ALTITUDES[3:-6]
for study_class in SCM_STUDIES[1:]: for study_class in SCM_STUDIES[:1]:
for trend_test_class in [GevLocationChangePointTest, GevScaleChangePointTest, for trend_test_class in [GevLocationChangePointTest, GevScaleChangePointTest,
GevShapeChangePointTest][:1]: GevShapeChangePointTest][2:]:
years = [None][:] years = [None][:]
for last_starting_year in years: for last_starting_year in years:
for days in [1, 3][1:]: for days in [1, 3][1:]:
......
...@@ -62,17 +62,23 @@ class AbstractGevChangePointTest(AbstractUnivariateTest): ...@@ -62,17 +62,23 @@ class AbstractGevChangePointTest(AbstractUnivariateTest):
@property @property
def non_stationary_nllh(self): def non_stationary_nllh(self):
if self.crashed: if self.crashed:
return -np.inf return np.nan
else: else:
return self.non_stationary_estimator.result_from_fit.nllh return self.non_stationary_estimator.result_from_fit.nllh
@property @property
def stationary_deviance(self): def stationary_deviance(self):
return self.stationary_estimator.result_from_fit.deviance if self.crashed:
return np.nan
else:
return self.stationary_estimator.result_from_fit.deviance
@property @property
def non_stationary_deviance(self): def non_stationary_deviance(self):
return self.non_stationary_estimator.result_from_fit.deviance if self.crashed:
return np.nan
else:
return self.non_stationary_estimator.result_from_fit.deviance
@property @property
def is_significant(self) -> bool: def is_significant(self) -> bool:
......
...@@ -87,6 +87,7 @@ def safe_run_r_estimator(function, data=None, use_start=False, threshold_max_abs ...@@ -87,6 +87,7 @@ def safe_run_r_estimator(function, data=None, use_start=False, threshold_max_abs
run_successful = False run_successful = False
res = None res = None
f = io.StringIO() f = io.StringIO()
# Warning print will not work in this part
with redirect_stdout(f): with redirect_stdout(f):
while not run_successful: while not run_successful:
current_parameter = parameters.copy() current_parameter = parameters.copy()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment