Skip to content

Commit 78e4f3c

Browse files
authored
Merge branch 'develop' into check_grad_sbml_test_suite
2 parents 731ad05 + e36b3f4 commit 78e4f3c

File tree

12 files changed

+57
-17
lines changed

12 files changed

+57
-17
lines changed

.github/workflows/deploy_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ jobs:
3636
scripts/buildSdist.sh
3737
3838
- name: Publish a Python distribution to PyPI
39-
uses: pypa/gh-action-pypi-publish@master
39+
uses: pypa/gh-action-pypi-publish@release/v1
4040
with:
4141
user: __token__
4242
password: ${{ secrets.pypi_password }}
43-
packages_dir: python/sdist/dist
43+
packages-dir: python/sdist/dist
4444

4545
bioSimulatorsUpdateCliAndDockerImage:
4646
name: Release to BioSimulators

.github/workflows/test_python_cplusplus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- run: echo "BNGPATH=${GITHUB_WORKSPACE}/ThirdParty/BioNetGen-2.7.0" >> $GITHUB_ENV
3737

3838
# sonar cloud
39-
- run: echo "SONAR_SCANNER_VERSION=4.6.2.2472" >> $GITHUB_ENV
39+
- run: echo "SONAR_SCANNER_VERSION=4.7.0.2747" >> $GITHUB_ENV
4040
- run: echo "SONAR_SCANNER_HOME=${HOME}/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux" >> $GITHUB_ENV
4141
- run: echo "SONAR_SCANNER_OPTS=-server" >> $GITHUB_ENV
4242
- run: echo "${SONAR_SCANNER_HOME}/bin" >> $GITHUB_PATH

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ To install AMICI, first read the installation instructions for
8282
[Python](https://amici.readthedocs.io/en/latest/python_installation.html),
8383
[C++](https://amici.readthedocs.io/en/develop/cpp_installation.html) or
8484
[Matlab](https://amici.readthedocs.io/en/develop/matlab_installation.html).
85+
There are also instructions for using AMICI inside
86+
[containers](https://github.com/AMICI-dev/AMICI/tree/master/container).
8587

8688
To get you started with Python-AMICI, the best way might be checking out this
8789
[Jupyter notebook](https://github.com/AMICI-dev/AMICI/blob/master/documentation/GettingStarted.ipynb)

pytest.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@
33
addopts = -vv --strict-markers
44

55
filterwarnings =
6+
error
7+
# amici
8+
ignore:Conservation laws for non-constant species in models with RateRules are currently not supported and will be turned off.:UserWarning
9+
ignore:Conservation laws for non-constant species in models with Species-AssignmentRules are currently not supported and will be turned off.:UserWarning
10+
ignore:Conservation laws for non-constant species in combination with parameterized stoichiometric coefficients are not currently supported and will be turned off.:UserWarning
11+
ignore:Support for PEtab2.0 is experimental!:UserWarning
612
# hundreds of SBML <=5.17 warnings
713
ignore:.*inspect.getargspec\(\) is deprecated.*:DeprecationWarning
814
# pysb warnings
915
ignore:the imp module is deprecated in favour of importlib.*:DeprecationWarning:pysb\.core
1016
ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working.*:DeprecationWarning:pysb\.core
1117
ignore:Model.initial_conditions will be removed in a future version. Instead, you can get a list of Initial objects with Model.initials.:DeprecationWarning:pysb\.core
18+
# https://github.com/pytest-dev/pytest-xdist/issues/825#issuecomment-1292283870
19+
ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning
1220

1321
norecursedirs = .git amici_models build doc documentation matlab models ThirdParty amici sdist examples

python/sdist/amici/sbml_import.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import libsbml as sbml
1919
import numpy as np
2020
import sympy as sp
21+
from sympy.logic.boolalg import BooleanFalse, BooleanTrue
2122

2223
from . import has_clibs
2324
from .constants import SymbolId
@@ -214,7 +215,7 @@ def _process_document(self) -> None:
214215
conversion_properties.addOption("performValidation", False)
215216
conversion_properties.addOption("abortIfUnflattenable", "none")
216217
if (
217-
log_execution_time("converting SBML local parameters", logger)(
218+
log_execution_time("flattening hierarchical SBML", logger)(
218219
self.sbml_doc.convert
219220
)(conversion_properties)
220221
!= sbml.LIBSBML_OPERATION_SUCCESS
@@ -1047,7 +1048,12 @@ def _process_reactions(self):
10471048
reaction.getKineticLaw() or sp.Float(0)
10481049
)
10491050

1050-
self.flux_vector[reaction_index] = sym_math
1051+
self.flux_vector[reaction_index] = sym_math.subs(
1052+
{
1053+
BooleanTrue(): sp.Float(1.0),
1054+
BooleanFalse(): sp.Float(0.0),
1055+
}
1056+
)
10511057
if any(
10521058
str(symbol) in reaction_ids
10531059
for symbol in self.flux_vector[reaction_index].free_symbols

python/sdist/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ install_requires =
3535
numpy; python_version>='3.12'
3636
python-libsbml
3737
h5py
38-
pandas
38+
pandas>=2.0.2
3939
wurlitzer
4040
toposort
4141
setuptools>=48

python/tests/splines_utils.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def integrate_spline(
4747
params: Union[Dict, None],
4848
tt: Sequence[float],
4949
initial_value: float = 0,
50-
**kwargs,
5150
):
5251
"""
5352
Integrate the `AbstractSpline` `spline` at timepoints `tt`
@@ -56,7 +55,7 @@ def integrate_spline(
5655
ispline = [initial_value + spline.integrate(0, t) for t in tt]
5756
if params is not None:
5857
ispline = [x.subs(params) for x in ispline]
59-
return np.asarray(ispline, **kwargs)
58+
return ispline
6059

6160

6261
def create_condition_table() -> pd.DataFrame:
@@ -213,10 +212,13 @@ def create_petab_problem(
213212
dt /= measure_upsample
214213
n_obs = math.ceil(T / dt) + 1
215214
tt_obs = np.linspace(0, float(T), n_obs)
216-
zz_true = [
217-
integrate_spline(spline, params_true, tt_obs, iv, dtype=float)
218-
for (spline, iv) in zip(splines, initial_values)
219-
]
215+
zz_true = np.array(
216+
[
217+
integrate_spline(spline, params_true, tt_obs, iv)
218+
for (spline, iv) in zip(splines, initial_values)
219+
],
220+
dtype=float,
221+
)
220222
zz_obs = [zz + sigma * np.random.randn(len(zz)) for zz in zz_true]
221223

222224
# Create PEtab tables
@@ -263,7 +265,7 @@ def create_petab_problem(
263265
folder = os.path.abspath(folder)
264266
os.makedirs(folder, exist_ok=True)
265267
problem.to_files(
266-
sbml_file=os.path.join(folder, f"{model_name}_model.xml"),
268+
model_file=os.path.join(folder, f"{model_name}_model.xml"),
267269
condition_file=os.path.join(folder, f"{model_name}_conditions.tsv"),
268270
measurement_file=os.path.join(folder, f"{model_name}_measurements.tsv"),
269271
parameter_file=os.path.join(folder, f"{model_name}_parameters.tsv"),

python/tests/test_events.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def get_early_x(t):
164164
tmp_x = expm(event_1_time * A)
165165
x1 = np.matmul(tmp_x, x0)
166166
# apply bolus
167-
delta_x = np.array([[float(-x1[2, :] / 2)], [0], [0]])
167+
delta_x = np.array([[float(-x1[2, 0] / 2)], [0], [0]])
168168
x1 += delta_x
169169
# "simulate" on
170170
tmp_x = expm((t - event_1_time) * A)
@@ -425,7 +425,11 @@ def model_definition_event_state_dep_ddeltax_dtpx():
425425
timepoints = np.linspace(0.0, 5.0, 100)
426426
events = {
427427
# state-dependent ddeltaxdt
428-
"event_1": {"trigger": "time > alpha", "target": "x_1", "assignment": "x_1 * time"},
428+
"event_1": {
429+
"trigger": "time > alpha",
430+
"target": "x_1",
431+
"assignment": "x_1 * time",
432+
},
429433
# state-dependent ddeltaxdp
430434
"event_2": {
431435
"trigger": "time > beta",
@@ -453,7 +457,9 @@ def x_expected(t, x_1_0, alpha, beta, gamma, delta):
453457
x = ((x_1_0 + alpha) * alpha + (beta - alpha)) * delta + (t - beta)
454458
else:
455459
# after third event triggered
456-
x = (((x_1_0 + alpha) * alpha + (beta - alpha)) * delta + (gamma - beta)) ** 2 * 2 + (t - gamma)
460+
x = (
461+
((x_1_0 + alpha) * alpha + (beta - alpha)) * delta + (gamma - beta)
462+
) ** 2 * 2 + (t - gamma)
457463

458464
return np.array((x,))
459465

python/tests/test_pysb.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ def test_heavyside_and_special_symbols():
341341

342342
@skip_on_valgrind
343343
def test_energy():
344+
pysb.SelfExporter.cleanup()
344345
model_pysb = pysb.Model("energy")
345346
pysb.Monomer("A", ["a", "b"])
346347
pysb.Monomer("B", ["a"])

python/tests/valgrind-python.supp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,3 +761,17 @@
761761
Memcheck:Value8
762762
fun:dictkeys_get_index
763763
}
764+
765+
{
766+
Python os_stat / PyFloat_FromDouble
767+
Memcheck:Leak
768+
match-leak-kinds: definite
769+
fun:malloc
770+
fun:PyFloat_FromDouble
771+
fun:fill_time
772+
fun:_pystat_fromstructstat
773+
fun:posix_do_stat.constprop.0
774+
fun:os_stat_impl
775+
fun:os_stat
776+
...
777+
}

0 commit comments

Comments
 (0)