hypersynchronization.generate_state#

hypersynchronization.generate_state(N, kind='random', noise=0.01, seed=None, **kwargs)[source]#

Generate initial conditions for a system of N oscillators.

Parameters:
Nint

Number of oscillators in the system.

kindstr, optional

Kind of state to generate. Default is “random”.

  • “sync”: all oscillators at the same random phase,

  • “random”: uniform random phases on [0, 2pi[,

  • “splay”: evenly spaced on [0, 2pi[,

  • “k-cluster”: random k-cluster state,

  • “q-twisted”: q-twisted state.

noisefloat, optional

Level of noise to add to the initial conditions. Default is 1e-2.

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

Seed for the random number generator. Default is None.

**kwargs

Keyword arguments passed to generate_k_clusters or generate_q_twisted_state.

Returns:
thetanumpy.ndarray of shape (N,)

Initial phases for each oscillator.

Raises:
ValueError

If kind is not one of the supported options.

See also

generate_k_clusters

Generate a k-cluster state directly.

generate_q_twisted_state

Generate a q-twisted state directly.

Examples

>>> import numpy as np
>>> import hypersynchronization as hs
>>> theta = hs.generate_state(10, kind="sync", noise=0, seed=0)
>>> float(np.std(theta))
0.0
>>> theta = hs.generate_state(10, kind="q-twisted", q=2, noise=0)
>>> hs.identify_state(theta)
'2-twisted'