1.1.1.1. PyRates.pyrates.backend.base¶
1.1.1.1.1. pyrates.backend.base module¶
default PyRates backend. Contains all pyrates-internal function definitions and links to numpy functions.
1.1.1.1.2. pyrates.backend.base.base_backend module¶
Contains wrapper classes for different backends that are needed by the parser module.
A new backend needs to implement the following methods: - __init__ - run - add_var - add_op - add_layer
Currently supported backends: - Numpy: BaseBackend. - Tensorflow: TensorflowBackend. - Fortran: FortranBackend (experimental).
- class pyrates.backend.base.base_backend.BaseBackend(ops: Dict[str, str] | None = None, imports: List[str] | None = None, **kwargs)[source]¶
Bases:
CodeGen
Default backend class. Transforms all network equations into their numpy equivalents. Based on a Python code generator.
- add_var_hist(lhs: str, delay: ComputeVar | float, state_idx: str, **kwargs)[source]¶
- add_var_update(lhs: ComputeVar, rhs: str, lhs_idx: str | None = None, rhs_shape: tuple | None = ())[source]¶
- create_index_str(idx: str | int | tuple, separator: str = ',', apply: bool = True, **kwargs) Tuple[str, dict] [source]¶
- static finalize_idx_str(var: ComputeVar, idx: str)[source]¶
- generate_func_head(func_name: str, state_var: str = 'y', return_var: str = 'dy', func_args: list | None = None, add_hist_func: bool = False)[source]¶
- get_var(v: ComputeVar)[source]¶
1.1.1.1.3. pyrates.backend.base.base_funcs module¶
Contains function definitions that may be used for PyRates model equations.