hypersynchronization.generate_k_clusters#

hypersynchronization.generate_k_clusters(N, k, ps, noise=0.01, seed=None)[source]#

Generate a k-cluster state for N phase oscillators.

Parameters:
Nint

The number of oscillators.

kint

The number of clusters to generate.

psarray-like

The proportion of oscillators in each cluster. The number of elements in ps must be equal to k, and the sum of probabilities must be 1.

noisefloat, optional

The magnitude of gaussian noise added to the phases. Default is 1e-2.

seedint, numpy.random.Generator, or None, optional

Seed for the random number generator. Default is None.

Returns:
thetanumpy.ndarray of shape (N,)

Array of generated phase angles representing the initial state.

Raises:
ValueError

If len(ps) != k or if ps does not sum to 1.

See also

generate_state

Unified interface for all initial-condition types.

identify_k_clusters

Identify a k-cluster state from phases.

Examples

>>> import hypersynchronization as hs
>>> theta = hs.generate_k_clusters(10, k=2, ps=[0.5, 0.5], noise=0, seed=0)
>>> len(set(theta))
2