Skip to content

Commit da34367

Browse files
authored
Release 0.11.28
Merge pull request #1777 from AMICI-dev/release_0.11.28
2 parents 82abf37 + 244ebbb commit da34367

34 files changed

+796
-546
lines changed

.github/workflows/test_petab_test_suite.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ jobs:
6363
# retrieve test models
6464
- name: Download and install PEtab test suite
6565
run: |
66-
git clone --depth 1 --branch develop https://github.com/PEtab-dev/petab_test_suite \
66+
git clone --depth 1 --branch develop \
67+
https://github.com/PEtab-dev/petab_test_suite \
6768
&& source ./build/venv/bin/activate \
68-
&& cd petab_test_suite && pip3 install -e . && cd ..
69+
&& cd petab_test_suite && pip3 install -e .
6970
7071
- name: Run PEtab-related unit tests
7172
run: |

.github/workflows/test_sbml_semantic_test_suite.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- python/amici/import_utils.py
1414
- scripts/run-SBMLTestsuite.sh
1515
- tests/testSBMLSuite.py
16+
- tests/conftest.py
1617
check_suite:
1718
types: [requested]
1819
workflow_dispatch:
@@ -25,8 +26,8 @@ jobs:
2526
strategy:
2627
fail-fast: false
2728
matrix:
28-
cases: ["1 - 250", "251 - 500", "501 - 750", "751 - 1000",
29-
"1000-1250", "1251-1780"]
29+
cases: ["1-250", "251-500", "501-750", "751-1000",
30+
"1000-1250", "1251-"]
3031
python-version: [ 3.8 ]
3132

3233
steps:

CHANGELOG.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,41 @@
22

33
## v0.X Series
44

5+
### v0.11.28 (2022-04-08)
6+
7+
New features:
8+
* Added `Solver.setSteadyStateToleranceFactor` and
9+
`Solver.setSteadyStateSensiToleranceFactor` to specify a steady state
10+
tolerance factor by @dilpath in https://github.com/AMICI-dev/AMICI/pull/1758
11+
12+
**NOTE: This also relaxed the default steady state (sensitivity)**
13+
**tolerances by a factor of 100.**
14+
* Added support for `pathlib.Path` by @dweindl in
15+
https://github.com/AMICI-dev/AMICI/pull/1769
16+
* Allow specifying initial timepoint with `ExpData` by @dilpath in
17+
https://github.com/AMICI-dev/AMICI/pull/1776
18+
19+
Performance:
20+
* Speedup for models with conservation laws by @FFroehlich in
21+
https://github.com/AMICI-dev/AMICI/pull/1765
22+
* Improved efficiency of newton step convergence check by @FFroehlich in
23+
https://github.com/AMICI-dev/AMICI/pull/1775
24+
25+
Fixes:
26+
* Fixed deprecation warning for pandas.DataFrame.append in
27+
`rdatas_to_measurement_df` by @dweindl in
28+
https://github.com/AMICI-dev/AMICI/pull/1770
29+
* Fixed Rule-target handling in PEtab import by @dweindl in
30+
https://github.com/AMICI-dev/AMICI/pull/1753
31+
32+
Removed functionality:
33+
* Removed long deprecated `sbml2amici` arguments `modelName`
34+
and `constantParameters` by @dweindl in
35+
https://github.com/AMICI-dev/AMICI/pull/1774
36+
37+
**Full Changelog**:
38+
https://github.com/AMICI-dev/AMICI/compare/v0.11.27...v0.11.28
39+
540
### v0.11.27 (2022-04-04)
641

742
New features:
@@ -24,7 +59,6 @@ Performance:
2459
* Optional parallel computation of derivatives during model import by @dweindl
2560
in https://github.com/AMICI-dev/AMICI/pull/1740
2661
* Sparsify jacobian by @FFroehlich in https://github.com/AMICI-dev/AMICI/pull/1766
27-
* Speedup for models with conservation laws by @FFroehlich in https://github.com/AMICI-dev/AMICI/pull/1765
2862
* Speedup conservation law computation by @FFroehlich in
2963
https://github.com/AMICI-dev/AMICI/pull/1754
3064
* Exploit stoichiometric matrix in pysb import by @FFroehlich in

documentation/python_interface.rst

Lines changed: 2 additions & 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 996 out of the 1780 (~56%) test cases** from
29+
Python-AMICI currently **passes 1014 out of the 1821 (~56%) 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>`_).
@@ -60,6 +60,7 @@ The following SBML test suite tags are currently supported
6060
* Concentration
6161
* ConstantSpecies
6262
* ConversionFactors
63+
* DefaultValue
6364
* EventT0Firing
6465
* HasOnlySubstanceUnits
6566
* InitialValueReassigned

include/amici/edata.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ class ConditionContext : public ContextManager {
519519
std::vector<realtype> original_sx0_;
520520
std::vector<realtype> original_parameters_;
521521
std::vector<realtype> original_fixed_parameters_;
522+
realtype original_tstart_;
522523
std::vector<realtype> original_timepoints_;
523524
std::vector<int> original_parameter_list_;
524525
std::vector<amici::ParameterScaling> original_scaling_;

include/amici/serialization.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ void serialize(Archive &ar, amici::Solver &s, const unsigned int /*version*/) {
6262
ar &s.rtol_fsa_;
6363
ar &s.quad_atol_;
6464
ar &s.quad_rtol_;
65+
ar &s.ss_tol_factor_;
6566
ar &s.ss_atol_;
6667
ar &s.ss_rtol_;
68+
ar &s.ss_tol_sensi_factor_;
6769
ar &s.ss_atol_sensi_;
6870
ar &s.ss_rtol_sensi_;
6971
ar &s.maxsteps_;

include/amici/solver.h

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace amici {
4444
*
4545
* NOTE: Any changes in data members here must be propagated to copy ctor,
4646
* equality operator, serialization functions in serialization.h, and
47-
* amici::hdf5::readSolverSettingsFromHDF5 in hdf5.cpp.
47+
* amici::hdf5::(read/write)SolverSettings(From/To)HDF5 in hdf5.cpp.
4848
*/
4949
class Solver {
5050
public:
@@ -384,6 +384,26 @@ class Solver {
384384
*/
385385
void setAbsoluteToleranceQuadratures(double atol);
386386

387+
/**
388+
* @brief returns the steady state simulation tolerance factor.
389+
*
390+
* Steady state simulation tolerances are the product of the simulation
391+
* tolerances and this factor, unless manually set with
392+
* `set(Absolute/Relative)ToleranceSteadyState()`.
393+
* @return steady state simulation tolerance factor
394+
*/
395+
double getSteadyStateToleranceFactor() const;
396+
397+
/**
398+
* @brief set the steady state simulation tolerance factor.
399+
*
400+
* Steady state simulation tolerances are the product of the simulation
401+
* tolerances and this factor, unless manually set with
402+
* `set(Absolute/Relative)ToleranceSteadyState()`.
403+
* @param factor tolerance factor (non-negative number)
404+
*/
405+
void setSteadyStateToleranceFactor(double factor);
406+
387407
/**
388408
* @brief returns the relative tolerance for the steady state problem
389409
* @return relative tolerance
@@ -408,6 +428,26 @@ class Solver {
408428
*/
409429
void setAbsoluteToleranceSteadyState(double atol);
410430

431+
/**
432+
* @brief returns the steady state sensitivity simulation tolerance factor.
433+
*
434+
* Steady state sensitivity simulation tolerances are the product of the
435+
* sensitivity simulation tolerances and this factor, unless manually set
436+
* with `set(Absolute/Relative)ToleranceSteadyStateSensi()`.
437+
* @return steady state simulation tolerance factor
438+
*/
439+
double getSteadyStateSensiToleranceFactor() const;
440+
441+
/**
442+
* @brief set the steady state sensitivity simulation tolerance factor.
443+
*
444+
* Steady state sensitivity simulation tolerances are the product of the
445+
* sensitivity simulation tolerances and this factor, unless manually set
446+
* with `set(Absolute/Relative)ToleranceSteadyStateSensi()`.
447+
* @param factor tolerance factor (non-negative number)
448+
*/
449+
void setSteadyStateSensiToleranceFactor(double factor);
450+
411451
/**
412452
* @brief returns the relative tolerance for the sensitivities of the
413453
* steady state problem
@@ -855,31 +895,32 @@ class Solver {
855895
std::vector<int> const& getLastOrder() const {
856896
return order_;
857897
}
858-
898+
859899
/**
860-
* @brief Returns how convergence checks for steadystate computation are performed.
900+
* @brief Returns how convergence checks for steadystate computation are performed. If activated,
901+
* convergence checks are limited to every 25 steps in the simulation solver to limit performance impact.
861902
* @return boolean flag indicating newton step (true) or the right hand side (false)
862903
*/
863904
bool getNewtonStepSteadyStateCheck() const {
864905
return newton_step_steadystate_conv_;
865906
}
866-
907+
867908
/**
868909
* @brief Returns how convergence checks for steadystate computation are performed.
869910
* @return boolean flag indicating state and sensitivity equations (true) or only state variables (false).
870911
*/
871912
bool getSensiSteadyStateCheck() const {
872913
return check_sensi_steadystate_conv_;
873914
}
874-
915+
875916
/**
876917
* @brief Sets how convergence checks for steadystate computation are performed.
877918
* @param flag boolean flag to pick newton step (true) or the right hand side (false, default)
878919
*/
879920
void setNewtonStepSteadyStateCheck(bool flag) {
880921
newton_step_steadystate_conv_ = flag;
881922
}
882-
923+
883924
/**
884925
* @brief Sets for which variables convergence checks for steadystate computation are performed.
885926
* @param flag boolean flag to pick state and sensitivity equations (true, default) or only state variables (false).
@@ -1753,23 +1794,29 @@ class Solver {
17531794
/** relative tolerances for backward quadratures */
17541795
realtype quad_rtol_ {1e-8};
17551796

1797+
/** steady state simulation tolerance factor */
1798+
realtype ss_tol_factor_ {1e2};
1799+
17561800
/** absolute tolerances for steadystate computation */
17571801
realtype ss_atol_ {NAN};
17581802

17591803
/** relative tolerances for steadystate computation */
17601804
realtype ss_rtol_ {NAN};
17611805

1762-
/** absolute tolerances for steadystate computation */
1806+
/** steady state sensitivity simulation tolerance factor */
1807+
realtype ss_tol_sensi_factor_ {1e2};
1808+
1809+
/** absolute tolerances for steadystate sensitivity computation */
17631810
realtype ss_atol_sensi_ {NAN};
17641811

1765-
/** relative tolerances for steadystate computation */
1812+
/** relative tolerances for steadystate sensitivity computation */
17661813
realtype ss_rtol_sensi_ {NAN};
17671814

17681815
RDataReporting rdata_mode_ {RDataReporting::full};
1769-
1816+
17701817
/** whether newton step should be used for convergence steps */
17711818
bool newton_step_steadystate_conv_ {false};
1772-
1819+
17731820
/** whether sensitivities should be checked for convergence to steadystate */
17741821
bool check_sensi_steadystate_conv_ {true};
17751822

python/amici/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
import os
2525
import re
2626
import sys
27+
from pathlib import Path
2728
from types import ModuleType as ModelModule
28-
from typing import Optional
29+
from typing import Optional, Union
2930

3031

3132
def _get_amici_path():
@@ -127,8 +128,8 @@ def getModel(self) -> amici.Model:
127128
class add_path:
128129
"""Context manager for temporarily changing PYTHONPATH"""
129130

130-
def __init__(self, path: str):
131-
self.path: str = path
131+
def __init__(self, path: Union[str, Path]):
132+
self.path: str = str(path)
132133

133134
def __enter__(self):
134135
if self.path:
@@ -141,8 +142,10 @@ def __exit__(self, exc_type, exc_value, traceback):
141142
pass
142143

143144

144-
def import_model_module(module_name: str,
145-
module_path: Optional[str] = None) -> ModelModule:
145+
def import_model_module(
146+
module_name: str,
147+
module_path: Optional[Union[Path, str]] = None
148+
) -> ModelModule:
146149
"""
147150
Import Python module of an AMICI model
148151
@@ -153,6 +156,7 @@ def import_model_module(module_name: str,
153156
:return:
154157
The model module
155158
"""
159+
module_path = str(module_path)
156160

157161
# ensure we will find the newly created module
158162
importlib.invalidate_caches()

0 commit comments

Comments
 (0)