From 4e1d846aea61659aa8bf0f3f33384fdf9c165e82 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 12 Mar 2026 08:55:29 +0100 Subject: [PATCH 1/3] petab-import: fix fixed parameter selection with pandas>=3 Fixes a pandas>=3.0 compatibility issue in the PEtab importer which resulted in incorrect selection of fixed parameters. --- CHANGELOG.md | 3 ++- python/sdist/amici/importers/petab/v1/_import_helpers.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cae5ff7e4c..f71549bc94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ See also our [versioning policy](https://amici.readthedocs.io/en/latest/versioni * Fixed an issue that resulted in failure to import the `PetabImporter` if the jax-dependencies weren't installed. - +* Fixed a pandas>=3.0 compatibility issue in the PEtab importer which resulted + in incorrect selection of fixed parameters. ### v1.0.0 diff --git a/python/sdist/amici/importers/petab/v1/_import_helpers.py b/python/sdist/amici/importers/petab/v1/_import_helpers.py index 0d5ba88aa1..995de9500a 100644 --- a/python/sdist/amici/importers/petab/v1/_import_helpers.py +++ b/python/sdist/amici/importers/petab/v1/_import_helpers.py @@ -225,7 +225,7 @@ def get_fixed_parameters( # TODO: could check if the final overriding parameter is estimated # or not, but for now, we skip the parameter if there is any kind # of overriding - if condition_df[p].dtype != "O" + if not pd.api.types.is_string_dtype(condition_df[p].dtype) # p is a parameter and not petab_problem.model.is_state_variable(p) ) From 75c7af50f21aac9a653840aebfdf0234b0571780 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 12 Mar 2026 09:34:38 +0100 Subject: [PATCH 2/3] .. --- .../sdist/amici/sim/sundials/petab/v1/_conditions.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python/sdist/amici/sim/sundials/petab/v1/_conditions.py b/python/sdist/amici/sim/sundials/petab/v1/_conditions.py index 766867c450..c7a90a23bc 100644 --- a/python/sdist/amici/sim/sundials/petab/v1/_conditions.py +++ b/python/sdist/amici/sim/sundials/petab/v1/_conditions.py @@ -351,8 +351,8 @@ def create_edata_for_condition( # create an ExpData object edata = ExpData(amici_model) edata.id = condition[SIMULATION_CONDITION_ID] - if condition.get(PREEQUILIBRATION_CONDITION_ID): - edata.id += "+" + condition.get(PREEQUILIBRATION_CONDITION_ID) + if not pd.isna(preeq_id := condition.get(PREEQUILIBRATION_CONDITION_ID)): + edata.id += f"+{preeq_id}" ########################################################################## # enable initial parameters reinitialization @@ -444,7 +444,11 @@ def create_edatas( if PREEQUILIBRATION_CONDITION_ID in condition: measurement_index = ( condition.get(SIMULATION_CONDITION_ID), - condition.get(PREEQUILIBRATION_CONDITION_ID) or "", + preeq_id + if not pd.isna( + preeq_id := condition.get(PREEQUILIBRATION_CONDITION_ID) + ) + else "", ) else: measurement_index = (condition.get(SIMULATION_CONDITION_ID),) From 86bd6bd49bab3ab3089daa6e0de9cce4851b2df8 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 12 Mar 2026 10:19:00 +0100 Subject: [PATCH 3/3] .. --- .github/workflows/test_petab_test_suite.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_petab_test_suite.yml b/.github/workflows/test_petab_test_suite.yml index 2daee87a71..14828ab6de 100644 --- a/.github/workflows/test_petab_test_suite.yml +++ b/.github/workflows/test_petab_test_suite.yml @@ -172,7 +172,7 @@ jobs: git clone https://github.com/PEtab-dev/petab_test_suite \ && source ./venv/bin/activate \ && cd petab_test_suite \ - && git checkout 9542847fb99bcbdffc236e2ef45ba90580a210fa \ + && git checkout a1935c4d197c3b72dfaf85b9c28268314f4e6ef2 \ && pip3 install -e . # TODO: once there is a PEtab v2 benchmark collection @@ -186,7 +186,7 @@ jobs: run: | source ./venv/bin/activate \ && python3 -m pip uninstall -y petab \ - && python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@44c8062ce1b87a74a0ba1bd2551de0cdc2a13ff1 \ + && python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@main \ && python3 -m pip install git+https://github.com/pysb/pysb@master \ && python3 -m pip install sympy>=1.12.1