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( diff --git a/petab/v2/petab1to2.py b/petab/v2/petab1to2.py index a5101a2e..de809acf 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: @@ -523,6 +523,19 @@ def update_prior(row): errors="ignore", ) # some columns were dropped in PEtab v2 + if v1.C.INITIALIZATION_PRIOR_TYPE in df and ( + df[v1.C.INITIALIZATION_PRIOR_TYPE].notna().any() + ): + 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, 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.""" 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()