From 127492feb6a447740bfb3913ac73f8e6b831bfc6 Mon Sep 17 00:00:00 2001 From: Maren Philipps Date: Tue, 5 May 2026 17:59:10 +0200 Subject: [PATCH 1/6] match preferred order --- petab/v2/petab1to2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/petab/v2/petab1to2.py b/petab/v2/petab1to2.py index a5101a2e..a99e5eab 100644 --- a/petab/v2/petab1to2.py +++ b/petab/v2/petab1to2.py @@ -178,15 +178,15 @@ def create_experiment_id(sim_cond_id: str, preeq_cond_id: str) -> str: experiments.append( { v2.C.EXPERIMENT_ID: exp_id, - v2.C.CONDITION_ID: preeq_cond_id, v2.C.TIME: v2.C.TIME_PREEQUILIBRATION, + v2.C.CONDITION_ID: preeq_cond_id, } ) experiments.append( { v2.C.EXPERIMENT_ID: exp_id, - v2.C.CONDITION_ID: sim_cond_id, v2.C.TIME: 0, + v2.C.CONDITION_ID: sim_cond_id, } ) if experiments: From df444bb76c857fa33a27b8ede2f62a6a470ad708 Mon Sep 17 00:00:00 2001 From: Maren Philipps Date: Tue, 5 May 2026 17:59:48 +0200 Subject: [PATCH 2/6] warn about dropping parameter table columns --- petab/v2/petab1to2.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/petab/v2/petab1to2.py b/petab/v2/petab1to2.py index a99e5eab..a9943322 100644 --- a/petab/v2/petab1to2.py +++ b/petab/v2/petab1to2.py @@ -523,6 +523,17 @@ def update_prior(row): errors="ignore", ) # some columns were dropped in PEtab v2 + if df[v1.C.INITIALIZATION_PRIOR_TYPE].notna(): + warnings.warn( + "Initialisation priors in parameter table are not supported " + "in PEtab v2.", + stacklevel=9, + ) + if not (df[v1.C.PARAMETER_SCALE] == v1.C.LIN).all(): + warnings.warn( + "Parameter scales are not supported in PEtab v2.", + stacklevel=9, + ) df.drop( columns=[ v1.C.INITIALIZATION_PRIOR_TYPE, From 5d61f7174b60af44eca384e3fa2807414faa0a0b Mon Sep 17 00:00:00 2001 From: Maren Philipps Date: Fri, 8 May 2026 16:28:39 +0200 Subject: [PATCH 3/6] check if initialization priors are present --- petab/v2/petab1to2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/petab/v2/petab1to2.py b/petab/v2/petab1to2.py index a9943322..c0a7c014 100644 --- a/petab/v2/petab1to2.py +++ b/petab/v2/petab1to2.py @@ -523,7 +523,9 @@ def update_prior(row): errors="ignore", ) # some columns were dropped in PEtab v2 - if df[v1.C.INITIALIZATION_PRIOR_TYPE].notna(): + if v1.C.INITIALIZATION_PRIOR_TYPE in df and ( + df[v1.C.INITIALIZATION_PRIOR_TYPE].notna() + ): warnings.warn( "Initialisation priors in parameter table are not supported " "in PEtab v2.", From 621216cb4b972f2306db26c8edf77c7adcd987d1 Mon Sep 17 00:00:00 2001 From: Maren Philipps Date: Fri, 8 May 2026 16:32:45 +0200 Subject: [PATCH 4/6] fix get_experiment_df --- petab/v2/experiments.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/petab/v2/experiments.py b/petab/v2/experiments.py index 9837b953..3a06ea76 100644 --- a/petab/v2/experiments.py +++ b/petab/v2/experiments.py @@ -11,16 +11,14 @@ def get_experiment_df( experiments_file: str | pd.DataFrame | Path | None, ) -> pd.DataFrame | None: """ - Read the provided observable file into a ``pandas.Dataframe``. + Read the provided experiments file into a ``pandas.Dataframe``. Arguments: experiments_file: Name of the file to read from or pandas.Dataframe. Returns: - Observable DataFrame + Experiments DataFrame """ - if experiments_file is None: - return experiments_file if isinstance(experiments_file, str | Path): experiments_file = pd.read_csv( From 03eabfb753d4ad359a9317f001b02a7cc12a1017 Mon Sep 17 00:00:00 2001 From: Maren Philipps Date: Fri, 8 May 2026 16:50:13 +0200 Subject: [PATCH 5/6] filter warning in test --- petab/v2/petab1to2.py | 2 +- tests/v2/test_conversion.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/petab/v2/petab1to2.py b/petab/v2/petab1to2.py index c0a7c014..de809acf 100644 --- a/petab/v2/petab1to2.py +++ b/petab/v2/petab1to2.py @@ -524,7 +524,7 @@ def update_prior(row): ) # some columns were dropped in PEtab v2 if v1.C.INITIALIZATION_PRIOR_TYPE in df and ( - df[v1.C.INITIALIZATION_PRIOR_TYPE].notna() + df[v1.C.INITIALIZATION_PRIOR_TYPE].notna().any() ): warnings.warn( "Initialisation priors in parameter table are not supported " diff --git a/tests/v2/test_conversion.py b/tests/v2/test_conversion.py index eb8f9d45..21949714 100644 --- a/tests/v2/test_conversion.py +++ b/tests/v2/test_conversion.py @@ -33,6 +33,13 @@ def test_petab1to2_remote(): @pytest.mark.filterwarnings( "ignore:.*Using `log-normal` instead.*:UserWarning" ) +@pytest.mark.filterwarnings( + "ignore:.*Initialisation priors in parameter table are not supported.*:" + "UserWarning" +) +@pytest.mark.filterwarnings( + "ignore:.*Parameter scales are not supported in PEtab v2.*:UserWarning" +) @parametrize_or_skip def test_benchmark_collection(problem_id): """Test that we can upgrade all benchmark collection models.""" From a59dab9d630190a8d7ca36598701a0abe806f79d Mon Sep 17 00:00:00 2001 From: Maren Philipps Date: Fri, 8 May 2026 17:04:29 +0200 Subject: [PATCH 6/6] further filterwarnings --- tests/v2/test_core.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/v2/test_core.py b/tests/v2/test_core.py index 2cbe3e46..22dbf0e1 100644 --- a/tests/v2/test_core.py +++ b/tests/v2/test_core.py @@ -47,6 +47,9 @@ def test_observable_table_round_trip(): assert observables == observables2 +@pytest.mark.filterwarnings( + "ignore:.*Parameter scales are not supported in PEtab v2.*:UserWarning" +) def test_condition_table_round_trip(): with tempfile.TemporaryDirectory() as tmp_dir: petab1to2(example_dir_fujita / "Fujita.yaml", tmp_dir) @@ -59,6 +62,9 @@ def test_condition_table_round_trip(): assert conditions == conditions2 +@pytest.mark.filterwarnings( + "ignore:.*Parameter scales are not supported in PEtab v2.*:UserWarning" +) def test_assert_valid(): problem = petab1to2(example_dir_fujita / "Fujita.yaml") problem.assert_valid()