From 7710987fc49420066fd1eba23fbc256718209bcc Mon Sep 17 00:00:00 2001 From: fang19911030 Date: Thu, 28 Mar 2024 14:47:18 -0400 Subject: [PATCH] sunset the usage of seeding_ic --- flepimop/gempyor_pkg/src/gempyor/dev/dev_seir.py | 4 ++-- flepimop/gempyor_pkg/src/gempyor/model_info.py | 6 +++--- flepimop/gempyor_pkg/tests/seir/test_ic.py | 8 ++++---- flepimop/gempyor_pkg/tests/seir/test_seeding.py | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/flepimop/gempyor_pkg/src/gempyor/dev/dev_seir.py b/flepimop/gempyor_pkg/src/gempyor/dev/dev_seir.py index ebb29e1ed..500a2467c 100644 --- a/flepimop/gempyor_pkg/src/gempyor/dev/dev_seir.py +++ b/flepimop/gempyor_pkg/src/gempyor/dev/dev_seir.py @@ -35,8 +35,8 @@ out_prefix=prefix, ) -seeding_data = modinf.seedingAndIC.draw_seeding(sim_id=100, setup=modinf) -initial_conditions = modinf.seedingAndIC.draw_ic(sim_id=100, setup=modinf) +seeding_data = modinf.seeding.get_from_config(sim_id=100, setup=modinf) +initial_conditions = modinf.initial_conditions.get_from_config(sim_id=100, setup=modinf) mobility_subpop_indices = modinf.mobility.indices mobility_data_indices = modinf.mobility.indptr diff --git a/flepimop/gempyor_pkg/src/gempyor/model_info.py b/flepimop/gempyor_pkg/src/gempyor/model_info.py index 88141bbc1..6e4b019e5 100644 --- a/flepimop/gempyor_pkg/src/gempyor/model_info.py +++ b/flepimop/gempyor_pkg/src/gempyor/model_info.py @@ -1,6 +1,6 @@ import pandas as pd import datetime, os, logging, pathlib -from . import seeding_ic, subpopulation_structure, parameters, compartments, file_paths +from . import seeding, subpopulation_structure, parameters, compartments, file_paths, initial_conditions from .utils import read_df, write_df logger = logging.getLogger(__name__) @@ -115,8 +115,8 @@ def __init__( tf=self.tf, subpop_names=self.subpop_struct.subpop_names, ) - self.seeding = seeding_ic.SeedingFactory(config = self.seeding_config) - self.initial_conditions = seeding_ic.InitialConditionsFactory(config = self.initial_conditions_config) + self.seeding = seeding.SeedingFactory(config = self.seeding_config) + self.initial_conditions = initial_conditions.InitialConditionsFactory(config = self.initial_conditions_config) # really ugly references to the config globally here. if config["compartments"].exists() and self.seir_config is not None: self.compartments = compartments.Compartments( diff --git a/flepimop/gempyor_pkg/tests/seir/test_ic.py b/flepimop/gempyor_pkg/tests/seir/test_ic.py index 214ee5712..16f4abb30 100644 --- a/flepimop/gempyor_pkg/tests/seir/test_ic.py +++ b/flepimop/gempyor_pkg/tests/seir/test_ic.py @@ -1,6 +1,6 @@ import os import pytest -from gempyor import seeding_ic, model_info +from gempyor import seeding, model_info, initial_conditions from gempyor.utils import config DATA_DIR = os.path.dirname(__file__) + "/data" @@ -21,7 +21,7 @@ def test_IC_success(self): outcome_modifiers_scenario=None, write_csv=False, ) - sic = seeding_ic.InitialConditionsFactory(config=s.initial_conditions_config) + sic = initial_conditions.InitialConditionsFactory(config=s.initial_conditions_config) assert sic.initial_conditions_config == s.initial_conditions_config def test_IC_allow_missing_node_compartments_success(self): @@ -40,7 +40,7 @@ def test_IC_allow_missing_node_compartments_success(self): s.initial_conditions_config["allow_missing_nodes"] = True s.initial_conditions_config["allow_missing_compartments"] = True - sic = seeding_ic.InitialConditionsFactory(config=s.initial_conditions_config) + sic = initial_conditions.InitialConditionsFactory(config=s.initial_conditions_config) assert sic.initial_conditions_config == s.initial_conditions_config initial_conditions = sic.get_from_config(sim_id=100, setup=s) @@ -61,6 +61,6 @@ def test_IC_IC_notImplemented_fail(self): write_csv=False, ) s.initial_conditions_config["method"] = "unknown" - sic = seeding_ic.InitialConditionsFactory(config=s.initial_conditions_config) + sic = initial_conditions.InitialConditionsFactory(config=s.initial_conditions_config) sic.get_from_config(sim_id=100, setup=s) diff --git a/flepimop/gempyor_pkg/tests/seir/test_seeding.py b/flepimop/gempyor_pkg/tests/seir/test_seeding.py index 34552ecce..b7a157012 100644 --- a/flepimop/gempyor_pkg/tests/seir/test_seeding.py +++ b/flepimop/gempyor_pkg/tests/seir/test_seeding.py @@ -1,5 +1,5 @@ import os -from gempyor import seeding_ic, model_info +from gempyor import seeding, model_info from gempyor.utils import config DATA_DIR = os.path.dirname(__file__) + "/data" @@ -20,7 +20,7 @@ def test_Seeding_success(self): outcome_modifiers_scenario=None, write_csv=False, ) - sic = seeding_ic.SeedingFactory(config=s.seeding_config) + sic = seeding.SeedingFactory(config=s.seeding_config) assert sic.seeding_config == s.seeding_config def test_Seeding_draw_success(self): @@ -36,7 +36,7 @@ def test_Seeding_draw_success(self): outcome_modifiers_scenario=None, write_csv=False, ) - sic = seeding_ic.SeedingFactory(config=s.seeding_config) + sic = seeding.SeedingFactory(config=s.seeding_config) s.seeding_config["method"] = "NoSeeding" seeding = sic.get_from_config(sim_id=100, setup=s)