From 98c719dccc716cad3dee22f17281b5b9206ae1b5 Mon Sep 17 00:00:00 2001 From: Emily Przykucki Date: Fri, 20 Dec 2024 13:07:42 -0500 Subject: [PATCH] Renaming function and adjusting unit test --- flepimop/gempyor_pkg/src/gempyor/seir.py | 4 ++-- flepimop/gempyor_pkg/tests/seir/test_seir.py | 21 ++++++++------------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/flepimop/gempyor_pkg/src/gempyor/seir.py b/flepimop/gempyor_pkg/src/gempyor/seir.py index 8ee4768be..8a5fb144c 100644 --- a/flepimop/gempyor_pkg/src/gempyor/seir.py +++ b/flepimop/gempyor_pkg/src/gempyor/seir.py @@ -16,7 +16,7 @@ logger = logging.getLogger(__name__) # TO DO: Write documentation for this function -def neg_params( +def check_parameter_positivity( parsed_parameters: np.ndarray, parameter_names: list[str], dates: pd.DatetimeIndex, @@ -160,7 +160,7 @@ def build_step_source_arg( "stochastic_p": modinf.stoch_traj_flag, } - neg_params( + check_parameter_positivity( fnct_args["parameters"], modinf.parameters.pnames, modinf.dates, diff --git a/flepimop/gempyor_pkg/tests/seir/test_seir.py b/flepimop/gempyor_pkg/tests/seir/test_seir.py index 4c3030e7a..029bf0ee5 100644 --- a/flepimop/gempyor_pkg/tests/seir/test_seir.py +++ b/flepimop/gempyor_pkg/tests/seir/test_seir.py @@ -17,19 +17,14 @@ DATA_DIR = os.path.dirname(__file__) + "/data" os.chdir(os.path.dirname(__file__)) -def test_neg_params(): - - config.set_file(f"{DATA_DIR}/config.yml") - modinf = model_info.ModelInfo( - config=config, - nslots=1, - seir_modifiers_scenario="None", - write_csv=False, - ) - - parameter_names = modinf.parameters.pnames - dates = modinf.dates - subpop_names = modinf.subpop_pop +def test_check_parameter_positivity(): + + parameter_names = ['alpha*1*1*1', 'sigma_OMICRON*1*1*1', '3*gamma*1*1*1', 'epsilon+omegaph4*1*1*1', + '1*zeta*1*1', 'r0*gamma*theta10*1*chi_OMICRON*1', 'r0*gamma*theta9*1*chi_OMICRON*1', + 'eta_X0toX3_highIE*1*1*nuage0to17', 'eta_X0toX3_highIE*1*1*nuage18to64LR', + 'eta_X0toX3_highIE*1*1*nuage18to64HR', 'eta_X0toX3_highIE*1*1*nuage65to100',] + dates = pd.date_range('2023-03-19', '2025-04-31', freq="D") + subpop_names = ['56000', '50000', '11000', '02000', '38000', '46000', '10000', '30000', '44000', '23000'] # Test case 1: no negative params test_array1 = np.zeros((len(parameter_names)-1, len(dates)-1, len(subpop_names)-1))