Skip to content

Commit

Permalink
Release 0.11.28
Browse files Browse the repository at this point in the history
Merge pull request #1777 from AMICI-dev/release_0.11.28
  • Loading branch information
dweindl authored Apr 8, 2022
2 parents 82abf37 + 244ebbb commit da34367
Show file tree
Hide file tree
Showing 34 changed files with 796 additions and 546 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test_petab_test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ jobs:
# retrieve test models
- name: Download and install PEtab test suite
run: |
git clone --depth 1 --branch develop https://github.com/PEtab-dev/petab_test_suite \
git clone --depth 1 --branch develop \
https://github.com/PEtab-dev/petab_test_suite \
&& source ./build/venv/bin/activate \
&& cd petab_test_suite && pip3 install -e . && cd ..
&& cd petab_test_suite && pip3 install -e .
- name: Run PEtab-related unit tests
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test_sbml_semantic_test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- python/amici/import_utils.py
- scripts/run-SBMLTestsuite.sh
- tests/testSBMLSuite.py
- tests/conftest.py
check_suite:
types: [requested]
workflow_dispatch:
Expand All @@ -25,8 +26,8 @@ jobs:
strategy:
fail-fast: false
matrix:
cases: ["1 - 250", "251 - 500", "501 - 750", "751 - 1000",
"1000-1250", "1251-1780"]
cases: ["1-250", "251-500", "501-750", "751-1000",
"1000-1250", "1251-"]
python-version: [ 3.8 ]

steps:
Expand Down
36 changes: 35 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,41 @@

## v0.X Series

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

New features:
* Added `Solver.setSteadyStateToleranceFactor` and
`Solver.setSteadyStateSensiToleranceFactor` to specify a steady state
tolerance factor by @dilpath in https://github.com/AMICI-dev/AMICI/pull/1758

**NOTE: This also relaxed the default steady state (sensitivity)**
**tolerances by a factor of 100.**
* Added support for `pathlib.Path` by @dweindl in
https://github.com/AMICI-dev/AMICI/pull/1769
* Allow specifying initial timepoint with `ExpData` by @dilpath in
https://github.com/AMICI-dev/AMICI/pull/1776

Performance:
* Speedup for models with conservation laws by @FFroehlich in
https://github.com/AMICI-dev/AMICI/pull/1765
* Improved efficiency of newton step convergence check by @FFroehlich in
https://github.com/AMICI-dev/AMICI/pull/1775

Fixes:
* Fixed deprecation warning for pandas.DataFrame.append in
`rdatas_to_measurement_df` by @dweindl in
https://github.com/AMICI-dev/AMICI/pull/1770
* Fixed Rule-target handling in PEtab import by @dweindl in
https://github.com/AMICI-dev/AMICI/pull/1753

Removed functionality:
* Removed long deprecated `sbml2amici` arguments `modelName`
and `constantParameters` by @dweindl in
https://github.com/AMICI-dev/AMICI/pull/1774

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

### v0.11.27 (2022-04-04)

New features:
Expand All @@ -24,7 +59,6 @@ Performance:
* Optional parallel computation of derivatives during model import by @dweindl
in https://github.com/AMICI-dev/AMICI/pull/1740
* Sparsify jacobian by @FFroehlich in https://github.com/AMICI-dev/AMICI/pull/1766
* Speedup for models with conservation laws by @FFroehlich in https://github.com/AMICI-dev/AMICI/pull/1765
* Speedup conservation law computation by @FFroehlich in
https://github.com/AMICI-dev/AMICI/pull/1754
* Exploit stoichiometric matrix in pysb import by @FFroehlich in
Expand Down
3 changes: 2 additions & 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 996 out of the 1780 (~56%) test cases** from
Python-AMICI currently **passes 1014 out of the 1821 (~56%) 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 Expand Up @@ -60,6 +60,7 @@ The following SBML test suite tags are currently supported
* Concentration
* ConstantSpecies
* ConversionFactors
* DefaultValue
* EventT0Firing
* HasOnlySubstanceUnits
* InitialValueReassigned
Expand Down
1 change: 1 addition & 0 deletions include/amici/edata.h
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ class ConditionContext : public ContextManager {
std::vector<realtype> original_sx0_;
std::vector<realtype> original_parameters_;
std::vector<realtype> original_fixed_parameters_;
realtype original_tstart_;
std::vector<realtype> original_timepoints_;
std::vector<int> original_parameter_list_;
std::vector<amici::ParameterScaling> original_scaling_;
Expand Down
2 changes: 2 additions & 0 deletions include/amici/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ void serialize(Archive &ar, amici::Solver &s, const unsigned int /*version*/) {
ar &s.rtol_fsa_;
ar &s.quad_atol_;
ar &s.quad_rtol_;
ar &s.ss_tol_factor_;
ar &s.ss_atol_;
ar &s.ss_rtol_;
ar &s.ss_tol_sensi_factor_;
ar &s.ss_atol_sensi_;
ar &s.ss_rtol_sensi_;
ar &s.maxsteps_;
Expand Down
67 changes: 57 additions & 10 deletions include/amici/solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace amici {
*
* NOTE: Any changes in data members here must be propagated to copy ctor,
* equality operator, serialization functions in serialization.h, and
* amici::hdf5::readSolverSettingsFromHDF5 in hdf5.cpp.
* amici::hdf5::(read/write)SolverSettings(From/To)HDF5 in hdf5.cpp.
*/
class Solver {
public:
Expand Down Expand Up @@ -384,6 +384,26 @@ class Solver {
*/
void setAbsoluteToleranceQuadratures(double atol);

/**
* @brief returns the steady state simulation tolerance factor.
*
* Steady state simulation tolerances are the product of the simulation
* tolerances and this factor, unless manually set with
* `set(Absolute/Relative)ToleranceSteadyState()`.
* @return steady state simulation tolerance factor
*/
double getSteadyStateToleranceFactor() const;

/**
* @brief set the steady state simulation tolerance factor.
*
* Steady state simulation tolerances are the product of the simulation
* tolerances and this factor, unless manually set with
* `set(Absolute/Relative)ToleranceSteadyState()`.
* @param factor tolerance factor (non-negative number)
*/
void setSteadyStateToleranceFactor(double factor);

/**
* @brief returns the relative tolerance for the steady state problem
* @return relative tolerance
Expand All @@ -408,6 +428,26 @@ class Solver {
*/
void setAbsoluteToleranceSteadyState(double atol);

/**
* @brief returns the steady state sensitivity simulation tolerance factor.
*
* Steady state sensitivity simulation tolerances are the product of the
* sensitivity simulation tolerances and this factor, unless manually set
* with `set(Absolute/Relative)ToleranceSteadyStateSensi()`.
* @return steady state simulation tolerance factor
*/
double getSteadyStateSensiToleranceFactor() const;

/**
* @brief set the steady state sensitivity simulation tolerance factor.
*
* Steady state sensitivity simulation tolerances are the product of the
* sensitivity simulation tolerances and this factor, unless manually set
* with `set(Absolute/Relative)ToleranceSteadyStateSensi()`.
* @param factor tolerance factor (non-negative number)
*/
void setSteadyStateSensiToleranceFactor(double factor);

/**
* @brief returns the relative tolerance for the sensitivities of the
* steady state problem
Expand Down Expand Up @@ -855,31 +895,32 @@ class Solver {
std::vector<int> const& getLastOrder() const {
return order_;
}

/**
* @brief Returns how convergence checks for steadystate computation are performed.
* @brief Returns how convergence checks for steadystate computation are performed. If activated,
* convergence checks are limited to every 25 steps in the simulation solver to limit performance impact.
* @return boolean flag indicating newton step (true) or the right hand side (false)
*/
bool getNewtonStepSteadyStateCheck() const {
return newton_step_steadystate_conv_;
}

/**
* @brief Returns how convergence checks for steadystate computation are performed.
* @return boolean flag indicating state and sensitivity equations (true) or only state variables (false).
*/
bool getSensiSteadyStateCheck() const {
return check_sensi_steadystate_conv_;
}

/**
* @brief Sets how convergence checks for steadystate computation are performed.
* @param flag boolean flag to pick newton step (true) or the right hand side (false, default)
*/
void setNewtonStepSteadyStateCheck(bool flag) {
newton_step_steadystate_conv_ = flag;
}

/**
* @brief Sets for which variables convergence checks for steadystate computation are performed.
* @param flag boolean flag to pick state and sensitivity equations (true, default) or only state variables (false).
Expand Down Expand Up @@ -1753,23 +1794,29 @@ class Solver {
/** relative tolerances for backward quadratures */
realtype quad_rtol_ {1e-8};

/** steady state simulation tolerance factor */
realtype ss_tol_factor_ {1e2};

/** absolute tolerances for steadystate computation */
realtype ss_atol_ {NAN};

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

/** absolute tolerances for steadystate computation */
/** steady state sensitivity simulation tolerance factor */
realtype ss_tol_sensi_factor_ {1e2};

/** absolute tolerances for steadystate sensitivity computation */
realtype ss_atol_sensi_ {NAN};

/** relative tolerances for steadystate computation */
/** relative tolerances for steadystate sensitivity computation */
realtype ss_rtol_sensi_ {NAN};

RDataReporting rdata_mode_ {RDataReporting::full};

/** whether newton step should be used for convergence steps */
bool newton_step_steadystate_conv_ {false};

/** whether sensitivities should be checked for convergence to steadystate */
bool check_sensi_steadystate_conv_ {true};

Expand Down
14 changes: 9 additions & 5 deletions python/amici/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
import os
import re
import sys
from pathlib import Path
from types import ModuleType as ModelModule
from typing import Optional
from typing import Optional, Union


def _get_amici_path():
Expand Down Expand Up @@ -127,8 +128,8 @@ def getModel(self) -> amici.Model:
class add_path:
"""Context manager for temporarily changing PYTHONPATH"""

def __init__(self, path: str):
self.path: str = path
def __init__(self, path: Union[str, Path]):
self.path: str = str(path)

def __enter__(self):
if self.path:
Expand All @@ -141,8 +142,10 @@ def __exit__(self, exc_type, exc_value, traceback):
pass


def import_model_module(module_name: str,
module_path: Optional[str] = None) -> ModelModule:
def import_model_module(
module_name: str,
module_path: Optional[Union[Path, str]] = None
) -> ModelModule:
"""
Import Python module of an AMICI model
Expand All @@ -153,6 +156,7 @@ def import_model_module(module_name: str,
:return:
The model module
"""
module_path = str(module_path)

# ensure we will find the newly created module
importlib.invalidate_caches()
Expand Down
Loading

0 comments on commit da34367

Please sign in to comment.