-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathv1_v2.py
More file actions
executable file
·35 lines (27 loc) · 1.09 KB
/
v1_v2.py
File metadata and controls
executable file
·35 lines (27 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
"""Convert benchmark problems from PEtab v1 to v2 format."""
import logging
import benchmark_models_petab
from petab.v2.petab1to2 import petab1to2
from pathlib import Path
def main():
logging.basicConfig(level=logging.INFO)
v2_root = Path(__file__).resolve().parent / "v2"
for problem_id in benchmark_models_petab.MODELS:
if problem_id == "Froehlich_CellSystems2018":
# naive conversion generates huge condition table
logging.warning("Skipping Froehlich_CellSystems2018 due to performance issues.")
continue
convert(problem_id, output_dir=v2_root / problem_id)
def convert(problem_id: str, output_dir: Path):
"""Convert a PEtab v1 problem to v2 format."""
logging.info(f"Converting {problem_id}...")
yaml_path = benchmark_models_petab.get_problem_yaml_path(problem_id)
try:
petab1to2(yaml_path, output_dir)
except NotImplementedError as e:
logging.warning(f"Skipping {problem_id}: {e}")
return
logging.info(f"Converted {problem_id}.")
if __name__ == "__main__":
main()