Skip to content

Commit

Permalink
Release 0.11.29
Browse files Browse the repository at this point in the history
Merge pull request #1793 from AMICI-dev/release_0.11.29
  • Loading branch information
dweindl authored May 6, 2022
2 parents da34367 + 1952697 commit 8fe8884
Show file tree
Hide file tree
Showing 31 changed files with 774 additions and 220 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/test_petab_test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,24 @@ jobs:
- name: Run PEtab-related unit tests
run: |
source ./build/venv/bin/activate \
&& pytest --cov-report=xml --cov=./ python/tests/test_*petab*.py
&& pytest --cov-report=xml:coverage.xml \
--cov=./ python/tests/test_*petab*.py
# run test models
- name: Run PEtab test suite
# git clone --depth 1 https://github.com/petab-dev/petab_test_suite
run: |
source ./build/venv/bin/activate \
&& AMICI_PARALLEL_COMPILE=2 pytest -v \
--cov-report=xml --cov-append --cov=amici tests/petab_test_suite/
--cov-report=xml:coverage.xml \
--cov-append \
--cov=amici \
tests/petab_test_suite/
- name: Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
file: coverage.xml
flags: petab
fail_ci_if_error: true
11 changes: 6 additions & 5 deletions .github/workflows/test_python_cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,28 +104,29 @@ jobs:
scripts/runNotebook.sh documentation/GettingStarted.ipynb
- name: Codecov Python
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./build/coverage_py.xml
file: build/coverage_py.xml
flags: python
fail_ci_if_error: true
verbose: true

- name: lcov
run: |
lcov --compat-libtool --no-external \
-d ${AMICI_DIR}/build/CMakeFiles/amici.dir/src \
-b ${AMICI_DIR} -c -o coverage_cpp.info \
&& lcov --compat-libtool --no-external \
-d ${AMICI_DIR}/python/sdist/build/temp.linux-x86_64-$(python3 --version | sed -E 's/.*([0-9]+\.[0-9]+)\..*/\1/')/amici/src \
-d ${AMICI_DIR}/python/sdist/build/temp.linux-x86_64-$(python -c "import sys; print(sys.implementation.cache_tag)")/amici/src \
-b ${AMICI_DIR}/python/sdist -c -o coverage_py.info \
&& lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info
- name: Codecov CPP
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.info
file: coverage.info
flags: cpp
fail_ci_if_error: true

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_sbml_semantic_test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ jobs:
path: tests/amici-semantic-results

- name: Codecov SBMLSuite
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage_SBMLSuite.xml
file: coverage_SBMLSuite.xml
flags: sbmlsuite
fail_ci_if_error: true
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

## v0.X Series

### v0.11.29 (2022-05-06)

## What's Changed

Features:
* Performance: Limit newton step convergence check by @FFroehlich in
https://github.com/AMICI-dev/AMICI/pull/1780
* More informative NaN/Inf warnings by @dweindl in
https://github.com/AMICI-dev/AMICI/pull/1640
* SBML import can now handle initial events by @FFroehlich in
https://github.com/AMICI-dev/AMICI/pull/1789

Fixes:
* Avoid error if no measurements in PEtab problem; fixed type handling in
PEtab parameter mapping by @dilpath in
https://github.com/AMICI-dev/AMICI/pull/1783
* Fixed substitution of expressions in root and stau by @dilpath in
https://github.com/AMICI-dev/AMICI/pull/1784
* Workaround for PEtab problems with state-dependent noise models by @dweindl
in https://github.com/AMICI-dev/AMICI/pull/1791

**Full Changelog**: https://github.com/AMICI-dev/AMICI/compare/v0.11.28...v0.11.29


### v0.11.28 (2022-04-08)

New features:
Expand Down
2 changes: 1 addition & 1 deletion documentation/python_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ AMICI can import :term:`SBML` models via the
Status of SBML support in Python-AMICI
++++++++++++++++++++++++++++++++++++++

Python-AMICI currently **passes 1014 out of the 1821 (~56%) test cases** from
Python-AMICI currently **passes 1030 out of the 1821 (~57%) test cases** from
the semantic
`SBML Test Suite <https://github.com/sbmlteam/sbml-test-suite/>`_
(`current status <https://github.com/AMICI-dev/AMICI/actions>`_).
Expand Down
4 changes: 3 additions & 1 deletion include/amici/forwardproblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,11 @@ class ForwardProblem {
*
* @param tlastroot pointer to the timepoint of the last event
* @param seflag Secondary event flag
* @param initial_event initial event flag
*/

void handleEvent(realtype *tlastroot,bool seflag);
void handleEvent(realtype *tlastroot, bool seflag,
bool initial_event);

/**
* @brief Extract output information for events
Expand Down
11 changes: 11 additions & 0 deletions include/amici/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,17 @@ class ContextManager{
ContextManager(ContextManager &&other) = delete;
};


/**
* @brief Convert a flat index to a pair of row/column indices,
* assuming row-major order.
* @param flat_idx flat index
* @param num_cols number of columns of referred to matrix
* @return row index, column index
*/
auto unravel_index(size_t flat_idx, size_t num_cols)
-> std::pair<size_t, size_t>;

} // namespace amici

#endif // AMICI_MISC_H
91 changes: 81 additions & 10 deletions include/amici/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,42 @@ void serialize(Archive &ar, amici::Model &m, unsigned int version);

namespace amici {

/**
* @brief Describes the various model quantities
*/
enum class ModelQuantity {
J,
JB,
Jv,
JvB,
JDiag,
sx,
sy,
ssigmay,
xdot,
sxdot,
xBdot,
x0_rdata,
x0,
x_rdata,
x,
dwdw,
dwdx,
dwdp,
y,
dydp,
dydx,
w,
root,
qBdot,
qBdot_ss,
xBdot_ss,
JSparseB_ss,
};

extern const std::map<ModelQuantity, std::string> model_quantity_to_str;


/**
* @brief The Model class represents an AMICI ODE/DAE model.
*
Expand Down Expand Up @@ -61,7 +97,8 @@ class Model : public AbstractModel, public ModelDimensions {
SimulationParameters simulation_parameters,
amici::SecondOrderMode o2mode,
std::vector<amici::realtype> idlist,
std::vector<int> z2event, bool pythonGenerated = false,
std::vector<int> z2event,
bool pythonGenerated = false,
int ndxdotdp_explicit = 0, int ndxdotdx_explicit = 0,
int w_recursion_depth = 0);

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

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

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


/**
* @brief Check if the given array has only finite elements.
*
* For (1D) spans.
*
* @param array
* @param model_quantity The model quantity `array` corresponds to
* @return
*/
int checkFinite(gsl::span<const realtype> array,
ModelQuantity model_quantity) const;
/**
* @brief Check if the given array has only finite elements.
*
* For flattened 2D arrays.
*
* @param array Flattened matrix
* @param model_quantity The model quantity `array` corresponds to
* @param num_cols Number of columns of the non-flattened matrix
* @return
*/
int checkFinite(gsl::span<const realtype> array,
ModelQuantity model_quantity,
size_t num_cols) const;

/**
* @brief Check if the given array has only finite elements.
*
* If not, try to give hints by which other fields this could be caused.
* For SUNMatrix.
*
* @param array Array to check
* @param fun Name of the function that generated the values (for more
* informative messages).
* @return `amici::AMICI_RECOVERABLE_ERROR` if a NaN/Inf value was found,
* `amici::AMICI_SUCCESS` otherwise
* @param m Matrix to check
* @param model_quantity The model quantity `m` corresponds to
* @param t current timepoint
* @return
*/
int checkFinite(gsl::span<const realtype> array, const char *fun) const;
int checkFinite(SUNMatrix m, ModelQuantity model_quantity, realtype t) const;

/**
* @brief Set whether the result of every call to `Model::f*` should be
Expand Down Expand Up @@ -1803,6 +1869,11 @@ class Model : public AbstractModel, public ModelDimensions {
/** vector of bools indicating whether state variables are to be assumed to
* be positive */
std::vector<bool> state_is_non_negative_;

/** Vector of booleans indicating the initial boolean value for every event trigger function. Events at t0
* can only trigger if the initial value is set to `false`. Must be specified during model compilation by
* setting the `initialValue` attribute of an event trigger. */
std::vector<bool> root_initial_values_;

/** boolean indicating whether any entry in stateIsNonNegative is `true` */
bool any_state_non_negative_ {false};
Expand Down
10 changes: 10 additions & 0 deletions include/amici/sundials_matrix_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,16 @@ class SUNMatrixWrapper {
bool ownmat = true;
};


/**
* @brief Convert a flat index to a pair of row/column indices.
* @param i flat index
* @param m referred to matrix
* @return row index, column index
*/
auto unravel_index(sunindextype i, SUNMatrix m)
-> std::pair<sunindextype, sunindextype>;

} // namespace amici

namespace gsl {
Expand Down
Loading

0 comments on commit 8fe8884

Please sign in to comment.