Skip to content

Commit

Permalink
fix bug: variable not defined when not using mc_name in seeding
Browse files Browse the repository at this point in the history
  • Loading branch information
jcblemai committed Feb 10, 2024
1 parent 7195e5d commit 322a74f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flepimop/gempyor_pkg/src/gempyor/seeding_ic.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def draw_ic(self, sim_id: int, setup) -> np.ndarray:
else:
raise ValueError(
f"Initial Conditions: Could not set compartment {comp_name} (id: {comp_idx}) in subpop {pl} (id: {pl_idx}). The data from the init file is {states_pl}. \n \
Use 'allow_missing_compartments' to default to 0 for compartments without initial conditions"
Use 'allow_missing_compartments' to default to 0 for compartments without initial conditions"
)
if "rest" in str(ic_df_compartment_val).strip().lower():
rests.append([comp_idx, pl_idx])
Expand Down Expand Up @@ -469,9 +469,9 @@ def draw(self, sim_id: int, setup) -> np.ndarray:
ic_df_compartment_val = states_pl[states_pl["mc_name"] == comp_name]["amount"]
else:
filters = setup.compartments.compartments.iloc[comp_idx].drop("name")
ic_df_compartment = states_pl.copy()
ic_df_compartment_val = states_pl.copy()
for mc_name, mc_value in filters.items():
ic_df_compartment = ic_df_compartment[ic_df_compartment["mc_" + mc_name] == mc_value][
ic_df_compartment_val = ic_df_compartment_val[ic_df_compartment_val["mc_" + mc_name] == mc_value][
"amount"
]
if len(ic_df_compartment_val) > 1:
Expand Down

0 comments on commit 322a74f

Please sign in to comment.