Scheduling API¶
Schedules describe save and action times during relaxation. Prefer the modern
identifier-first form, such as every("step", 10).
at ¶
at(identifier: str, value: Any = True) -> When
Create a condition matching one exact clock value or event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
str
|
Clock key or event such as |
required |
value
|
Any
|
Exact value to match. Boolean events default to true. |
True
|
Returns:
| Type | Description |
|---|---|
When
|
Schedule condition, for example |
every ¶
every(arg1: Any, arg2: Any | None = None, first: Any = 0.0, last: Any | None = None) -> When
Create a periodic clock condition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg1
|
Any
|
Preferred clock identifier, such as |
required |
arg2
|
Any | None
|
Positive interval in clock units, or the identifier in the legacy argument order. |
None
|
first
|
Any
|
First value eligible to match. |
0.0
|
last
|
Any | None
|
Optional final eligible value; it must exceed |
None
|
Returns:
| Type | Description |
|---|---|
When
|
Periodic condition, for example |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no identifier is supplied, the interval is non-positive, or the requested range is invalid. |
Never¶
when.never is a reusable condition that never matches. It is useful when a
schedule is assembled programmatically and an action needs to be disabled.
When ¶
Combine a schedule condition with | or & operators.
Users normally create instances with :func:at and :func:every rather
than calling this constructor directly.
match_time ¶
Return whether this condition matches a simulation clock mapping.
next_time ¶
Return the next match for one clock identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
str
|
Clock key such as |
required |
this_time
|
TimeDict
|
Current clock-like mapping. |
required |
tols
|
dict[str, Any] | None
|
Optional per-identifier tolerance preventing a floating-point boundary from triggering repeatedly. |
None
|
Returns:
| Type | Description |
|---|---|
NextTime
|
Next matching value or a boolean sentinel used by schedule merging. |