goflow.adapter.init_ivp¶
- class goflow.adapter.init_ivp.morph(construct: networkx.classes.graph.Graph, mode: str = 'default', args: tuple = <factory>)[source]¶
Bases:
object
Basic Class for simulating flow network adaption dynamics.
‘Morph’ computes the long-term network development on the basis of flow and gradient descent. The class acts as a wrapper to ensure correct pre-/post-proccessing of the network’s data and output. Utilizing the modules ‘kirchhoff’ and ‘hailhydro’ as well as goflow.models.
- Args:
construct (nx.Graph):
A network plexus, recommended to be ‘kirchhoff’ circuit or an initialized ‘hailhydro’ flow/flux. Handling for deviations only provided for standard models.
mode (string/model):
A descriptive string for selection internal model object.
args (tuple):
A parameter tuple for evaluation of the model given a plexus.
- Returns:
type: morph
- class goflow.adapter.init_ivp.morph_dynamic(construct: networkx.classes.graph.Graph, mode: str = 'default', args: tuple = <factory>)[source]¶
Bases:
goflow.adapter.init_ivp.morph
Derived class definition from morph, for specific dynamic models.
Defines explicit ODE solvers and customizable forward integration solvers.
- Args:
construct (nx.Graph):
A network plexus, recommended to be ‘kirchhoff’ circuit or an initialized ‘hailhydro’ flow/flux. Handling for deviations only provided for standard models.
mode (string/model):
A descriptive string for selection internal model object.
args (tuple):
A parameter tuple for evaluation of the model given a plexus.
- Returns:
type: morph_dynamic
- autoSolve(t_span, x0)[source]¶
Default ODE solver/wrapper for given adaptation models.
Based on methods of scipy.integrate, hence solver options are customizable via the internal model.solver_options attribute and align with scipy standards.
- Args:
t_span (tuple):
A tuple setting the linear range of values for explicit evaluation.
x0 (array):
An array of initial values to start the numeric integration of the dynamic system.
- Returns:
Iterable: Same set of return values as scipy.integrate.solve_ivp (1.7.3)
- nlogSolve(t_span, x0)[source]¶
Custom ODE solver/wrapper for given adaptation models with logarithmic evaluation timescales.
Based on methods of scipy.integrate, hence solver options are customizable via the internal model.solver_options attribute and align with scipy standards.
- Args:
t_span (tuple):
A tuple setting the logarithmic range of values for explicit evaluation.
x0 (array):
An array of initial values to start the numeric integration of the dynamic system.
- Returns:
Iterable: Same set of return values as scipy.integrate.solve_ivp (1.7.3)
- nsolve(ds_func, t_span, x0, **kwargs)[source]¶
Custom ODE solver/wrapper for given adaptation models with linear evaluation timescales and custom update function. Based on methods of scipy.integrate.
- Args:
ds_func (callable function):
The update function of the dynamic system, which is supposed to define dx/dt, according to scipy standards.
t_span (tuple):
A tuple setting the logarithmic range of values for explicit evaluation.
x0 (array):
An array of initial values to start the numeric integration of the dynamic system.
kwargs (dict):
Dictionary for setting solver options according to scipy.integrate.solve_ivp standards.
- Returns:
Iterable: Same set of return values as scipy.integrate.solve_ivp (1.7.3)
- nsolve_custom(ds_func, x0, **kwargs)[source]¶
Custom ODE solver onthe basis of Foward-Euler, for given adaptation models with custom evaluation timescales and step width and custom update function. Acts as a wrapper for nsolve_fw_euler.
- Args:
ds_func (callable function):
The update function of the dynamic system, which is supposed to
define dx/dt, according to scipy standards.
t_span (tuple):
A tuple setting the logarithmic range of values for explicit evaluation.
x0 (array):
An array of initial values to start the numeric integration of the dynamic system.
kwargs (dict):
A dictionary setting custom solver options such as number of evaluations ‘sample’, number of steps ‘num_steps’
- Returns:
Iterable: Tuple of two arrays (t, x(t))
- nsolve_fw_euler(ds_func, x0, **kwargs)[source]¶
Custom ODE solver onthe basis of Foward-Euler, for given adaptation models with custom evaluation timescales and step width and custom update function.
- Args:
ds_func (callable):
The update function of the dynamic system, which is supposed to define dx/dt, according to scipy standards.
t_span (tuple):
A tuple setting the logarithmic range of values for explicit evaluation.
x0 (array):
An array of initial values to start the numeric integration of the dynamic system.
kwargs (dict):
A dictionary setting custom solver options.
- Returns:
Iterable: Tuple of two arrays (t, x(t))
- set_integration_scale(Num_steps, sample)[source]¶
Computes the sample rate for the given dynamic system.
Given the pre-set number of computing steps and number of evaluations, Adjusts/increases the number of integration cycles such that last evaluation coincicdes with last cycle.
- Args:
Num_steps (int):
Number of integration steps to perform for a Forward-Euler scheme.
sample(int):
Number of desired function evaluations for output.
- Returns:
Iterable: Num_steps, sample_rate
- class goflow.adapter.init_ivp.proxy_solver(t_samples: list = <factory>, sol: list = <factory>)[source]¶
Bases:
object
A proxy solver class for custom numeric integration.
- Args:
tsamples (array):
Setting the internal sample time points.
sol (array):
Time series of data to be stored internally.
- Returns:
type: proxy_solver