System¶
system
¶
Abstract class for Dynamic Systems.
SystemABC(f=_no_step_function)
¶
Bases: ABC
Abstract class for Dynamic Systems.
Initialize a SystemABC from a stepper function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
SystemProtocol
|
The stepper function for the system. Defaults to a function that
raises |
_no_step_function
|
Source code in src/flepimop2/system/abc.py
28 29 30 31 32 33 34 35 36 | |
step(time, state, **params)
¶
Perform a single step of the system's dynamics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
float64
|
The current time. |
required |
state
|
NDArray[float64]
|
The current state array. |
required |
**params
|
Any
|
Additional parameters for the stepper. |
{}
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The next state array after one step. |
Source code in src/flepimop2/system/abc.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
SystemProtocol
¶
Bases: Protocol
Type-definition (Protocol) for system stepper functions.
__call__(time, state, **kwargs)
¶
Protocol for system stepper functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
float64
|
The current time. |
required |
state
|
NDArray[float64]
|
The current state array. |
required |
**kwargs
|
Any
|
Additional keyword arguments for the stepper. |
{}
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The next state array after one step. |
Source code in src/flepimop2/system/protocol.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
build(config)
¶
Build a SystemABC from a configuration dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any] | SystemProtocol
|
Configuration dictionary or a SystemProtocol. In dict mode, it contains a 'module' key, it will be used to lookup the System module path. The module will have "flepimop2.system." prepended. |
required |
Returns:
| Type | Description |
|---|---|
SystemABC
|
The constructed system. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the built system is not an instance of SystemABC. |
Source code in src/flepimop2/system/abc.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
abc
¶
Abstract class for Dynamic Systems.
SystemABC(f=_no_step_function)
¶
Bases: ABC
Abstract class for Dynamic Systems.
Initialize a SystemABC from a stepper function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
SystemProtocol
|
The stepper function for the system. Defaults to a function that
raises |
_no_step_function
|
Source code in src/flepimop2/system/abc.py
28 29 30 31 32 33 34 35 36 | |
step(time, state, **params)
¶
Perform a single step of the system's dynamics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
float64
|
The current time. |
required |
state
|
NDArray[float64]
|
The current state array. |
required |
**params
|
Any
|
Additional parameters for the stepper. |
{}
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The next state array after one step. |
Source code in src/flepimop2/system/abc.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
build(config)
¶
Build a SystemABC from a configuration dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any] | SystemProtocol
|
Configuration dictionary or a SystemProtocol. In dict mode, it contains a 'module' key, it will be used to lookup the System module path. The module will have "flepimop2.system." prepended. |
required |
Returns:
| Type | Description |
|---|---|
SystemABC
|
The constructed system. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the built system is not an instance of SystemABC. |
Source code in src/flepimop2/system/abc.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
protocol
¶
Type-definition (Protocol) for system stepper functions.
SystemProtocol
¶
Bases: Protocol
Type-definition (Protocol) for system stepper functions.
__call__(time, state, **kwargs)
¶
Protocol for system stepper functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
float64
|
The current time. |
required |
state
|
NDArray[float64]
|
The current state array. |
required |
**kwargs
|
Any
|
Additional keyword arguments for the stepper. |
{}
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
The next state array after one step. |
Source code in src/flepimop2/system/protocol.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
wrapper
¶
A SystemABC which wraps a user-defined script file.
WrapperSystem(script)
¶
Bases: SystemABC
A SystemABC which wraps a user-defined script file.
Initialize a WrapperSystem from a script file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
PathLike[str]
|
Path to a script file which defines a 'stepper' function. |
required |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If the module does not have a valid 'stepper' function. |
Source code in src/flepimop2/system/wrapper.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
build(script)
¶
Build a WrapperSystem from a configuration arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
PathLike[str]
|
Path to a script file which defines a 'stepper' function. |
required |
Returns:
| Type | Description |
|---|---|
WrapperSystem
|
The constructed wrapper system instance. |
Source code in src/flepimop2/system/wrapper.py
29 30 31 32 33 34 35 36 37 38 39 | |