Skip to content

Commit

Permalink
Problem.add_parameter: Rename kwarg estimated->estimate (#348)
Browse files Browse the repository at this point in the history
Change the `estimated` argument in Problem.add_parameter to `estimate`
to match the column name.

---------

Co-authored-by: Dilan Pathirana <[email protected]>
  • Loading branch information
dweindl and dilpath authored Dec 19, 2024
1 parent e7edebf commit 9f11e73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
14 changes: 5 additions & 9 deletions petab/v1/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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:
Expand Down
14 changes: 5 additions & 9 deletions petab/v2/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 9f11e73

Please sign in to comment.