Skip to content

Commit 8fe8884

Browse files
authored
Release 0.11.29
Merge pull request #1793 from AMICI-dev/release_0.11.29
2 parents da34367 + 1952697 commit 8fe8884

31 files changed

+774
-220
lines changed

.github/workflows/test_petab_test_suite.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,24 @@ jobs:
7171
- name: Run PEtab-related unit tests
7272
run: |
7373
source ./build/venv/bin/activate \
74-
&& pytest --cov-report=xml --cov=./ python/tests/test_*petab*.py
74+
&& pytest --cov-report=xml:coverage.xml \
75+
--cov=./ python/tests/test_*petab*.py
7576
7677
# run test models
7778
- name: Run PEtab test suite
7879
# git clone --depth 1 https://github.com/petab-dev/petab_test_suite
7980
run: |
8081
source ./build/venv/bin/activate \
8182
&& AMICI_PARALLEL_COMPILE=2 pytest -v \
82-
--cov-report=xml --cov-append --cov=amici tests/petab_test_suite/
83+
--cov-report=xml:coverage.xml \
84+
--cov-append \
85+
--cov=amici \
86+
tests/petab_test_suite/
8387
8488
- name: Codecov
85-
uses: codecov/codecov-action@v2
89+
uses: codecov/codecov-action@v3.1.0
8690
with:
8791
token: ${{ secrets.CODECOV_TOKEN }}
88-
file: ./coverage.xml
92+
file: coverage.xml
8993
flags: petab
9094
fail_ci_if_error: true

.github/workflows/test_python_cplusplus.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,28 +104,29 @@ jobs:
104104
scripts/runNotebook.sh documentation/GettingStarted.ipynb
105105
106106
- name: Codecov Python
107-
uses: codecov/codecov-action@v2
107+
uses: codecov/codecov-action@v3.1.0
108108
with:
109109
token: ${{ secrets.CODECOV_TOKEN }}
110-
file: ./build/coverage_py.xml
110+
file: build/coverage_py.xml
111111
flags: python
112112
fail_ci_if_error: true
113+
verbose: true
113114

114115
- name: lcov
115116
run: |
116117
lcov --compat-libtool --no-external \
117118
-d ${AMICI_DIR}/build/CMakeFiles/amici.dir/src \
118119
-b ${AMICI_DIR} -c -o coverage_cpp.info \
119120
&& lcov --compat-libtool --no-external \
120-
-d ${AMICI_DIR}/python/sdist/build/temp.linux-x86_64-$(python3 --version | sed -E 's/.*([0-9]+\.[0-9]+)\..*/\1/')/amici/src \
121+
-d ${AMICI_DIR}/python/sdist/build/temp.linux-x86_64-$(python -c "import sys; print(sys.implementation.cache_tag)")/amici/src \
121122
-b ${AMICI_DIR}/python/sdist -c -o coverage_py.info \
122123
&& lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info
123124
124125
- name: Codecov CPP
125-
uses: codecov/codecov-action@v2
126+
uses: codecov/codecov-action@v3.1.0
126127
with:
127128
token: ${{ secrets.CODECOV_TOKEN }}
128-
file: ./coverage.info
129+
file: coverage.info
129130
flags: cpp
130131
fail_ci_if_error: true
131132

.github/workflows/test_sbml_semantic_test_suite.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ jobs:
5353
path: tests/amici-semantic-results
5454

5555
- name: Codecov SBMLSuite
56-
uses: codecov/codecov-action@v2
56+
uses: codecov/codecov-action@v3.1.0
5757
with:
5858
token: ${{ secrets.CODECOV_TOKEN }}
59-
file: ./coverage_SBMLSuite.xml
59+
file: coverage_SBMLSuite.xml
6060
flags: sbmlsuite
6161
fail_ci_if_error: true

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22

33
## v0.X Series
44

5+
### v0.11.29 (2022-05-06)
6+
7+
## What's Changed
8+
9+
Features:
10+
* Performance: Limit newton step convergence check by @FFroehlich in
11+
https://github.com/AMICI-dev/AMICI/pull/1780
12+
* More informative NaN/Inf warnings by @dweindl in
13+
https://github.com/AMICI-dev/AMICI/pull/1640
14+
* SBML import can now handle initial events by @FFroehlich in
15+
https://github.com/AMICI-dev/AMICI/pull/1789
16+
17+
Fixes:
18+
* Avoid error if no measurements in PEtab problem; fixed type handling in
19+
PEtab parameter mapping by @dilpath in
20+
https://github.com/AMICI-dev/AMICI/pull/1783
21+
* Fixed substitution of expressions in root and stau by @dilpath in
22+
https://github.com/AMICI-dev/AMICI/pull/1784
23+
* Workaround for PEtab problems with state-dependent noise models by @dweindl
24+
in https://github.com/AMICI-dev/AMICI/pull/1791
25+
26+
**Full Changelog**: https://github.com/AMICI-dev/AMICI/compare/v0.11.28...v0.11.29
27+
28+
529
### v0.11.28 (2022-04-08)
630

731
New features:

documentation/python_interface.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ AMICI can import :term:`SBML` models via the
2626
Status of SBML support in Python-AMICI
2727
++++++++++++++++++++++++++++++++++++++
2828

29-
Python-AMICI currently **passes 1014 out of the 1821 (~56%) test cases** from
29+
Python-AMICI currently **passes 1030 out of the 1821 (~57%) test cases** from
3030
the semantic
3131
`SBML Test Suite <https://github.com/sbmlteam/sbml-test-suite/>`_
3232
(`current status <https://github.com/AMICI-dev/AMICI/actions>`_).

include/amici/forwardproblem.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,11 @@ class ForwardProblem {
290290
*
291291
* @param tlastroot pointer to the timepoint of the last event
292292
* @param seflag Secondary event flag
293+
* @param initial_event initial event flag
293294
*/
294295

295-
void handleEvent(realtype *tlastroot,bool seflag);
296+
void handleEvent(realtype *tlastroot, bool seflag,
297+
bool initial_event);
296298

297299
/**
298300
* @brief Extract output information for events

include/amici/misc.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,17 @@ class ContextManager{
187187
ContextManager(ContextManager &&other) = delete;
188188
};
189189

190+
191+
/**
192+
* @brief Convert a flat index to a pair of row/column indices,
193+
* assuming row-major order.
194+
* @param flat_idx flat index
195+
* @param num_cols number of columns of referred to matrix
196+
* @return row index, column index
197+
*/
198+
auto unravel_index(size_t flat_idx, size_t num_cols)
199+
-> std::pair<size_t, size_t>;
200+
190201
} // namespace amici
191202

192203
#endif // AMICI_MISC_H

include/amici/model.h

Lines changed: 81 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,42 @@ void serialize(Archive &ar, amici::Model &m, unsigned int version);
3434

3535
namespace amici {
3636

37+
/**
38+
* @brief Describes the various model quantities
39+
*/
40+
enum class ModelQuantity {
41+
J,
42+
JB,
43+
Jv,
44+
JvB,
45+
JDiag,
46+
sx,
47+
sy,
48+
ssigmay,
49+
xdot,
50+
sxdot,
51+
xBdot,
52+
x0_rdata,
53+
x0,
54+
x_rdata,
55+
x,
56+
dwdw,
57+
dwdx,
58+
dwdp,
59+
y,
60+
dydp,
61+
dydx,
62+
w,
63+
root,
64+
qBdot,
65+
qBdot_ss,
66+
xBdot_ss,
67+
JSparseB_ss,
68+
};
69+
70+
extern const std::map<ModelQuantity, std::string> model_quantity_to_str;
71+
72+
3773
/**
3874
* @brief The Model class represents an AMICI ODE/DAE model.
3975
*
@@ -61,7 +97,8 @@ class Model : public AbstractModel, public ModelDimensions {
6197
SimulationParameters simulation_parameters,
6298
amici::SecondOrderMode o2mode,
6399
std::vector<amici::realtype> idlist,
64-
std::vector<int> z2event, bool pythonGenerated = false,
100+
std::vector<int> z2event,
101+
bool pythonGenerated = false,
65102
int ndxdotdp_explicit = 0, int ndxdotdx_explicit = 0,
66103
int w_recursion_depth = 0);
67104

@@ -166,9 +203,11 @@ class Model : public AbstractModel, public ModelDimensions {
166203
* @param sdx Reference to time derivative of state sensitivities (DAE only)
167204
* @param computeSensitivities Flag indicating whether sensitivities are to
168205
* be computed
206+
* @param roots_found boolean indicators indicating whether roots were found at t0 by this fun
169207
*/
170208
void initialize(AmiVector &x, AmiVector &dx, AmiVectorArray &sx,
171-
AmiVectorArray &sdx, bool computeSensitivities);
209+
AmiVectorArray &sdx, bool computeSensitivities,
210+
std::vector<int> &roots_found);
172211

173212
/**
174213
* @brief Initialize model properties.
@@ -200,8 +239,10 @@ class Model : public AbstractModel, public ModelDimensions {
200239
*
201240
* @param x Reference to state variables
202241
* @param dx Reference to time derivative of states (DAE only)
242+
* @param roots_found boolean indicators indicating whether roots were found at t0 by this fun
203243
*/
204-
void initHeaviside(const AmiVector &x, const AmiVector &dx);
244+
void initEvents(const AmiVector &x, const AmiVector &dx,
245+
std::vector<int> &roots_found);
205246

206247
/**
207248
* @brief Get number of parameters wrt to which sensitivities are computed.
@@ -1201,18 +1242,43 @@ class Model : public AbstractModel, public ModelDimensions {
12011242
*/
12021243
void updateHeavisideB(const int *rootsfound);
12031244

1245+
1246+
/**
1247+
* @brief Check if the given array has only finite elements.
1248+
*
1249+
* For (1D) spans.
1250+
*
1251+
* @param array
1252+
* @param model_quantity The model quantity `array` corresponds to
1253+
* @return
1254+
*/
1255+
int checkFinite(gsl::span<const realtype> array,
1256+
ModelQuantity model_quantity) const;
1257+
/**
1258+
* @brief Check if the given array has only finite elements.
1259+
*
1260+
* For flattened 2D arrays.
1261+
*
1262+
* @param array Flattened matrix
1263+
* @param model_quantity The model quantity `array` corresponds to
1264+
* @param num_cols Number of columns of the non-flattened matrix
1265+
* @return
1266+
*/
1267+
int checkFinite(gsl::span<const realtype> array,
1268+
ModelQuantity model_quantity,
1269+
size_t num_cols) const;
1270+
12041271
/**
12051272
* @brief Check if the given array has only finite elements.
12061273
*
1207-
* If not, try to give hints by which other fields this could be caused.
1274+
* For SUNMatrix.
12081275
*
1209-
* @param array Array to check
1210-
* @param fun Name of the function that generated the values (for more
1211-
* informative messages).
1212-
* @return `amici::AMICI_RECOVERABLE_ERROR` if a NaN/Inf value was found,
1213-
* `amici::AMICI_SUCCESS` otherwise
1276+
* @param m Matrix to check
1277+
* @param model_quantity The model quantity `m` corresponds to
1278+
* @param t current timepoint
1279+
* @return
12141280
*/
1215-
int checkFinite(gsl::span<const realtype> array, const char *fun) const;
1281+
int checkFinite(SUNMatrix m, ModelQuantity model_quantity, realtype t) const;
12161282

12171283
/**
12181284
* @brief Set whether the result of every call to `Model::f*` should be
@@ -1803,6 +1869,11 @@ class Model : public AbstractModel, public ModelDimensions {
18031869
/** vector of bools indicating whether state variables are to be assumed to
18041870
* be positive */
18051871
std::vector<bool> state_is_non_negative_;
1872+
1873+
/** Vector of booleans indicating the initial boolean value for every event trigger function. Events at t0
1874+
* can only trigger if the initial value is set to `false`. Must be specified during model compilation by
1875+
* setting the `initialValue` attribute of an event trigger. */
1876+
std::vector<bool> root_initial_values_;
18061877

18071878
/** boolean indicating whether any entry in stateIsNonNegative is `true` */
18081879
bool any_state_non_negative_ {false};

include/amici/sundials_matrix_wrapper.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,16 @@ class SUNMatrixWrapper {
532532
bool ownmat = true;
533533
};
534534

535+
536+
/**
537+
* @brief Convert a flat index to a pair of row/column indices.
538+
* @param i flat index
539+
* @param m referred to matrix
540+
* @return row index, column index
541+
*/
542+
auto unravel_index(sunindextype i, SUNMatrix m)
543+
-> std::pair<sunindextype, sunindextype>;
544+
535545
} // namespace amici
536546

537547
namespace gsl {

0 commit comments

Comments
 (0)