Skip to content

Commit

Permalink
Implementing Carl's suggestions
Browse files Browse the repository at this point in the history
Awaiting regex error kickback to adjust the test files.
  • Loading branch information
emprzy committed Nov 22, 2024
1 parent 8fe918a commit f7e53a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
12 changes: 6 additions & 6 deletions flepimop/gempyor_pkg/src/gempyor/model_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, config: confuse.ConfigView):
self.tf = config["end_date"].as_date()
if self.tf <= self.ti:
raise ValueError(
f"Time to finish ('{self.tf}') is less than or equal to time to start ('{self.ti}')."
f"Final time ('{self.tf}') is less than or equal to initial time('{self.ti}')."
)
self.n_days = (self.tf - self.ti).days + 1
self.dates = pd.date_range(start=self.ti, end=self.tf, freq="D")
Expand Down Expand Up @@ -76,7 +76,7 @@ def __init__(
# Auto-detect old config
if config["interventions"].exists():
raise ValueError(
"This config has an intervention section, which is only compatible with a previous version (1.1) of flepiMoP."
"This config has an intervention section, which is only compatible with a previous version (v1.1) of flepiMoP. "
)

# 1. Create a setup name that contains every scenario.
Expand Down Expand Up @@ -172,14 +172,14 @@ def __init__(
) # TODO create a Stacked from all
elif self.seir_modifiers_scenario is not None:
raise ValueError(
"A seir modifiers scenario was provided to `ModelInfo` but there is no `seir_modifiers` section in the config."
"A `seir_modifiers_scenario` argument was provided to `ModelInfo` but there is no `seir_modifiers` section in the config."
)
else:
logging.info("Running `ModelInfo` with seir but without SEIR Modifiers")

elif self.seir_modifiers_scenario is not None:
raise ValueError(
"A seir modifiers scenario was provided to `ModelInfo` but there is no `seir_modifiers` section in the config."
"A `seir_modifiers_scenario` argument was provided to `ModelInfo` but there is no `seir` section in the config."
)
else:
logging.critical("Running ModelInfo without SEIR")
Expand Down Expand Up @@ -208,7 +208,7 @@ def __init__(
elif self.outcome_modifiers_scenario is not None:
if config["outcome_modifiers"].exists():
raise ValueError(
"An outcome modifiers scenario was provided to `ModelInfo` but there is no `outcome_modifiers` section in the config."
"A `outcome_modifiers_scenario` argument was provided to `ModelInfo` but there is no `outcome_modifiers` section in the config."
)
else:
self.outcome_modifiers_scenario = None
Expand All @@ -218,7 +218,7 @@ def __init__(
)
elif self.outcome_modifiers_scenario is not None:
raise ValueError(
"An outcome modifiers scenario was provided to `ModelInfo` but there is no `outcome_modifiers` section in the config."
"A `outcome_modifiers_scenario` argument was provided to `ModelInfo` but there is no `outcomes` section in the config."
)
else:
logging.info("Running `ModelInfo` without outcomes.")
Expand Down
2 changes: 0 additions & 2 deletions flepimop/gempyor_pkg/src/gempyor/seeding.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ def get_from_config(self, sim_id: int, modinf) -> nb.typed.Dict:
)
elif method == "FolderDraw" or method == "FromFile":
amounts = seeding["amount"]
else:
raise ValueError(f"Unknown seeding method given, '{method}'.")

return _DataFrame2NumbaDict(df=seeding, amounts=amounts, modinf=modinf)

Expand Down
4 changes: 2 additions & 2 deletions flepimop/gempyor_pkg/src/gempyor/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ def llik(self, model_data: xr.DataArray, gt_data: xr.DataArray) -> xr.DataArray:
}
if self.dist not in dist_map:
raise ValueError(
f"Invalid distribution specified [received: '{self.dist}']. "
f"Valid distributions: '{dist_map}'."
f"Invalid distribution specified: '{self.dist}'. "
f"Valid distributions: '{dist_map.keys()}'."
)
if self.dist in ["pois", "nbinom"]:
model_data = model_data.astype(int)
Expand Down

0 comments on commit f7e53a7

Please sign in to comment.