Skip to content

Commit

Permalink
Renaming function and adjusting unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
emprzy committed Dec 20, 2024
1 parent f60b62d commit 98c719d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions flepimop/gempyor_pkg/src/gempyor/seir.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
21 changes: 8 additions & 13 deletions flepimop/gempyor_pkg/tests/seir/test_seir.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 98c719d

Please sign in to comment.