Skip to content

Commit 6fffafb

Browse files
authored
Fix Prior.from_par_dict for missing priorParameters columns (#341)
Previously, missing `*PriorParameters` would have resulted in a KeyError.
1 parent 540710d commit 6fffafb

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
@@ -224,10 +224,8 @@ def from_par_dict(
224224
dist_type = C.PARAMETER_SCALE_UNIFORM
225225

226226
pscale = d.get(C.PARAMETER_SCALE, C.LIN)
227-
if (
228-
pd.isna(d[f"{type_}PriorParameters"])
229-
and dist_type == C.PARAMETER_SCALE_UNIFORM
230-
):
227+
params = d.get(f"{type_}PriorParameters", None)
228+
if pd.isna(params) and dist_type == C.PARAMETER_SCALE_UNIFORM:
231229
params = (
232230
scale(d[C.LOWER_BOUND], pscale),
233231
scale(d[C.UPPER_BOUND], pscale),
@@ -236,7 +234,7 @@ def from_par_dict(
236234
params = tuple(
237235
map(
238236
float,
239-
d[f"{type_}PriorParameters"].split(C.PARAMETER_SEPARATOR),
237+
params.split(C.PARAMETER_SEPARATOR),
240238
)
241239
)
242240
return Prior(

0 commit comments

Comments
 (0)