Conversation
…e h is known when dxdotdx_explicit is generated, to have the header file of h included
Codecov Report
@@ Coverage Diff @@
## develop #1352 +/- ##
===========================================
+ Coverage 78.44% 87.38% +8.94%
===========================================
Files 62 2 -60
Lines 9797 1427 -8370
===========================================
- Hits 7685 1247 -6438
+ Misses 2112 180 -1932
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Co-authored-by: Fabian Fröhlich <fabian@schaluck.com>
Co-authored-by: Fabian Fröhlich <fabian@schaluck.com>
Co-authored-by: Fabian Fröhlich <fabian@schaluck.com>
Co-authored-by: Fabian Fröhlich <fabian@schaluck.com>
Co-authored-by: Fabian Fröhlich <fabian@schaluck.com>
Co-authored-by: Fabian Fröhlich <fabian@schaluck.com>
|
Thanks for the code review! I'll implement the suggestions as soon as the test cases are there! |
…/AMICI into piecewise_to_heaviside
| ++++++++++++++++++++++++++++++++++++++ | ||
|
|
||
| Python-AMICI currently **passes 850 out of the 1780 (~48%) test cases** from | ||
| Python-AMICI currently **passes 805 out of the 1780 (~45%) test cases** from |
There was a problem hiding this comment.
Not sure what happened, looking at the tests that are skipped I couldn't really identify those 45 that are not longer passing.
There was a problem hiding this comment.
Ah, this is unrelated to this PR. (Here it increases from 804 to 805). This is where it happened: https://github.com/AMICI-dev/AMICI/actions/runs/331448378
There was a problem hiding this comment.
Used to work but skipped now (Should be all those AMICI does not support SBML models containing variables with SId):
969
970
971
974
1104
1105
1107
1109
1121
1434
1436
1438
1440
1442
1465
1498
1552
1554
1574
1638
1639
1651
1652
1653
1654
1655
1656
1657
1722
1724
1725
1726
1733
1734
1735
1744
1746
1748
1750
1753
1764
1765
1766
1767
1768
1773
1774
There was a problem hiding this comment.
I suspect thats due to the skippings with msgs like
SKIPPED [2] tests/testSBMLSuite.py:87: AMICI does not support SBML models containing variables with SId k0.
3677
SKIPPED [3] tests/testSBMLSuite.py:87: AMICI does not support SBML models containing variables with SId A1_sr.
3678
SKIPPED [2] tests/testSBMLSuite.py:87: AMICI does not support SBML models containing variables with SId A_sr1.
Those are a little over 50 cases, so lets have a more detailed look in a different PR. Also looks like there are still a handful of low hanging fruits like ceil/min/max applied to numerical values, which we should be able to pass.
Co-authored-by: Daniel Weindl <dweindl@users.noreply.github.com>
…/AMICI into piecewise_to_heaviside
|
Just also had a look at the refactored test. Looks fine for me as well! |
|
SonarCloud Quality Gate failed. |
* Fix: Don't require code context for call stack (fixes #1347) (#1348) * Fix Intel compiler warnings (#1349) 'type qualifier on return type is meaningless' Closes #1346 * Avoid segfault in CVODES CVAdataStore (#1351) Does not fix the root cause of occassional segfaults, but turns them into exceptions / integration failues. * CI: Move windows tests from TravisCI to GitHub Actions (#1354) Closes #1350 Removes obsolete .travis.yml * Fix cxxcode import for SymPy 1.6 (#1356) * Piecewise to heaviside (#1352) * parse piecewise into heaviside functions * Add Events as model quantity, parse Heavisides slightly differently * bugfix * rename symbols of root to h and switch order of functions to make sure h is known when dxdotdx_explicit is generated, to have the header file of h included * rename root symbols to HeavisideFunction_ to have things more indicative * tell AMICI about root, stau, and deltasx functions * heavisides without sensitivities should be working * need to change generation of stau to generration via inverse function theorem * compute stau via inverse function theorem * added functionality for deltasx, but segfaulting * bugfixing * remove debug output * get indentations right * Update python/amici/ode_export.py Co-authored-by: Fabian Fröhlich <fabian@schaluck.com> * Update python/amici/ode_export.py Co-authored-by: Fabian Fröhlich <fabian@schaluck.com> * Update python/amici/ode_export.py Co-authored-by: Fabian Fröhlich <fabian@schaluck.com> * Update python/amici/ode_export.py Co-authored-by: Fabian Fröhlich <fabian@schaluck.com> * Update python/amici/ode_export.py Co-authored-by: Fabian Fröhlich <fabian@schaluck.com> * Update python/amici/sbml_import.py Co-authored-by: Fabian Fröhlich <fabian@schaluck.com> * add a test for trajectories * fix sroot and test * cosmetic * add analytical expressions for sensitivities * add test for a complex condition * add test for many conditions * fix test * improve documentation * rename tests and refactor test for iterated piecewise, to check SBML piecewise logic a bit further * cleanup for code review * further cleanup * quarter way done with parsing heavisides into piecewise * fix logic parsing * monkeypatch sympy printer * enable more tests * implement denesting of piecewise * fix SBML nonsense * fix boolean triggers * simplify logic checks * fix code smells * add events to variable prototypes * cleanup * report details for skipped tests durin GHA run * better skip printing * resubstitution of non-optimized RHS into stau * add sensitivity tests * refactor tests * remove skipping display code * update test stats * Update python/amici/ode_export.py * Apply suggestions from code review Co-authored-by: Daniel Weindl <dweindl@users.noreply.github.com> * document and simplify _collect_heaviside_roots * address review comments * reduce complexity * misplaced docstrings Co-authored-by: Fabian Fröhlich <fabian@schaluck.com> Co-authored-by: dilpath <dilan.private+github@outlook.com> Co-authored-by: Daniel Weindl <dweindl@users.noreply.github.com> * restore support for species references (#1358) * restore support for species references * fixup and improve error message * extend support for sbml functions (#1357) * add more function mappings * fixup min/max * fix rem * add Mod to unsupported functions * more trigonometric functions * more functions, fix xref * fix xref with init assignment * extend unsupported functions * fix plus with empty arguments, update statistics * update test stats * fix stats * Refactor: introduce import_utils.py (#1361) * Refactor: introduce import_utils.py To collect format-independent functions for model import. * add additional file to SBML Testsuite path check * Include new module in doc Co-authored-by: Fabian Fröhlich <fabian@schaluck.com> * CI: Show all compiler warnings and treat as error (#1362) * CI: Show all compiler errors and treat as error Closes #1167 * Fix unused arguments * Fix deprecated-copy * Fix NVector (non-)const mess * Fix CMake deprecation warning * Fix doxygen * Fix some typos * Simplify / reduce number of const_casts * Add support for different noise models for PySB import (#1360) * Add support for different noise models for PySB import .. as already the case for SBML import. Closes #1176 * Respect noise model selection for PySB-PEtab import (#1339) * doc, import * Respect observable transformation for PySB-PEtab import (Fixes #1339) * Set ODEModel._has_quadratic_nllh Co-authored-by: Fabian Fröhlich <fabian@schaluck.com> * version bump * fix some code smells to trigger GHA builds again? * update docker to 20.04 * pin breathe Co-authored-by: Daniel Weindl <dweindl@users.noreply.github.com> Co-authored-by: Lorenzo Contento <lcontento@users.noreply.github.com> Co-authored-by: Paul Stapor <paul.stapor@helmholtz-muenchen.de> Co-authored-by: dilpath <dilan.private+github@outlook.com>
Piecewise functions were so far parsed into if-else-statements, which made the model files poorly readable. Much more important though, the problem was that there might have been a discontinuity in the right hand side, but the solver didn't notice this and ran over it. This could lead to poor accuracy of the solver.
However, back from Matlab times, AMICI had it's own interface for Heaviside functions. If a piecewise function gets translated into an AMICI-Heaviside function (using the existing C++ code), both problems are solved. Moreover, this implementation should be a first step into the direction of implementing evens on the Python side.
I know this is a comparably large pull-request, sorry. But there's no way to split this into smaller parts, except including substantially less functionality, which is however urgently needed...
This implementation tries to stay as close to the existing event implementation as possible. It is supposed to be working for forward sensitivities and Heaviside functions in full generality, i.e., also supporting parameter and state-dependent arguments of HEaviside functions.