Skip to content

Commit

Permalink
Fix Prior.from_par_dict for missing priorParameters columns (PEtab-de…
Browse files Browse the repository at this point in the history
…v#341)

Previously, missing `*PriorParameters` would have resulted in a KeyError.
  • Loading branch information
dweindl authored Dec 12, 2024
1 parent 540710d commit 6fffafb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions petab/v1/priors.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,8 @@ def from_par_dict(
dist_type = C.PARAMETER_SCALE_UNIFORM

pscale = d.get(C.PARAMETER_SCALE, C.LIN)
if (
pd.isna(d[f"{type_}PriorParameters"])
and dist_type == C.PARAMETER_SCALE_UNIFORM
):
params = d.get(f"{type_}PriorParameters", None)
if pd.isna(params) and dist_type == C.PARAMETER_SCALE_UNIFORM:
params = (
scale(d[C.LOWER_BOUND], pscale),
scale(d[C.UPPER_BOUND], pscale),
Expand All @@ -236,7 +234,7 @@ def from_par_dict(
params = tuple(
map(
float,
d[f"{type_}PriorParameters"].split(C.PARAMETER_SEPARATOR),
params.split(C.PARAMETER_SEPARATOR),
)
)
return Prior(
Expand Down

0 comments on commit 6fffafb

Please sign in to comment.