Utils

Utility functions and constants for the Neuroptimiser framework.

get_2d_sys(kind='sink', trA_max=1.5, detA_max=3.0, eps=1e-06) ndarray[source]

Generate a 2D dynamic system matrix based on the specified kind.

Parameters:
  • kind – Type of dynamic system (“random”, “saddle”, “attractor”, “repeller”, “source”, “sink”, or “centre”).

  • trA_max – Maximum trace value for the system matrix.

  • detA_max – Maximum determinant value for the system matrix.

  • eps – Small value to avoid division by zero or negative values.

Returns: A 2x2 numpy array representing the system matrix.

get_arch_matrix(length, topology: str = 'ring', num_neighbours: int | None = None) ndarray[source]

Generate an adjacency matrix for a given topology.

Parameters:
  • length – Number of nodes in the network.

  • topology – Type of network topology (e.g., “ring”, “fully-connected”, “random”).

  • num_neighbours – Number of neighbours for random topology (if applicable).

Returns: A square adjacency matrix representing the specified topology.

get_izhikevich_sys(kind='RS', scale=0.1) dict[source]

Get the parameters for an Izhikevich neuron model.

Parameters:
  • kind – Type of Izhikevich model (e.g., “RS”, “IB”, “CH”, “FS”, “TC”, “TCn”, “RZ”, “LTS”, or “random”).

  • scale – Scale factor for random perturbation of parameters (default is 0.1).

Returns: A dictionary containing the parameters of the Izhikevich model.

reset_all_processes(*processes) None[source]

Reset all provided processes to their initial state.

Parameters:

*processes – Variable number of process instances to reset.

Returns: None

tro2s(x: ndarray | float, lb: ndarray | float, ub: ndarray | float) ndarray | float[source]

Transform a value from the original scale to a normalized scale.

Parameters:
  • x – Value or array of values to transform.

  • lb – Lower bound of the original scale.

  • ub – Upper bound of the original scale.

Returns: Normalized value or array of values in the range [-1, 1].

trs2o(x: ndarray | float, lb: ndarray | float, ub: ndarray | float) ndarray | float[source]

Transform a value from a normalized scale back to the original scale.

Parameters:
  • x – Normalized value or array of values in the range [-1, 1].

  • lb – Lower bound of the original scale.

  • ub – Upper bound of the original scale.

Returns: Value or array of values transformed back to the original scale.