From 686e4a3c95099ac3fb5fc7dffe52c7c1e71aa09b Mon Sep 17 00:00:00 2001 From: Vincent Wieland <90847066+vwiela@users.noreply.github.com> Date: Mon, 9 Oct 2023 09:51:19 +0200 Subject: [PATCH] Update strings ensemble.py Changed strings to constants stored in C.py. --- pypesto/ensemble/ensemble.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pypesto/ensemble/ensemble.py b/pypesto/ensemble/ensemble.py index 6818267ab..0f2fbd16a 100644 --- a/pypesto/ensemble/ensemble.py +++ b/pypesto/ensemble/ensemble.py @@ -45,6 +45,8 @@ X_VECTOR, EnsembleType, ModeType, + SIMULTANEOUS, + POINTWISE ) from ..engine import ( Engine, @@ -1207,7 +1209,7 @@ def get_percentile_label(percentile: Union[float, int, str]) -> str: def calculate_cutoff( result: Result, percentile: float = 0.95, - cr_option: str = 'simultaneous', + cr_option: str = SIMULTANEOUS, ): """ Calculate the cutoff of the ensemble. @@ -1238,17 +1240,17 @@ def calculate_cutoff( f"percentile={percentile} is too large. Choose " f"0<=percentile<=100." ) - if cr_option not in ["simultaneous", "pointwise"]: + if cr_option not in [SIMULTANEOUS, POINTWISE]: raise ValueError( "Confidence region must be either simultaneous or pointwise." ) # optimal point as base: fval_opt = result.optimize_result[0].fval - if cr_option == 'simultaneous': + if cr_option == SIMULTANEOUS: # degrees of freedom is equal to the number of parameters df = result.problem.dim - elif cr_option == 'pointwise': + elif cr_option == POINTWISE: # degrees of freedom is equal to 1 df = 1