pyrates.backend.fortran module

Fortran backend. Contains all fortran-based internal function definitions and links to fortran functions.

pyrates.backend.fortran.fortran_backend module

Wraps fortran such that it’s low-level functions can be used by PyRates to create and simulate a compute graph.

class pyrates.backend.fortran.fortran_backend.FortranBackend(ops: Optional[Dict[str, str]] = None, imports: Optional[List[str]] = None, **kwargs)[source]

Bases: pyrates.backend.base.base_backend.BaseBackend


Add code line string to code.

add_var_update(lhs: pyrates.backend.computegraph.ComputeVar, rhs: str, lhs_idx: Optional[str] = None, rhs_shape: Optional[tuple] = ())[source]
break_line(code: str)[source]
clear() → None[source]

Removes all layers, variables and operations from graph. Deletes build directory.

create_index_str(idx: Union[str, int, tuple], separator: str = ',', apply: bool = True, **kwargs) → Tuple[str, dict][source]
static expr_to_str(expr: str, args: tuple)[source]
generate_func(func_name: str, to_file: bool = True, func_args: tuple = (), state_vars: tuple = (), **kwargs)[source]
generate_func_head(func_name: str, state_var: str = 'y', return_var: str = 'dy', func_args: list = None, add_hist_func: bool = False)[source]
generate_func_tail(rhs_var: str = None)[source]
linebreak_end = '&'
linebreak_start = ' & '
n1 = 62
n2 = 72
register_vars(variables: list)[source]

pyrates.backend.fortran.fortran_funcs module

Contains fortran function definitions that may be used for PyRates model equations.

pyrates.backend.fortran.fortran_funcs.get_interp_def(idx: int, out_shape: Union[tuple, str] = '', dtype: str = 'real') → tuple[source]
pyrates.backend.fortran.fortran_funcs.get_sigmoid_def(idx: int, out_shape: Union[tuple, str] = '', dtype: str = 'real') → tuple[source]