pyCA.stochastic module

Probabilistic elementary cellular automata beyond the Ising family.

Two ways of corrupting a deterministic rule with noise. NoisyECA applies the rule everywhere and then flips each output bit independently with probability noise — the epsilon-perturbed CAs whose phase transitions have been studied since Wolfram’s classification. AsyncECA keeps the rule exact but breaks the synchronous clock: each step, only a random fraction of the cells update, the rest holding their values. Both reduce to the deterministic pyCA.eca.ECA in the appropriate limit (noise = 0, update_fraction = 1), and the tests hold them to it.

class pyCA.stochastic.AsyncECA(rule, state=None, update_fraction=1.0, N=64, memory=None, rng=None)[source]

Bases: ECA

An ECA updated asynchronously: only a random fraction moves per step.

Each step, every cell independently chooses (with probability update_fraction) whether to apply the rule to its current neighborhood; cells that decline keep their value. The rule itself is never corrupted — only the synchronous clock is.

Parameters:
  • rule (int) – Wolfram rule number, 0-255.

  • state (array_like of 0s and 1s, optional) – Initial state. If omitted, a random state of length N is drawn.

  • update_fraction (float, optional) – Per-cell, per-step probability of updating (default 1, which is the synchronous ECA; 0 freezes the lattice).

  • N – As for pyCA.eca.ECA.

  • memory – As for pyCA.eca.ECA.

  • rng – As for pyCA.eca.ECA.

evolve()[source]

Update a random fraction of the cells; the rest stand still.

class pyCA.stochastic.NoisyECA(rule, state=None, noise=0.0, N=64, memory=None, rng=None)[source]

Bases: ECA

An ECA whose outputs are flipped independently with probability noise.

Parameters:
  • rule (int) – Wolfram rule number, 0-255.

  • state (array_like of 0s and 1s, optional) – Initial state. If omitted, a random state of length N is drawn.

  • noise (float, optional) – Per-cell, per-step probability of flipping the rule’s output (default 0). noise = 0 is the deterministic rule; noise = 1 is the complemented rule; noise = 0.5 is coin flipping, with the rule forgotten entirely.

  • N – As for pyCA.eca.ECA.

  • memory – As for pyCA.eca.ECA.

  • rng – As for pyCA.eca.ECA.

evolve()[source]

Apply the rule, then flip each output with probability noise.