Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.23.0 #2372

Merged
merged 46 commits into from
Mar 7, 2024
Merged

Release 0.23.0 #2372

merged 46 commits into from
Mar 7, 2024

Conversation

dweindl
Copy link
Member

@dweindl dweindl commented Mar 7, 2024

No description provided.

dweindl and others added 30 commits February 26, 2024 10:52
* Refactor DEExporter/DEModel/csc_matrix

Reduce unnecessary coupling:

* `csc_matrix` as free function - removes the need for the codeprinter in DEModel
* Move the codeprinter to `DEExporter` where it's actually needed

* ..
…MICI-dev#2304)

Currently, parameters that are targets of initial assignments don't show up as parameters or expressions in the amici model.
This is rather not what most users would expect.

As a first step: treat all SBML parameters that are initial assignment targets and whose initial assignment evaluates to a number as amici parameters.

Related to AMICI-dev#2150.
Start moving functionality for amici model code generation to a private
subpackage `amici._codegen`. More to follow.
…CI-dev#2317)

Adds an implicit conversion function to SUNMatrixWrapper make things more readable.
Cache remote files for tests locally via pooch, and cache the pooch cache for GitHub actions.

Today, I had dozens of workflow failures due to rate-limiting or unavailability of biomodels. This is avoidable.
* Search for 64bit BLAS if supported by CMake.

* On apple, try accelerate if nothing else was specified.

  Use the new interface (https://developer.apple.com/documentation/accelerate/blas). Fixes AMICI-dev#2286.
Move model compilation to a free function in a separate module.
Easier to test and more reusable for recompilation after initial import.

Related to AMICI-dev#2306
* Upgrade to SuiteSparse 7.6

* Update build scripts

Closes AMICI-dev#2302
…MICI-dev#2305)

Currently, parameters that are targets of initial assignments don't show up as parameters or expressions in the amici model. This is rather not what most users would expect.

Therefore, treat all SBML parameters that are initial assignment targets and whose initial assignment does not evaluate to a number (for those that do, see AMICI-dev#2304) as amici expressions.
Those static expressions will be handled more efficiently after AMICI-dev#2303.

Related to AMICI-dev#2150.

See also AMICI-dev#2304.
`SbmlImporter` should construct a `DEModel`, instead of `DEModel` importing an `SbmlImporter`.

Will allow moving `DEModel` to a separate module. Closes AMICI-dev#2308.
Split expressions in `w` and its derivatives into dynamic (explicitly or implicitly time-dependent) and static ones.
Evaluate static ones only when needed, i.e. after (re)initializing x_rdata or parameters.

See AMICI-dev#1269
…#2323)

... to make space to move `amici.de_export.DEModel` to `amici.de_model`

Related to AMICI-dev#2306.
…MICI-dev#2321)

Move everything related to information on C++ model functions to a separate module.

Related to AMICI-dev#2306.

No changes in functionality.
Move functionality for generating the ``amici::Model`` subclass code to a separate file.

Related to AMICI-dev#2306
* Refactor de_export, extract DEModel

Move `de_export.DEModel` to `de_model`.

Closes AMICI-dev#2306. de_export is now down to 1.5K lines, from previously 4K+.
Some further cleanup would be good, but it's a start.

* ..

* ..
Previously, the wrong array was checked 🙈:

```python
amici_model.setAllStatesNonNegative()
amici_model.setStateIsNonNegative([])
amici_model.setAllStatesNonNegative()

Traceback (most recent call last):
  File "<ipython-input-22-d7056e8e4e3f>", line 1, in <module>
    amici_model.setAllStatesNonNegative()
  File "python/sdist/amici/amici.py", line 2243, in setAllStatesNonNegative
    return _amici.ModelPtr_setAllStatesNonNegative(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Dimension of input stateIsNonNegative (0) does not agree with number of state variables (2)
```
Finally works with Python3.12 without DeprecationWarnings
Previously, an exception during `ReturnData::processSimulationObjects` would result in program termination.

Fixes AMICI-dev#1882.
fixes 
```
Traceback (most recent call last):
  File "//./mnt/src/optimize.py", line 557, in <module>
    model, model_petab_problem = _model_import(
  File "/mnt/src/util.py", line 44, in _model_import
    model = amici.petab_import.import_petab_problem(
  File "/usr/local/lib/python3.10/dist-packages/amici/petab/petab_import.py", line 79, in import_petab_problem
    warn(
NameError: name 'warn' is not defined
```
* Make log messages from ReturnData available through ReturnDataView.
* Add `LogItem.__repr__`

Closes AMICI-dev#2331.
Fixes some `used without template arguments` errors when running swig with `-builtin` or `-keyword`.
Fix `python -m build -n` for generated model packages.

Fixes half of AMICI-dev#2285
Always include timepoints in NaN/Inf warnings

Closes AMICI-dev#2328


---------

Co-authored-by: Fabian Fröhlich <[email protected]>
…2350)

Current sympy master (tested: 0ededfcfc033ddca2d1d54a0eda85bf53c63761c):

```python
IPython console for SymPy 1.13.dev (Python 3.12.2-64-bit) (ground types: python)
In [1]: Float(0) == 0
Out[1]: False
In [2]: Float(0).is_zero
Out[2]: True
```
vs 1.12:
```python
Python console for SymPy 1.12 (Python 3.12.2-64-bit) (ground types: python)
>>> Float(0) == 0
True
>>> Float(0).is_zero
True
```

Therefore, replace `== 0` by `.is_zero`.

Amongst other potential issues, this fixes zeros in sparse matrices. Closes AMICI-dev#2320.
Depending on swig options/versions, swig may or may not generate type annotations. With these changes, type annotations will be extracted from the docstrings where available, independent of the swig-generated type annotations.

Closes AMICI-dev#2336.
dweindl and others added 12 commits March 6, 2024 14:25
No matter how we found the BLAS, make sure there is always BLAS::BLAS.

Closes AMICI-dev#2354
* fix venv and BLAS

* fixup

* fixup?

* Update runNotebook.sh

* revert BLAS

* remove virtualenv

* remove venv creation from installAmiciSource

* clear venv in buildInstall.sh

* cleanup

* doh

* add venv back to installAmiciSource

* readd numpy

* export python executable in source install
Evaluate initial assignments to parameters to determine whether the targets are amici parameters or expressions. Related to AMICI-dev#2304.

For example, it the initial assignment is `log(10)`, this should still be a parameter instead of an expression, but `sympy.log(10).is_Number` will be `False`.
`Solver::dky_` is always empty. Any call to `CVodeGetDky` should fail. Seems like it's never used.
…MICI-dev#2345)

During PEtab import, parameters that are targets of initial assignments have so far not been turned into constant parameters, because they didn't exist in the amici model (see AMICI-dev#2304).
Now that those parameters remain in the model, they should be turned into constant parameters, unless specified otherwise.

Requires PEtab-dev/libpetab-python#248, otherwise PEtab parameter mapping will provide potentially incorrect values for those parameters.
* Update pandas.py

* add doc + fix scales

* fix venv and BLAS

* fix tests

* revert BLAS changes

* Update scripts/installAmiciArchive.sh

---------

Co-authored-by: Daniel Weindl <[email protected]>
* Improve debugging info in ReturnData

  * Add `ReturnData::t_last` that holds the last solver timepoint (Closes AMICI-dev#2246)
  * `ReturnData::J` is now the evaluted at `t_last` instead of the last successfully reached output timepoint (Closes AMICI-dev#2334)
  * `ReturnData::xdot` is now the evaluted at `t_last` instead of the last successfully reached output timepoint

* skip xdot/J checks in case of failures
We only copy if the sizes match. Since the std::vector is not reallocated, there is no need to recreate the N_Vector.
In addition to the current `Model.setStateIsNonNegative`, this adds the option to set additional
(non)negativity/positivity constraints to be enforced by the solver.

See [CVodeSetConstraints](https://sundials.readthedocs.io/en/latest/cvode/Usage/index.html#c.CVodeSetConstraints) for details.

Related to AMICI-dev#2327.
@dweindl dweindl requested a review from a team as a code owner March 7, 2024 19:09
Copy link

codecov bot commented Mar 7, 2024

Codecov Report

Attention: Patch coverage is 39.43355% with 278 lines in your changes are missing coverage. Please review.

Project coverage is 78.47%. Comparing base (7a06016) to head (59d1d9f).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2372      +/-   ##
==========================================
+ Coverage   77.81%   78.47%   +0.66%     
==========================================
  Files         318      324       +6     
  Lines       20534    20864     +330     
  Branches     1436     1458      +22     
==========================================
+ Hits        15979    16374     +395     
+ Misses       4552     4487      -65     
  Partials        3        3              
Flag Coverage Δ
cpp 76.88% <39.43%> (+3.27%) ⬆️
cpp_python 34.23% <24.83%> (+0.22%) ⬆️
petab 36.82% <83.33%> (+0.43%) ⬆️
python 73.03% <39.43%> (+0.66%) ⬆️
sbmlsuite ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
include/amici/abstract_model.h 100.00% <ø> (ø)
include/amici/forwardproblem.h 100.00% <ø> (ø)
include/amici/model.h 73.68% <ø> (ø)
include/amici/rdata.h 100.00% <100.00%> (ø)
include/amici/serialization.h 96.78% <100.00%> (+0.17%) ⬆️
include/amici/solver.h 100.00% <100.00%> (ø)
include/amici/solver_cvodes.h 100.00% <ø> (ø)
include/amici/solver_idas.h 100.00% <ø> (ø)
include/amici/sundials_matrix_wrapper.h 76.54% <100.00%> (+0.29%) ⬆️
include/amici/vector.h 83.33% <ø> (ø)
... and 69 more

... and 3 files with indirect coverage changes

Copy link
Member

@FFroehlich FFroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, didn’t we release 0.23.0 a week ago?

dweindl and others added 2 commits March 7, 2024 21:30
* Doc: Fix headings in ExampleJax

To properly integrate into our sphinx docs.

* remove duplicated notebook
@dweindl
Copy link
Member Author

dweindl commented Mar 7, 2024

Wow, didn’t we release 0.23.0 a week ago?

Yes. That was a busy week 😅 .

@dweindl dweindl merged commit 815a50d into AMICI-dev:master Mar 7, 2024
33 of 34 checks passed
@dweindl dweindl deleted the release_0.23.0 branch March 7, 2024 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants