mercurial.core.patterns module

Informational pattern definition and operations (MERCURIAL A.3).

class mercurial.core.patterns.Constraints(equality: ~typing.List[~typing.Callable[[~numpy.ndarray], float]] = <factory>, inequality: ~typing.List[~typing.Callable[[~numpy.ndarray], float]] = <factory>)[source]

Bases: object

Constraint set C.

Methods

evaluate

violation_norm

equality: List[Callable[[ndarray], float]]
evaluate(v: ndarray) Dict[str, float][source]
inequality: List[Callable[[ndarray], float]]
violation_norm(v: ndarray) float[source]
class mercurial.core.patterns.NeuralPattern(wc: WilsonCowanPopulation, label: str = '')[source]

Bases: Pattern

Pattern defined by neural population activity (Wilson‑Cowan).

Methods

coherence()

Return synchrony measure (order parameter R if multiple populations, else 0).

complexity([measure])

Compute Λ(P).

evolve(dt, n_steps[, P_ext, Q_ext])

Evolve the neural pattern.

free_energy([temperature])

F(P) = E(P) - T * S_gen with E = constraint violation norm, S_gen from entropy module.

information_content()

Compute spectral entropy of neural activity.

level()

Return LADDER level and name for this pattern.

persistence_probability(delta_t[, k_eff])

P_persist = exp(-ΔS_gen / k_eff), with ΔS_gen ≥ 0.

set_external_inputs(P_ext, Q_ext)

Set external inputs to the Wilson‑Cowan population.

simple_gaussian(dimension[, mean, std, label])

Create a test pattern with Gaussian state variables.

get_external_inputs

update_impression

coherence() float[source]

Return synchrony measure (order parameter R if multiple populations, else 0).

evolve(dt: float, n_steps: int, P_ext: float = 0.0, Q_ext: float = 0.0)[source]

Evolve the neural pattern.

get_external_inputs()[source]
information_content() float[source]

Compute spectral entropy of neural activity.

set_external_inputs(P_ext: float, Q_ext: float)[source]

Set external inputs to the Wilson‑Cowan population. Called by the simulation engine at each step (for biasing).

class mercurial.core.patterns.Pattern(state_variables: ndarray, constraints: Constraints, stability: StabilityRegime, label: str = '', impression_intensity: float = 0.0)[source]

Bases: object

Informational pattern P = (V, C, R).

Methods

coherence()

Pattern coherence metric (0 = noisy, 1 = perfectly coherent).

complexity([measure])

Compute Λ(P).

free_energy([temperature])

F(P) = E(P) - T * S_gen with E = constraint violation norm, S_gen from entropy module.

information_content()

I(P) = -∫ ρ log₂ ρ dV.

level()

Return LADDER level and name for this pattern.

persistence_probability(delta_t[, k_eff])

P_persist = exp(-ΔS_gen / k_eff), with ΔS_gen ≥ 0.

simple_gaussian(dimension[, mean, std, label])

Create a test pattern with Gaussian state variables.

update_impression

coherence() float[source]

Pattern coherence metric (0 = noisy, 1 = perfectly coherent). Based on cross‑modal synchronization and temporal stability.

complexity(measure: ComplexityMeasure | None = None) float[source]

Compute Λ(P).

free_energy(temperature: float = 1.0) float[source]

F(P) = E(P) - T * S_gen with E = constraint violation norm, S_gen from entropy module.

information_content() float[source]

I(P) = -∫ ρ log₂ ρ dV.

level() Tuple[int, str][source]

Return LADDER level and name for this pattern.

persistence_probability(delta_t: float, k_eff: float = 1.0) float[source]

P_persist = exp(-ΔS_gen / k_eff), with ΔS_gen ≥ 0. Uses a simple entropy estimate (variance of state variables) to guarantee non‑negativity.

classmethod simple_gaussian(dimension: int, mean: float = 0.0, std: float = 1.0, label: str = '') Pattern[source]

Create a test pattern with Gaussian state variables.

update_impression(dt: float, arousal: float, event_occurred: bool, focused: bool)[source]
class mercurial.core.patterns.StabilityRegime(attractor_basin: ~typing.List[~numpy.ndarray] = <factory>, decay_rate: float = 0.001, resonance_threshold: float = 0.5, lyapunov_exponents: ~numpy.ndarray | None = None)[source]

Bases: object

Stability regime R (MERCURIAL A.3.1).

Attributes:
lyapunov_exponents

Methods

is_attractor

attractor_basin: List[ndarray]
decay_rate: float = 0.001
is_attractor(v: ndarray, tol: float = 1e-06) bool[source]
lyapunov_exponents: ndarray | None = None
resonance_threshold: float = 0.5