_cpg_network_structure

Module Contents

Classes

Cpg

Identifies a cpg to be used in a cpg network structure.

CpgPair

A pair of CPGs that assures that the first cpg always has the lowest index.

CpgNetworkStructure

Describes the structure of a CPG network.

class Cpg

Identifies a cpg to be used in a cpg network structure.

index: int
class CpgPair(cpg_1: Cpg, cpg_2: Cpg)

A pair of CPGs that assures that the first cpg always has the lowest index.

cpg_index_lowest: Cpg
cpg_index_highest: Cpg
class CpgNetworkStructure(cpgs: list[Cpg], connections: set[CpgPair])

Describes the structure of a CPG network.

Can generate parameters for a CPG network, such as the initial state.

property num_connections: int

Get the number of connections in the structure.

Returns:

The number of connections.

property num_states: int

Get the number of states in a cpg network of this structure.

This would be twice the number of CPGs.

Returns:

The number of states.

property num_cpgs: int

Get the number of CPGs in the structure.

Returns:

The number of CPGs.

property output_indices: list[int]

Get the index in the state array for each cpg, matching the order the CPGs were provided in.

Returns:

The indices.

cpgs: list[Cpg]
connections: set[CpgPair]
static make_cpgs(num_cpgs: int) list[Cpg]

Create a list of CPGs.

Parameters:

num_cpgs – The number of CPGs to create.

Returns:

The created list of CPGs.

make_connection_weights_matrix(internal_connection_weights: dict[Cpg, float], external_connection_weights: dict[CpgPair, float]) numpy.typing.NDArray[numpy.float_]

Create a weight matrix from internal and external weights.

Parameters:
  • internal_connection_weights – The internal weights.

  • external_connection_weights – The external weights.

Returns:

The created matrix.

make_connection_weights_matrix_from_params(params: list[float]) numpy.typing.NDArray[numpy.float_]

Create a connection weights matrix from a list if connections.

Parameters:

params – The connections to create the matrix from.

Returns:

The created matrix.

make_uniform_state(value: float) numpy.typing.NDArray[numpy.float_]

Make a state array by repeating the same value.

Will match the required number of states in this structure.

Parameters:

value – The value to use for all states

Returns:

The array of states.