morphogen.automata.rules¶
Transition rules of binary cellular automata (states 0 and 1).
A rule maps the state of the lattice to the next one. Most rules depend on the number
n of neighbours in state 1 (outer-totalistic rules):
life(B.../S...)birth of a cell in state 0 when
nis in the birth set, survival of a cell in state 1 whennis in the survival set (Conway’s Game of Life isB3/S23in 2D).majoritythe cell takes the state of the majority of its neighbourhood, itself included (voting rule): sharp interfaces of positive curvature retreat.
annealtwisted majority (Vichniac 1984): the outcome is inverted when the vote is closest to a tie. Interfaces then move with their mean curvature, as in the annealing of a binary alloy: domains coarsen into bicontinuous patterns.
conservedmajority with a conserved volume fraction: the cells with the highest local density of phase 1 (random tie-breaking) take state 1, exactly as many as before. Domains coarsen at constant volume fraction (spinodal-like patterns).
probabilisticbirth and survival probabilities depending on
n.activator_inhibitorYoung’s (1984) model of Turing patterns: a cell weighs the active cells of a near disc or ball (activation) against those of a surrounding annulus or shell (inhibition); spots, stripes or labyrinths of a characteristic wavelength emerge.
- class morphogen.automata.rules.LatticeContext(offsets: ndarray, periodic: bool = True, boundary: int = 0, dims: int = 3)[source]¶
Bases:
objectNeighbourhood and boundary of the lattice on which a rule acts.
- property n_neighbours: int¶
- class morphogen.automata.rules.Rule[source]¶
Bases:
ABCTransition rule of a binary automaton.
- conserves_fraction = False¶
whether the volume fraction is conserved (synchronous updates only)
- abstractmethod next_state(state: ndarray, lattice: LatticeContext, rng: Generator) ndarray[source]¶
State after one synchronous update of every cell.
- class morphogen.automata.rules.LifeRule(birth, survival)[source]¶
Bases:
RuleOuter-totalistic rule
B<birth>/S<survival>.Counts are written as digits (
B5678/S45678) or as comma-separated numbers and ranges for 3D neighbourhoods (B13-14,17-19/S13-26).
- class morphogen.automata.rules.MajorityRule(twist: bool = False)[source]¶
Bases:
RuleMajority vote over the neighbourhood and the cell itself;
twistinverts the outcome of the two votes closest to a tie (Vichniac’s annealing rule).With an odd number of neighbours (triangles across their edges, some Penrose rhombi across their vertices), the cell’s own vote counts twice, so that the number of votes stays odd: ties keep the state of the cell.
- class morphogen.automata.rules.ConservedMajorityRule(fraction: float)[source]¶
Bases:
RuleMajority with a conserved number of cells in state 1 (
fractionof the cells): the cells of highest local density of phase 1 win, ties broken at random (the density is the fraction of phase 1 in the neighbourhood and the cell when neighbourhoods differ in size).- conserves_fraction = True¶
whether the volume fraction is conserved (synchronous updates only)
- class morphogen.automata.rules.ProbabilisticRule(p_birth, p_survival)[source]¶
Bases:
RuleBirth with probability
p_birth[n]and survival withp_survival[n](arrays indexed by the numbernof neighbours in state 1).
- class morphogen.automata.rules.ActivatorInhibitorRule(activation_radius: float, inhibition_radius: float, weight: float | None = None, fraction: float | None = None, dims: int = 3)[source]¶
Bases:
RuleYoung’s (1984) activator-inhibitor automaton.
The score of a cell is the number of active cells within
activation_radius(itself included) minusweighttimes the number of active cells at distances in (activation_radius,inhibition_radius] (Euclidean distances in cells). The cell becomes active if the score is positive, inactive if negative. With afraction, the cells of highest score are active instead (conserved volume fraction). The default weight balances the two regions (a uniform state scores 0); on tilings whose discs differ from cell to cell (Penrose), it is balanced cell by cell.- tiling_kernels(lattice: TilingContext)[source]¶
Discs (CSR, the cell included), rings (CSR) and weights on a tiling.
- morphogen.automata.rules.NAMED_RULES = {'anneal': <function <lambda>>, 'clouds': <function <lambda>>, 'life': <function <lambda>>, 'majority': <function <lambda>>}¶
Named rules.
cloudsis a 3D Moore rule known to turn noise into cave-like structures (B13-14,17-19/S13-26).