Source code for sbmlsim.task.task_new

"""Task module.

FIXME: add discard flag on subtask; handle via outputEndTime
TODO: use pydantic whereever possible

1. The values of all ranges are calculated before the execution of the repeated task

The order of activities within each iteration of a RepeatedTask is as follows:
- The entire model state for any involved Model is reset if specified by the resetModel
  attribute
- Any changes to the model or models specified by SetValue objects in thelistOfChanges
  are applied to each Model.

Then, for each SubTask child of the RepeatedTask, in the order specified by its order attribute:
- Any AlgorithmParameter children of the associated Simulation are applied
  (with the possible exception of the seed; see Section 2.2.7.2).
- Any SetValue children of the SubTask are applied to the relevant Model.
- The referenced Task of the SubTask is executed.
"""

from dataclasses import dataclass
from typing import List

from sbmlsim.simulation import Dimension


@dataclass
[docs]class Change: """Change."""
[docs] model: str
[docs] target: str
[docs] symbol: str
[docs] variables: List # current values
[docs] parameters: List
[docs] math: str
[docs] range: str # this is precalculated
@dataclass
[docs]class RepeatedTask: """RepeatedTask."""
[docs] range: str # dimension id
[docs] ranges: [Dimension]
[docs] reset_model: bool
[docs] concatenate: bool
@dataclass
[docs]class Task: """Task."""
[docs] model: str
[docs] simulation: str
# Fields on Timecourse # self.selections = deepcopy(selections) # self.reset = reset # self.time_offset = time_offset @dataclass
[docs]class SubTask: """Subtask."""
[docs] model: str
[docs] simulation: str
[docs] changes: List[str]
[docs] model_changes: List[str]
[docs] model_manipulations: List[str]
[docs] order: int
[docs] discard: bool = False