From 529e99fc6a3e651b0ad9167c403ea73ec3f48415 Mon Sep 17 00:00:00 2001 From: PaulJonasJost Date: Mon, 28 Apr 2025 18:54:58 +0200 Subject: [PATCH 1/2] Allow empty string "" in columns to be overridden with default values in priors. --- petab/v1/priors.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/petab/v1/priors.py b/petab/v1/priors.py index 6531fa0e..b80a29ae 100644 --- a/petab/v1/priors.py +++ b/petab/v1/priors.py @@ -278,7 +278,10 @@ def from_par_dict( :return: A distribution object. """ dist_type = d.get(f"{type_}PriorType", C.PARAMETER_SCALE_UNIFORM) - if not isinstance(dist_type, str) and np.isnan(dist_type): + if ( + (not isinstance(dist_type, str) and np.isnan(dist_type)) + or not dist_type + ): dist_type = C.PARAMETER_SCALE_UNIFORM pscale = d.get(C.PARAMETER_SCALE, C.LIN) From 6b1ca4f393a4cb61065ac221a049a5ad20a7fa9b Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 22 Jul 2025 06:52:09 +0200 Subject: [PATCH 2/2] review --- petab/v1/priors.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/petab/v1/priors.py b/petab/v1/priors.py index b80a29ae..b8bf8dcb 100644 --- a/petab/v1/priors.py +++ b/petab/v1/priors.py @@ -277,12 +277,11 @@ def from_par_dict( at the bounds. **deprecated**. :return: A distribution object. """ - dist_type = d.get(f"{type_}PriorType", C.PARAMETER_SCALE_UNIFORM) - if ( - (not isinstance(dist_type, str) and np.isnan(dist_type)) - or not dist_type + dist_type = C.PARAMETER_SCALE_UNIFORM + if (_table_dist_type := d.get(f"{type_}PriorType")) and ( + isinstance(_table_dist_type, str) or not np.isnan(_table_dist_type) ): - dist_type = C.PARAMETER_SCALE_UNIFORM + dist_type = _table_dist_type pscale = d.get(C.PARAMETER_SCALE, C.LIN) params = d.get(f"{type_}PriorParameters", None)