Skip to content

Commit a17aa62

Browse files
committed
Fix Prior.from_par_dict for missing priorParameters columns (#341)
Previously, missing `*PriorParameters` would have resulted in a KeyError.
1 parent 2484a7f commit a17aa62

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

petab/v1/priors.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,8 @@ def from_par_dict(
281281
dist_type = C.PARAMETER_SCALE_UNIFORM
282282

283283
pscale = d.get(C.PARAMETER_SCALE, C.LIN)
284-
if (
285-
pd.isna(d[f"{type_}PriorParameters"])
286-
and dist_type == C.PARAMETER_SCALE_UNIFORM
287-
):
284+
params = d.get(f"{type_}PriorParameters", None)
285+
if pd.isna(params) and dist_type == C.PARAMETER_SCALE_UNIFORM:
288286
params = (
289287
scale(d[C.LOWER_BOUND], pscale),
290288
scale(d[C.UPPER_BOUND], pscale),
@@ -293,7 +291,7 @@ def from_par_dict(
293291
params = tuple(
294292
map(
295293
float,
296-
d[f"{type_}PriorParameters"].split(C.PARAMETER_SEPARATOR),
294+
params.split(C.PARAMETER_SEPARATOR),
297295
)
298296
)
299297
return Prior(

0 commit comments

Comments
 (0)