# bundle (keep all keys your runner expects)
maps = {
"Balance":Balance, "Harmony":Harmony, "Honesty":Honesty,
"Respect":Respect, "Alignment":Alignment, "Compassion":Compassion,
"Beauty":Beauty, "Intelligence":Intelligence, "Wisdom":Wisdom,
"Grace":Grace, "FreeWill":FreeWill, "Coherency":Coherency,
"HarmonicBal":HarmonicBal, "BoundaryCond":BoundaryCond, "SpinIntegrity":SpinIntegrity,
"Turbulence":Turbulence, "Tails":Tails,
# raw anatomy, so CSVs plot them
"Vol":Vol, "Bias":Bias, "Surf":Surf, "Stress":Stress, "Press":Press, "Elas":Elas, "Spin":Spin,
"_state_cache": state_cache,
}
return maps
# -------- helpers --------
def grad_mag(x):
dx = 0.5 * (np.roll(x, 1, 1) - np.roll(x, -1, 1))
dy = 0.5 * (np.roll(x, 1, 0) - np.roll(x, -1, 0))
return np.sqrt(dx*dx dy*dy)
# -------- potential vs actual alignment --------
# Honesty = potential alignment (gate); use |h| for a 0..1 potential
Honesty = np.clip(np.abs(self.h), 0.0, 1.0)
# Openness factor (0..1): high when shell is open; open shells are immune to turbulence
OpenFactor = np.tanh(0.05 * Vol)
# SpinIntegrity = actual alignment, penalized by bias
# (Even with high potential, bias drags actual coherence down.)
SpinIntegrity_raw = 1.0 - (((self.a - self.a.mean(axis=2, keepdims=True))**2).mean(axis=2) /
((((self.a - self.a.mean(axis=2, keepdims=True))**2).mean(axis=2)) 0.25))
SpinIntegrity_raw = np.clip(SpinIntegrity_raw, 0.0, 1.0)
SpinIntegrity = SpinIntegrity_raw * np.exp(-np.abs(Bias))
SpinIntegrity = np.clip(SpinIntegrity, 0.0, 1.0)
# Misalignment (0..1): actual vs potential
Misalign = np.abs(SpinIntegrity - Honesty)
Misalign = np.clip(Misalign, 0.0, 1.0)
# -------- boundary conditions (bias-driven) --------
# Stronger |Bias| => tighter boundary conditions; openness grants immunity
BoundaryCond = np.abs(Bias) * (1.0 - OpenFactor)
# -------- effective stretch & harmonic balance --------
# Bias tightens the skin: add bias-driven boundary to geometric slope
lambda_bc = 1.0 # coupling strength of bias into stretch
stretch = Surf lambda_bc * BoundaryCond
HarmonicBal = 1.0 / (1.0 stretch) # live juggle quality (supersedes plain Elas)
# -------- turbulence: misaligned, biased, at edges; open shells are immune --------
EdgeBias = grad_mag(Bias) # interfaces between differently-biased neighbors
w_mis, w_bias, w_edge = 1.0, 1.0, 1.0 # relative weights
Turbulence = np.tanh(
(w_mis * Misalign) *
(w_bias * np.abs(Bias)) *
(w_edge * (EdgeBias 1e-3)) * # tiny offset keeps continuity
(1.0 - OpenFactor) # openness immunity
)
# -------- substrate relationships / fields --------
# Harmony tied directly to bias (less |Bias| => higher harmony)
k_h = 2.0
Harmony = np.exp(-k_h * np.abs(Bias))
# Respect: actual approaching potential (tonic)
Respect = 1.0 - Misalign
# Alignment (expose actual alignment plainly)
Alignment = SpinIntegrity
# Beauty: true juggle expressed (HB) while on-center (SI)
Beauty = np.clip(HarmonicBal * SpinIntegrity, 0.0, 1.0)
# Intelligence: signal / noise = centeredness over stretch
Intelligence = np.tanh(SpinIntegrity / (stretch eps))
# Grace: accumulated ease (EMA of Beauty)
g_beta = 0.02
Grace_prev = state_cache.get("Grace_prev", Beauty)
Grace = g_beta * Beauty (1.0 - g_beta) * Grace_prev
state_cache["Grace_prev"] = Grace