Skip to content

Commit

Permalink
Merge pull request #609 from ICB-DCM/develop
Browse files Browse the repository at this point in the history
Release 0.12.11
  • Loading branch information
yannikschaelte authored Jul 6, 2023
2 parents 5508549 + d491718 commit 7cbf832
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ Release Notes
...........


0.12.11 (2023-07-06)
--------------------

Fixes (#608)

* Fix petab test suite (different name resolution)
* Fix LocalTransition (pandas -> numpy argument)
* Fix sklearn intersphinx


0.12.10 (2023-05-09)
--------------------

Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
'pandas': ('https://pandas.pydata.org/pandas-docs/dev', None),
'petab': ('https://petab.readthedocs.io/en/stable/', None),
'amici': ('https://amici.readthedocs.io/en/latest/', None),
"sklearn": ("https://scikit-learn.org/stable/", None),
}


Expand Down
4 changes: 2 additions & 2 deletions pyabc/transition/local_transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def fit(self, X, w):
raise NotEnoughParticles("Fitting not possible.")
self.X_arr = X.values

ctree = cKDTree(X)
_, indices = ctree.query(X, k=min(self.k + 1, X.shape[0]))
ctree = cKDTree(self.X_arr)
_, indices = ctree.query(self.X_arr, k=min(self.k + 1, X.shape[0]))

covs, inv_covs, dets = list(
zip(*[self._cov_and_inv(n, indices) for n in range(X.shape[0])])
Expand Down
2 changes: 1 addition & 1 deletion pyabc/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.12.10'
__version__ = '0.12.11'
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ copasi =
ot =
pot >= 0.7.0
petab =
petab >= 0.1.18
petab >= 0.2.0
amici =
amici >= 0.11.19
amici >= 0.18.0
yaml2sbml =
yaml2sbml >= 0.2.1
migrate =
Expand Down
22 changes: 15 additions & 7 deletions test/petab/test_petab_suite.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Execute petab test suite."""

import logging
import os
import sys

import petabtests
Expand All @@ -22,8 +21,11 @@
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

MODEL_TYPE = "sbml"
PETAB_VERSION = "v1.0.0"

@pytest.fixture(params=petabtests.CASES_LIST)

@pytest.fixture(params=petabtests.get_cases(MODEL_TYPE, version=PETAB_VERSION))
def case(request):
"""A single test case."""
return request.param
Expand Down Expand Up @@ -63,11 +65,10 @@ def _execute_case(case):
case = petabtests.test_id_str(case)
logger.info(f"Case {case}")

# case folder
case_dir = os.path.join(petabtests.CASES_DIR, case)

# load solution
solution = petabtests.load_solution(case, format='sbml')
solution = petabtests.load_solution(
case, format=MODEL_TYPE, version=PETAB_VERSION
)
gt_chi2 = solution[petabtests.CHI2]
gt_llh = solution[petabtests.LLH]
gt_simulation_dfs = solution[petabtests.SIMULATION_DFS]
Expand All @@ -79,16 +80,23 @@ def _execute_case(case):
output_folder = f'amici_models/model_{case}'

# import petab problem
yaml_file = os.path.join(case_dir, petabtests.problem_yaml_name(case))
case_dir = petabtests.get_case_dir(case, MODEL_TYPE, PETAB_VERSION)
yaml_file = case_dir / petabtests.problem_yaml_name(case)

# create problem
petab_problem = petab.Problem.from_yaml(yaml_file)

# compile amici
if output_folder not in sys.path:
sys.path.insert(0, output_folder)

# use distinct model IDs for each test case since we cannot import different
# models with the same name in a single python session
model_name = f"petab_{MODEL_TYPE}_test_case_{case}_{PETAB_VERSION.replace('.', '_')}"

amici_model = amici.petab_import.import_petab_problem(
petab_problem=petab_problem,
model_name=model_name,
model_output_dir=output_folder,
generate_sensitivity_code=False,
)
Expand Down

0 comments on commit 7cbf832

Please sign in to comment.