7171 "ParameterTable" ,
7272]
7373
74+ logger = logging .getLogger (__name__ )
75+
7476
7577def _is_finite_or_neg_inf (v : float , info : ValidationInfo ) -> float :
7678 if not np .isfinite (v ) and v != - np .inf :
@@ -112,7 +114,7 @@ def _valid_petab_id(v: str) -> str:
112114 return v
113115
114116
115- def _valid_petab_id_or_none (v : str ) -> str :
117+ def _valid_petab_id_or_none (v : str ) -> str | None :
116118 """Field validator for optional PEtab IDs."""
117119 if not v :
118120 return None
@@ -252,7 +254,7 @@ def __getitem__(self, id_: str) -> T:
252254
253255 @classmethod
254256 @abstractmethod
255- def from_df (cls , df : pd .DataFrame ) -> BaseTable [T ]:
257+ def from_df (cls , df : pd .DataFrame , ** kwargs ) -> BaseTable [T ]:
256258 """Create a table from a DataFrame."""
257259 pass
258260
@@ -1143,7 +1145,11 @@ def __str__(self):
11431145 f"{ observables } , { measurements } , { parameters } "
11441146 )
11451147
1146- def __getitem__ (self , key ):
1148+ def __getitem__ (
1149+ self , key
1150+ ) -> (
1151+ Condition | Experiment | Observable | Measurement | Parameter | Mapping
1152+ ):
11471153 """Get PEtab entity by ID.
11481154
11491155 This allows accessing PEtab entities such as conditions, experiments,
@@ -1202,7 +1208,7 @@ def from_yaml(
12021208 from .petab1to2 import petab1to2
12031209
12041210 if format_version [0 ] == 1 and yaml_file :
1205- logging .debug (
1211+ logger .debug (
12061212 "Auto-upgrading problem from PEtab 1.0 to PEtab 2.0"
12071213 )
12081214 with TemporaryDirectory () as tmpdirname :
@@ -2320,7 +2326,9 @@ def get_output_parameters(
23202326 # filter out symbols that are defined in the model or mapped to
23212327 # such symbols
23222328 for candidate in sorted (candidates ):
2323- if self .model .symbol_allowed_in_observable_formula (candidate ):
2329+ if self .model and self .model .symbol_allowed_in_observable_formula (
2330+ candidate
2331+ ):
23242332 continue
23252333
23262334 # does it map to a model entity?
@@ -2329,8 +2337,11 @@ def get_output_parameters(
23292337 mapping .petab_id == candidate
23302338 and mapping .model_id is not None
23312339 ):
2332- if self .model .symbol_allowed_in_observable_formula (
2333- mapping .model_id
2340+ if (
2341+ self .model
2342+ and self .model .symbol_allowed_in_observable_formula (
2343+ mapping .model_id
2344+ )
23342345 ):
23352346 break
23362347 else :
0 commit comments