@@ -279,6 +279,7 @@ class ObservableTable(BaseModel):
279279
280280 #: List of observables.
281281 observables : list [Observable ]
282+ relpath : Path or None = Field (exclude = True )
282283
283284 def __getitem__ (self , observable_id : str ) -> Observable :
284285 """Get an observable by ID."""
@@ -433,6 +434,7 @@ class ConditionTable(BaseModel):
433434
434435 #: List of conditions.
435436 conditions : list [Condition ] = []
437+ relpath : Path or None = Field (exclude = True )
436438
437439 def __getitem__ (self , condition_id : str ) -> Condition :
438440 """Get a condition by ID."""
@@ -607,6 +609,7 @@ class ExperimentTable(BaseModel):
607609
608610 #: List of experiments.
609611 experiments : list [Experiment ]
612+ relpath : Path or None = Field (exclude = True )
610613
611614 @classmethod
612615 def from_df (cls , df : pd .DataFrame ) -> ExperimentTable :
@@ -767,6 +770,7 @@ class MeasurementTable(BaseModel):
767770
768771 #: List of measurements.
769772 measurements : list [Measurement ]
773+ relpath : Path or None = Field (exclude = True )
770774
771775 @classmethod
772776 def from_df (
@@ -851,6 +855,7 @@ class MappingTable(BaseModel):
851855
852856 #: List of mappings.
853857 mappings : list [Mapping ]
858+ relpath : Path or None = Field (exclude = True )
854859
855860 @classmethod
856861 def from_df (cls , df : pd .DataFrame ) -> MappingTable :
@@ -1081,6 +1086,7 @@ class ParameterTable(BaseModel):
10811086
10821087 #: List of parameters.
10831088 parameters : list [Parameter ]
1089+ relpath : Path or None = Field (exclude = True )
10841090
10851091 @classmethod
10861092 def from_df (cls , df : pd .DataFrame ) -> ParameterTable :
@@ -1138,9 +1144,6 @@ def n_estimated(self) -> int:
11381144 return sum (p .estimate for p in self .parameters )
11391145
11401146
1141- """PEtab v2 problems."""
1142-
1143-
11441147class Problem :
11451148 """
11461149 PEtab parameter estimation problem
@@ -1267,11 +1270,6 @@ def from_yaml(
12671270
12681271 validate_yaml_syntax (yaml_config )
12691272
1270- def get_path (filename ):
1271- if base_path is None :
1272- return filename
1273- return f"{ base_path } /{ filename } "
1274-
12751273 if (format_version := parse_version (yaml_config [C .FORMAT_VERSION ]))[
12761274 0
12771275 ] != 2 :
@@ -1311,27 +1309,28 @@ def get_path(filename):
13111309 ** yaml_config , base_path = base_path , filepath = yaml_file
13121310 )
13131311 parameter_tables = [
1314- ParameterTable .from_tsv (get_path ( f ) )
1312+ ParameterTable .from_tsv (f , base_path = base_path )
13151313 for f in config .parameter_files
13161314 ]
13171315
13181316 if len (config .model_files or []) > 1 :
1319- # TODO https://github.com/PEtab-dev/libpetab-python/issues/6
1317+ # TODO https://github.com/PEtab-dev/libpetab-python/issues/392
13201318 raise NotImplementedError (
13211319 "Support for multiple models is not yet implemented."
13221320 )
13231321 model = None
13241322 if config .model_files :
13251323 model_id , model_info = next (iter (config .model_files .items ()))
13261324 model = model_factory (
1325+ # TODO: store path
13271326 get_path (model_info .location ),
13281327 model_info .language ,
13291328 model_id = model_id ,
13301329 )
13311330
13321331 measurement_tables = (
13331332 [
1334- MeasurementTable .from_tsv (get_path ( f ) )
1333+ MeasurementTable .from_tsv (f , base_path )
13351334 for f in config .measurement_files
13361335 ]
13371336 if config .measurement_files
@@ -1340,7 +1339,7 @@ def get_path(filename):
13401339
13411340 condition_tables = (
13421341 [
1343- ConditionTable .from_tsv (get_path ( f ) )
1342+ ConditionTable .from_tsv (f , base_path )
13441343 for f in config .condition_files
13451344 ]
13461345 if config .condition_files
@@ -1349,7 +1348,7 @@ def get_path(filename):
13491348
13501349 experiment_tables = (
13511350 [
1352- ExperimentTable .from_tsv (get_path ( f ) )
1351+ ExperimentTable .from_tsv (f , base_path )
13531352 for f in config .experiment_files
13541353 ]
13551354 if config .experiment_files
@@ -1358,15 +1357,15 @@ def get_path(filename):
13581357
13591358 observable_tables = (
13601359 [
1361- ObservableTable .from_tsv (get_path ( f ) )
1360+ ObservableTable .from_tsv (f , base_path )
13621361 for f in config .observable_files
13631362 ]
13641363 if config .observable_files
13651364 else None
13661365 )
13671366
13681367 mapping_tables = (
1369- [MappingTable .from_tsv (get_path ( f ) ) for f in config .mapping_files ]
1368+ [MappingTable .from_tsv (f , base_path ) for f in config .mapping_files ]
13701369 if config .mapping_files
13711370 else None
13721371 )
0 commit comments