1. PyRates.pyrates
Modules of the PyRates core package.
- 1.1. PyRates.pyrates.backend
- 1.1.1. pyrates.backend module
PyRatesExceptionPyRatesWarning- 1.1.1.1. PyRates.pyrates.backend.base
- 1.1.1.1.1. pyrates.backend.base module
- 1.1.1.1.2. pyrates.backend.base.base_backend module
BaseBackendBaseBackend.SUPPORTED_SOLVERSBaseBackend.SUPPORTS_EDGE_DELAY_BUFFERBaseBackend.SUPPORTS_SPARSE_JACOBIANBaseBackend.add_import()BaseBackend.add_var_hist()BaseBackend.add_var_update()BaseBackend.clear()BaseBackend.create_index_str()BaseBackend.declare_local_array_imports()BaseBackend.emit_local_array_alloc()BaseBackend.emit_local_array_assign()BaseBackend.expr_to_str()BaseBackend.finalize_idx_str()BaseBackend.generate_func()BaseBackend.generate_func_head()BaseBackend.generate_func_tail()BaseBackend.get_fname()BaseBackend.get_hist_func()BaseBackend.get_op()BaseBackend.get_var()BaseBackend.register_vars()BaseBackend.run()BaseBackend.to_file()
CodeGenDDEHistoryclear_compile_cache()
- 1.1.1.1.3. pyrates.backend.base.base_funcs module
- 1.1.1.2. PyRates.pyrates.backend.fortran
- 1.1.1.2.1. pyrates.backend.fortran module
- 1.1.1.2.2. pyrates.backend.fortran.fortran_backend module
FortranBackendFortranBackend.add_code_line()FortranBackend.add_var_update()FortranBackend.break_line()FortranBackend.clear()FortranBackend.create_index_str()FortranBackend.expr_to_str()FortranBackend.generate_func()FortranBackend.generate_func_head()FortranBackend.generate_func_tail()FortranBackend.linebreak_endFortranBackend.linebreak_startFortranBackend.n1FortranBackend.n2FortranBackend.register_vars()
- 1.1.1.2.3. pyrates.backend.fortran.fortran_funcs module
- 1.1.1.3. PyRates.pyrates.backend.julia
- 1.1.1.4. PyRates.pyrates.backend.tensorflow
- 1.1.1.5. PyRates.pyrates.backend.torch
- 1.1.2. pyrates.backend.computegraph module
ComputeGraphComputeGraph.add_op()ComputeGraph.add_var()ComputeGraph.add_var_update()ComputeGraph.clear()ComputeGraph.compile()ComputeGraph.eval_graph()ComputeGraph.eval_node()ComputeGraph.eval_nodes()ComputeGraph.eval_subgraph()ComputeGraph.get_jacobian_func()ComputeGraph.get_op()ComputeGraph.get_var()ComputeGraph.remove_subgraph()ComputeGraph.run()ComputeGraph.state_varsComputeGraph.to_func()
ComputeGraphBackPropComputeNodeComputeOpComputeVar
- 1.1.3. pyrates.backend.parser module
- 1.1.1. pyrates.backend module
- 1.2. PyRates.pyrates.ir
- 1.2.1. pyrates.ir module (intermediate representation)
- 1.2.2. pyrates.ir.abc module
- 1.2.3. pyrates.ir.circuit module
- 1.2.4. pyrates.ir.node module
- 1.2.5. pyrates.ir.edge module
- 1.2.6. pyrates.ir.operator module
- 1.2.7. pyrates.ir.operator_graph module
- 1.3. PyRates.pyrates.frontend
- 1.3.1. pyrates.frontend module
- 1.3.1.1. PyRates.pyrates.frontend.template
- 1.3.1.1.1. pyrates.frontend.template module
- 1.3.1.1.2. pyrates.frontend.template.abc module
- 1.3.1.1.3. pyrates.frontend.template.circuit module
CircuitTemplateCircuitTemplate.nodesCircuitTemplate.circuitsCircuitTemplate.edgesCircuitTemplate.__getitem__()CircuitTemplate.add_edges_from_matrix()CircuitTemplate.add_node_template()CircuitTemplate.apply()CircuitTemplate.clear()CircuitTemplate.collect_edges()CircuitTemplate.compute_graphCircuitTemplate.get_edge()CircuitTemplate.get_edges()CircuitTemplate.get_jacobian_func()CircuitTemplate.get_node_template()CircuitTemplate.get_nodes()CircuitTemplate.get_run_func()CircuitTemplate.get_var()CircuitTemplate.get_variable_positions()CircuitTemplate.intermediate_representationCircuitTemplate.run()CircuitTemplate.stateCircuitTemplate.target_irCircuitTemplate.to_yaml()CircuitTemplate.update_template()CircuitTemplate.update_var()
create_input_node()is_integration_adaptive()update_dict()update_edges()
- 1.3.1.1.4. pyrates.frontend.template.node module
- 1.3.1.1.5. pyrates.frontend.template.edge module
- 1.3.1.1.6. pyrates.frontend.template.operator module
- 1.3.1.1.7. pyrates.frontend.template.operator_graph module
- 1.3.1.2. PyRates.pyrates.frontend.fileio
- 1.3.1.1. PyRates.pyrates.frontend.template
- 1.3.2. pyrates.frontend.dict module
- 1.3.3. pyrates.frontend.file module
- 1.3.4. pyrates.frontend.utility module
- 1.3.1. pyrates.frontend module
1.4. pyrates.utility module
Functions for performing parameter grid simulations with pyrates model_templates.
- class pyrates.utility.Interactive2DParamPlot(data_map: array, data_series: DataFrame, x_values: array, y_values: array, x_key: str, y_key: str, param_map: DataFrame, tmin=0.0, title=None, **kwargs)[source]
Bases:
object- __call__(event)[source]
Try to access a column in data_series using x and y values based on cursor position
Is called on mouse button press event. Converts the current cursor coordinates inside the plot into x and y values based on the data in x_values and y_values. x and y values are used to access a column in data_series. Access of data_series can be customized in self.get_data().
- Parameters:
event –
- Returns:
- pyrates.utility.adapt_circuit(circuit: CircuitTemplate | str, params: dict, param_map: dict) CircuitTemplate[source]
Changes the parametrization of a circuit.
- Parameters:
circuit – Circuit instance.
params – Key-value pairs of the parameters that should be changed.
param_map – Map between the keys in params and the circuit variables.
- Returns:
Updated circuit instance.
- Return type:
- pyrates.utility.clear(model: CircuitTemplate, **kwargs)[source]
Function that clears all temporary files and caches that have been created via a PyRates model.
- Parameters:
model – Instance of a CircuitTemplate.
kwargs – Additional keyword arguments to be passed to clear_frontend_caches.
- pyrates.utility.clear_frontend_caches(clear_template_cache=True, clear_ir_cache=True)[source]
Utility to clear caches in the frontend.
- Parameters:
clear_template_cache – toggles whether or not to clear the template_cache that contains all previously loaded templates
clear_ir_cache – toggles whether or not to clear the cache of unique OperatorIR instances
- pyrates.utility.grid_search(circuit_template: CircuitTemplate | str, param_grid: dict | DataFrame, param_map: dict, step_size: float, simulation_time: float, outputs: dict, inputs: dict | None = None, sampling_step_size: float | None = None, permute_grid: bool = False, **kwargs) tuple[source]
Function that runs multiple parametrizations of the same circuit in parallel and returns a combined output.
- Parameters:
circuit_template – Path to the circuit template.
param_grid – Key-value pairs for each circuit parameter that should be altered over different circuit parametrizations.
param_map – Key-value pairs that map the keys of param_grid to concrete circuit variables.
step_size – Simulation step-size in s.
simulation_time – Simulation time in s.
outputs – Output variables as provided to the run method of :class:ComputeGraph.
inputs – Extrinsic inputs as provided to the run method of :class:ComputeGraph.
sampling_step_size – Sampling step-size as provided to the run method of :class:ComputeGraph.
permute_grid – If true, all combinations of the provided param_grid values will be realized. If false, the param_grid values will be traversed pairwise.
kwargs – Additional keyword arguments passed to the CircuitTemplate.run call.
- Returns:
Simulation results stored in a multi-index data frame, and the mapping between the data frame column names and the parameter grid.
- Return type:
tuple
- pyrates.utility.integrate(circuit: str | CircuitTemplate, **kwargs)[source]
Directly simulate dynamics of a circuit.
- pyrates.utility.linearize_grid(grid: dict, permute: bool = False) DataFrame[source]
Turns the grid into a grid that can be traversed linearly, i.e. pairwise.
- Parameters:
grid – Parameter grid.
permute – If true, all combinations of the parameter values in grid will be created.
- Returns:
Resulting linear grid in form of a data frame.
- Return type:
pd.DataFrame