|
26 | 26 | from sympy.logic.boolalg import Boolean, BooleanFalse, BooleanTrue |
27 | 27 | from sympy.matrices.dense import MutableDenseMatrix |
28 | 28 |
|
| 29 | +import amici |
| 30 | + |
29 | 31 | from . import has_clibs |
30 | 32 | from .constants import SymbolId |
31 | 33 | from .de_export import ( |
@@ -290,7 +292,7 @@ def sbml2amici( |
290 | 292 | cache_simplify: bool = False, |
291 | 293 | generate_sensitivity_code: bool = True, |
292 | 294 | hardcode_symbols: Sequence[str] = None, |
293 | | - ) -> None: |
| 295 | + ) -> amici.Model | None: |
294 | 296 | """ |
295 | 297 | Generate and compile AMICI C++ files for the model provided to the |
296 | 298 | constructor. |
@@ -379,6 +381,10 @@ def sbml2amici( |
379 | 381 | Their values cannot be changed anymore after model import. |
380 | 382 | Currently, only parameters that are not targets of rules or |
381 | 383 | initial assignments are supported. |
| 384 | +
|
| 385 | + :return: |
| 386 | + If `compile` is `True` and compilation was successful, an instance |
| 387 | + of the generated model class, otherwise `None`. |
382 | 388 | """ |
383 | 389 | set_log_level(logger, verbose) |
384 | 390 |
|
@@ -413,6 +419,14 @@ def sbml2amici( |
413 | 419 | ) |
414 | 420 | exporter.compile_model() |
415 | 421 |
|
| 422 | + from . import import_model_module |
| 423 | + |
| 424 | + return import_model_module( |
| 425 | + module_name=model_name, module_path=output_dir |
| 426 | + ).get_model() |
| 427 | + |
| 428 | + return None |
| 429 | + |
416 | 430 | def sbml2jax( |
417 | 431 | self, |
418 | 432 | model_name: str, |
|
0 commit comments