Skip to content

Commit c3bbdd9

Browse files
authored
Merge pull request #2581 from dweindl/release_0.28.0
Release 0.28.0
2 parents 638c3ee + 307fb23 commit c3bbdd9

25 files changed

+575
-607
lines changed

.github/workflows/test_benchmark_collection_models.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,28 @@ jobs:
5252
AMICI_PARALLEL_COMPILE="" pip3 install -v --user \
5353
$(ls -t python/sdist/dist/amici-*.tar.gz | head -1)[petab,test,vis]
5454
55-
- run: |
55+
- name: Install test dependencies
56+
run: |
5657
python3 -m pip uninstall -y petab && python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@develop \
57-
&& python3 -m pip install -U sympy
58+
&& python3 -m pip install -U sympy \
59+
&& python3 -m pip install git+https://github.com/ICB-DCM/fiddy.git
5860
59-
# retrieve test models
60-
- name: Download and test benchmark collection
61+
- name: Download benchmark collection
6162
run: |
6263
git clone --depth 1 https://github.com/benchmarking-initiative/Benchmark-Models-PEtab.git \
63-
&& export BENCHMARK_COLLECTION="$(pwd)/Benchmark-Models-PEtab/Benchmark-Models/" \
64-
&& pip3 install -e $BENCHMARK_COLLECTION/../src/python \
65-
&& AMICI_PARALLEL_COMPILE="" tests/benchmark-models/test_benchmark_collection.sh
64+
&& python3 -m pip install -e Benchmark-Models-PEtab/src/python
65+
66+
- name: Run tests
67+
env:
68+
AMICI_PARALLEL_COMPILE: ""
69+
run: |
70+
cd tests/benchmark-models && pytest --durations=10
6671
67-
# run gradient checks
68-
- name: Run Gradient Checks
72+
# collect & upload results
73+
- name: Aggregate results
6974
run: |
70-
pip install git+https://github.com/ICB-DCM/fiddy.git \
71-
&& cd tests/benchmark-models && pytest --durations=10 ./test_petab_benchmark.py
75+
cd tests/benchmark-models && python3 evaluate_benchmark.py
7276
73-
# upload results
7477
- uses: actions/upload-artifact@v4
7578
with:
7679
name: computation-times-${{ matrix.python-version }}-${{ matrix.extract_subexpressions }}

.github/workflows/test_python_cplusplus.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ jobs:
247247
macos_cpp_py:
248248
name: Tests MacOS C++/Python
249249
runs-on: macos-latest
250+
env:
251+
PYTHONFAULTHANDLER: "1"
250252

251253
steps:
252254
- name: Set up Python
@@ -291,7 +293,8 @@ jobs:
291293

292294
- name: Python tests
293295
run: |
294-
scripts/run-python-tests.sh \
296+
# ignore warnings until https://github.com/swig/swig/issues/3061 is resolved
297+
scripts/run-python-tests.sh -W ignore:: \
295298
test_pregenerated_models.py \
296299
test_splines_short.py \
297300
test_misc.py
@@ -300,6 +303,8 @@ jobs:
300303
macos_python:
301304
name: Tests MacOS Python
302305
runs-on: macos-latest
306+
env:
307+
PYTHONFAULTHANDLER: "1"
303308

304309
steps:
305310
- name: Cache
@@ -351,7 +356,8 @@ jobs:
351356
352357
- name: Python tests
353358
run: |
354-
scripts/run-python-tests.sh \
359+
# ignore warnings until https://github.com/swig/swig/issues/3061 is resolved
360+
scripts/run-python-tests.sh -W ignore:: \
355361
--ignore=test_pregenerated_models.py \
356362
--ignore=test_splines_short.py \
357363
--ignore=test_misc.py

.github/workflows/test_python_ver_matrix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- python-version: '3.12'
3434
experimental: false
3535
- python-version: '3.13'
36-
experimental: true
36+
experimental: false
3737

3838
steps:
3939
- run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,63 @@ See also our [versioning policy](https://amici.readthedocs.io/en/latest/versioni
44

55
## v0.X Series
66

7+
### v0.28.0 (2024-11-11)
8+
9+
**Breaking changes**
10+
11+
* Changed the default steady-state method to `integrationOnly`
12+
(by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2574)
13+
14+
The default mode for computing steady states and sensitivities at steady
15+
state was changed to `integrationOnly`
16+
(from previously `integrateIfNewtonFails`).
17+
18+
This was done for a more robust default behavior. For example, the evaluation
19+
in https://doi.org/10.1371/journal.pone.0312148 shows that - at least for
20+
some models - Newton's method may easily lead to physically impossible
21+
solutions.
22+
23+
To keep the previous behavior, use:
24+
```python
25+
amici_model.setSteadyStateComputationMode(amici.SteadyStateComputationMode.integrateIfNewtonFails)
26+
amici_model.setSteadyStateSensitivityMode(amici.SteadyStateSensitivityMode.integrateIfNewtonFails)
27+
```
28+
29+
**Fixes**
30+
31+
* PEtab import: **Fixed potentially incorrect sensitivities** with
32+
observable/state-dependent sigmas.
33+
This was fixed for all cases amici can handle, others cases will now result
34+
in `ValueError`s (https://github.com/AMICI-dev/AMICI/pull/2563).
35+
36+
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2562
37+
38+
* Fixed potentially incorrect disabling of Newton's method
39+
40+
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2576
41+
42+
* Fixed `ModelStateDerived` copy ctor, where previously dangling pointers
43+
could lead to crashes in some situations
44+
45+
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2583
46+
47+
* Added missing simulation status codes
48+
49+
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2560
50+
51+
* Check for unsupported observable IDs in sigma expressions
52+
53+
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2563
54+
55+
56+
**Features**
57+
58+
* Optional warning in `fill_in_parameters`
59+
60+
by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2578
61+
62+
**Full Changelog**: https://github.com/AMICI-dev/AMICI/compare/v0.27.0...v0.28.0
63+
764
### v0.27.0 (2024-10-21)
865

966
This release comes with an **updated version of the SUNDIALS package (7.1.1)** (https://github.com/AMICI-dev/AMICI/pull/2513).

codecov.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
fixes:
2-
- "build/venv/lib/python3.9/site-packages/::python/"
3-
- "build/venv/lib/python3.10/site-packages/::python/"
4-
- "build/venv/lib/python3.11/site-packages/::python/"
1+
# see https://docs.codecov.com/docs/codecovyml-reference
52

3+
fixes:
4+
# https://docs.codecov.com/docs/fixing-paths
5+
- "build/venv/lib/python[0-9.]+/site-packages/::python/"
6+
- "python/sdist/build/temp_amici/CMakeFiles/amici.dir/src/::src/"
7+
- "build/CMakeFiles/amici.dir/src/::src/"
68
codecov:
79
require_ci_to_pass: yes
810

@@ -27,6 +29,8 @@ comment:
2729
ignore:
2830
- "tests/*"
2931
- "tests/**/*"
32+
- "build/tests/**"
33+
- "amici_models/**"
3034

3135
flags:
3236
python:

include/amici/defines.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,13 @@ constexpr int AMICI_CONSTR_FAIL= -15;
7474
constexpr int AMICI_CVODES_CONSTR_FAIL= -15;
7575
constexpr int AMICI_IDAS_CONSTR_FAIL= -11;
7676
constexpr int AMICI_ILL_INPUT= -22;
77+
constexpr int AMICI_BAD_T= -25;
78+
constexpr int AMICI_BAD_DKY= -26;
7779
constexpr int AMICI_FIRST_QRHSFUNC_ERR= -32;
80+
constexpr int AMICI_SRHSFUNC_FAIL= -41;
81+
constexpr int AMICI_FIRST_SRHSFUNC_ERR= -42;
82+
constexpr int AMICI_REPTD_SRHSFUNC_ERR= -43;
83+
constexpr int AMICI_UNREC_SRHSFUNC_ERR= -44;
7884
constexpr int AMICI_ERROR= -99;
7985
constexpr int AMICI_NO_STEADY_STATE= -81;
8086
constexpr int AMICI_DAMPING_FACTOR_ERROR= -86;

include/amici/model.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,12 +2063,12 @@ class Model : public AbstractModel, public ModelDimensions {
20632063

20642064
/** method for steady-state computation */
20652065
SteadyStateComputationMode steadystate_computation_mode_{
2066-
SteadyStateComputationMode::integrateIfNewtonFails
2066+
SteadyStateComputationMode::integrationOnly
20672067
};
20682068

20692069
/** method for steadystate sensitivities computation */
20702070
SteadyStateSensitivityMode steadystate_sensitivity_mode_{
2071-
SteadyStateSensitivityMode::integrateIfNewtonFails
2071+
SteadyStateSensitivityMode::integrationOnly
20722072
};
20732073

20742074
/**

include/amici/model_state.h

Lines changed: 28 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -146,71 +146,37 @@ struct ModelStateDerived {
146146
, dwdw_(other.dwdw_)
147147
, dwdx_hierarchical_(other.dwdx_hierarchical_)
148148
, dJydy_dense_(other.dJydy_dense_) {
149-
// Update the SUNContext of all matrices
150-
if (J_.data()) {
151-
J_.get()->sunctx = sunctx_;
149+
// Update the SUNContext of all SUNDIALS objects
150+
J_.set_ctx(sunctx_);
151+
JB_.set_ctx(sunctx_);
152+
dxdotdw_.set_ctx(sunctx_);
153+
dwdx_.set_ctx(sunctx_);
154+
dwdp_.set_ctx(sunctx_);
155+
M_.set_ctx(sunctx_);
156+
MSparse_.set_ctx(sunctx_);
157+
dfdx_.set_ctx(sunctx_);
158+
dxdotdp_full.set_ctx(sunctx_);
159+
dxdotdp_explicit.set_ctx(sunctx_);
160+
dxdotdp_implicit.set_ctx(sunctx_);
161+
dxdotdx_explicit.set_ctx(sunctx_);
162+
dxdotdx_implicit.set_ctx(sunctx_);
163+
dx_rdatadx_solver.set_ctx(sunctx_);
164+
dx_rdatadtcl.set_ctx(sunctx_);
165+
dtotal_cldx_rdata.set_ctx(sunctx_);
166+
dxdotdp.set_ctx(sunctx_);
167+
168+
for (auto& dJydy : dJydy_) {
169+
dJydy.set_ctx(sunctx_);
152170
}
153-
if (JB_.data()) {
154-
JB_.get()->sunctx = sunctx_;
171+
for (auto& dwdp : dwdp_hierarchical_) {
172+
dwdp.set_ctx(sunctx_);
155173
}
156-
if (dxdotdw_.data()) {
157-
dxdotdw_.get()->sunctx = sunctx_;
158-
}
159-
if (dwdx_.data()) {
160-
dwdx_.get()->sunctx = sunctx_;
161-
}
162-
if (dwdp_.data()) {
163-
dwdp_.get()->sunctx = sunctx_;
164-
}
165-
if (M_.data()) {
166-
M_.get()->sunctx = sunctx_;
167-
}
168-
if (MSparse_.data()) {
169-
MSparse_.get()->sunctx = sunctx_;
170-
}
171-
if (dfdx_.data()) {
172-
dfdx_.get()->sunctx = sunctx_;
173-
}
174-
if (dxdotdp_full.data()) {
175-
dxdotdp_full.get()->sunctx = sunctx_;
176-
}
177-
if (dxdotdp_explicit.data()) {
178-
dxdotdp_explicit.get()->sunctx = sunctx_;
179-
}
180-
if (dxdotdp_implicit.data()) {
181-
dxdotdp_implicit.get()->sunctx = sunctx_;
182-
}
183-
if (dxdotdx_explicit.data()) {
184-
dxdotdx_explicit.get()->sunctx = sunctx_;
185-
}
186-
if (dxdotdx_implicit.data()) {
187-
dxdotdx_implicit.get()->sunctx = sunctx_;
188-
}
189-
if (dx_rdatadx_solver.data()) {
190-
dx_rdatadx_solver.get()->sunctx = sunctx_;
191-
}
192-
if (dx_rdatadtcl.data()) {
193-
dx_rdatadtcl.get()->sunctx = sunctx_;
194-
}
195-
if (dtotal_cldx_rdata.data()) {
196-
dtotal_cldx_rdata.get()->sunctx = sunctx_;
197-
}
198-
for (auto const& dwdp : dwdp_hierarchical_) {
199-
if (dwdp.data()) {
200-
dwdp.get()->sunctx = sunctx_;
201-
}
202-
}
203-
for (auto const& dwdx : dwdx_hierarchical_) {
204-
if (dwdx.data()) {
205-
dwdx.get()->sunctx = sunctx_;
206-
}
207-
}
208-
if (dwdw_.data()) {
209-
dwdw_.get()->sunctx = sunctx_;
210-
}
211-
if (dJydy_dense_.data()) {
212-
dJydy_dense_.get()->sunctx = sunctx_;
174+
for (auto& dwdx : dwdx_hierarchical_) {
175+
dwdx.set_ctx(sunctx_);
213176
}
177+
sspl_.set_ctx(sunctx_);
178+
dwdw_.set_ctx(sunctx_);
179+
dJydy_dense_.set_ctx(sunctx_);
214180
}
215181

216182
/**

include/amici/sundials_matrix_wrapper.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,19 @@ class SUNMatrixWrapper {
506506
*/
507507
SUNContext get_ctx() const;
508508

509+
/**
510+
* @brief Set SUNContext
511+
*
512+
* Update the SUNContext of the wrapped SUNMatrix.
513+
*
514+
* @param ctx SUNDIALS context to set
515+
*/
516+
void set_ctx(SUNContext ctx) {
517+
if (matrix_) {
518+
matrix_->sunctx = ctx;
519+
}
520+
}
521+
509522
private:
510523
/**
511524
* @brief SUNMatrix to which all methods are applied

include/amici/vector.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,20 @@ class AmiVectorArray {
413413
*/
414414
void copy(AmiVectorArray const& other);
415415

416+
/**
417+
* @brief Set SUNContext
418+
*
419+
* If any AmiVector is non-empty, this changes the current SUNContext of the
420+
* associated N_Vector. If empty, do nothing.
421+
*
422+
* @param ctx SUNDIALS context to set
423+
*/
424+
void set_ctx(SUNContext ctx) {
425+
for (auto& vec : vec_array_) {
426+
vec.set_ctx(ctx);
427+
}
428+
}
429+
416430
private:
417431
/** main data storage */
418432
std::vector<AmiVector> vec_array_;

0 commit comments

Comments
 (0)