From 9f11e7319b44b991fb0dc3315f1f3441ae9ac5fd Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 19 Dec 2024 08:58:31 +0100 Subject: [PATCH] Problem.add_parameter: Rename kwarg estimated->estimate (#348) Change the `estimated` argument in Problem.add_parameter to `estimate` to match the column name. --------- Co-authored-by: Dilan Pathirana <59329744+dilpath@users.noreply.github.com> --- petab/v1/problem.py | 14 +++++--------- petab/v2/problem.py | 14 +++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/petab/v1/problem.py b/petab/v1/problem.py index 6be96c68..5c0dcf61 100644 --- a/petab/v1/problem.py +++ b/petab/v1/problem.py @@ -1074,8 +1074,8 @@ def add_observable( def add_parameter( self, id_: str, - estimated: bool | str | int = True, - nominal_value=None, + estimate: bool | str | int = True, + nominal_value: Number | None = None, scale: str = None, lb: Number = None, ub: Number = None, @@ -1089,7 +1089,7 @@ def add_parameter( Arguments: id_: The parameter id - estimated: Whether the parameter is estimated + estimate: Whether the parameter is estimated nominal_value: The nominal value of the parameter scale: The parameter scale lb: The lower bound of the parameter @@ -1104,12 +1104,8 @@ def add_parameter( record = { PARAMETER_ID: [id_], } - if estimated is not None: - record[ESTIMATE] = [ - int(estimated) - if isinstance(estimated, bool | int) - else estimated - ] + if estimate is not None: + record[ESTIMATE] = [int(estimate)] if nominal_value is not None: record[NOMINAL_VALUE] = [nominal_value] if scale is not None: diff --git a/petab/v2/problem.py b/petab/v2/problem.py index f8dad754..79bb6196 100644 --- a/petab/v2/problem.py +++ b/petab/v2/problem.py @@ -829,8 +829,8 @@ def add_observable( def add_parameter( self, id_: str, - estimated: bool | str | int = True, - nominal_value=None, + estimate: bool | str | int = True, + nominal_value: Number | None = None, scale: str = None, lb: Number = None, ub: Number = None, @@ -844,7 +844,7 @@ def add_parameter( Arguments: id_: The parameter id - estimated: Whether the parameter is estimated + estimate: Whether the parameter is estimated nominal_value: The nominal value of the parameter scale: The parameter scale lb: The lower bound of the parameter @@ -859,12 +859,8 @@ def add_parameter( record = { PARAMETER_ID: [id_], } - if estimated is not None: - record[ESTIMATE] = [ - int(estimated) - if isinstance(estimated, bool | int) - else estimated - ] + if estimate is not None: + record[ESTIMATE] = [int(estimate)] if nominal_value is not None: record[NOMINAL_VALUE] = [nominal_value] if scale is not None: