From a7a9e4c96af19427758205bf708e6cb8fe8aacfe Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Fri, 27 Jan 2023 08:29:55 +0100 Subject: [PATCH] PySB import: Change default simplify to work with multiprocessing The lambda default argument cannot be pickled. --- python/sdist/amici/pysb_import.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/sdist/amici/pysb_import.py b/python/sdist/amici/pysb_import.py index 0648a0b478..7d969d76a3 100644 --- a/python/sdist/amici/pysb_import.py +++ b/python/sdist/amici/pysb_import.py @@ -26,7 +26,8 @@ noise_distribution_to_observable_transformation) from .logging import get_logger, log_execution_time, set_log_level from .ode_export import (Constant, Expression, LogLikelihoodY, ODEExporter, - ODEModel, Observable, Parameter, SigmaY, State) + ODEModel, Observable, Parameter, SigmaY, State, + _default_simplify) CL_Prototype = Dict[str, Dict[str, Any]] ConservationLaw = Dict[str, Union[Dict, str, sp.Basic]] @@ -46,7 +47,7 @@ def pysb2amici( compiler: str = None, compute_conservation_laws: bool = True, compile: bool = True, - simplify: Callable = lambda x: sp.powsimp(x, deep=True), + simplify: Callable = _default_simplify, # Do not enable by default without testing. # See https://github.com/AMICI-dev/AMICI/pull/1672 cache_simplify: bool = False,