PySCeS / pysces

The official PySCeS project source code repository.
https://pysces.github.io
Other
34 stars 10 forks source link

getAllSimData and related functions return unexpected number of time points when simulations fire events #40

Closed jonrkarr closed 3 years ago

jonrkarr commented 3 years ago

When simulations fire events, PySCeS returns more than the requested number of events. This is unexpected because the documentation suggests that the results will be uniformly spaced in time. It would be helpful to make the returning of the additional time points corresponding to events an option rather than the default behavior.

jmrohwer commented 3 years ago

This is the result of Assimulo's simulate() method of the CVode class: even when specifying the number of communication points with the ncp or ncp_list arguments, additional communication points are added when the event fires. In my view there is good reason for this. For example, if an event at time t would add 2 to species S, then at that time point there are actually two values of S, and this discontinuity is captured directly.

However, there is now a setting mod.__settings__['cvode_return_event_timepoints'] that can be set to False to only return those time points as specified in mod.sim_time. The default is still True. Implemented in the "assimulo" branch with c812ccf72e, will arrive in master once this branch is merged.

jonrkarr commented 3 years ago

Thanks!