Skip to content

Sympy cannot solve for t in PEtab v2 event expressions #3126

@BSnelling

Description

@BSnelling

When a DEModel Event is constructed, Sympy attempts to solve the event trigger expression for t:

try:
self._t_root = sp.solve(self.get_val(), amici_time_symbol)
except NotImplementedError:
# the trigger can't be solved for `t`
pass
)

In the case of PEtab events (as of PEtab v2) the trigger expression takes the form of a piecewise expression e.g.

Min(1/2 - _petab_preequilibration_indicator, _petab_experiment_indicator_e0 - 1/2, t - 10)

Sympy fails to solve expressions like this for $t$ with the following error:

*** NotImplementedError: 
No algorithms are implemented to solve equation Min(1/2 - _petab_preequilibration_indicator, _petab_experiment_indicator_e0 - 1/2, t - 10)

AMICI passes on this error and leaves _t_root empty. So there is no immediate error, but this means the function to check if an event has explicit trigger times does not work as expected.

def has_explicit_trigger_times(

Metadata

Metadata

Assignees

No one assigned

    Labels

    newNewly created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions