1313import pandas as pd
1414from pydantic import AnyUrl , BaseModel , Field , RootModel
1515
16+ from ..versions import get_major_version
1617from . import (
1718 conditions ,
1819 core ,
19- format_version ,
2020 mapping ,
2121 measurements ,
2222 observables ,
@@ -290,13 +290,13 @@ def get_path(filename):
290290 "petab.CompositeProblem.from_yaml() instead."
291291 )
292292
293- if yaml_config [FORMAT_VERSION ] not in {"1" , 1 , "1.0.0" , "2.0.0" }:
293+ major_version = get_major_version (yaml_config )
294+ if major_version not in {1 , 2 }:
294295 raise ValueError (
295296 "Provided PEtab files are of unsupported version "
296- f"{ yaml_config [FORMAT_VERSION ]} . Expected "
297- f"{ format_version .__format_version__ } ."
297+ f"{ yaml_config [FORMAT_VERSION ]} ."
298298 )
299- if yaml_config [ FORMAT_VERSION ] == "2.0.0" :
299+ if major_version == 2 :
300300 warn ("Support for PEtab2.0 is experimental!" , stacklevel = 2 )
301301 warn (
302302 "Using petab.v1.Problem with PEtab2.0 is deprecated. "
@@ -321,7 +321,7 @@ def get_path(filename):
321321 if config .parameter_file
322322 else None
323323 )
324- if config . format_version . root in [ 1 , "1" , "1.0.0" ] :
324+ if major_version == 1 :
325325 if len (problem0 .sbml_files ) > 1 :
326326 # TODO https://github.com/PEtab-dev/libpetab-python/issues/6
327327 raise NotImplementedError (
@@ -1074,8 +1074,8 @@ def add_observable(
10741074 def add_parameter (
10751075 self ,
10761076 id_ : str ,
1077- estimated : bool | str | int = True ,
1078- nominal_value = None ,
1077+ estimate : bool | str | int = True ,
1078+ nominal_value : Number | None = None ,
10791079 scale : str = None ,
10801080 lb : Number = None ,
10811081 ub : Number = None ,
@@ -1089,7 +1089,7 @@ def add_parameter(
10891089
10901090 Arguments:
10911091 id_: The parameter id
1092- estimated : Whether the parameter is estimated
1092+ estimate : Whether the parameter is estimated
10931093 nominal_value: The nominal value of the parameter
10941094 scale: The parameter scale
10951095 lb: The lower bound of the parameter
@@ -1104,12 +1104,8 @@ def add_parameter(
11041104 record = {
11051105 PARAMETER_ID : [id_ ],
11061106 }
1107- if estimated is not None :
1108- record [ESTIMATE ] = [
1109- int (estimated )
1110- if isinstance (estimated , bool | int )
1111- else estimated
1112- ]
1107+ if estimate is not None :
1108+ record [ESTIMATE ] = [int (estimate )]
11131109 if nominal_value is not None :
11141110 record [NOMINAL_VALUE ] = [nominal_value ]
11151111 if scale is not None :
0 commit comments