Source code for mercurial.atlas.maria_shoe_empirical

"""Maria's shoe (Case C.6) – remote perception of a hidden shoe using DPR."""

import matplotlib.pyplot as plt
import numpy as np

from mercurial.core.jansen_rit import JansenRitColumn, JansenRitParams
from mercurial.core.neural_field import NeuralField2D
from mercurial.simulation.engine import SimulationEngine


[docs] def run_maria_shoe(): engine = SimulationEngine(dim=20) engine.apply_empirical_parameters() # 1. Jansen‑Rit column for patient's EEG (cardiac arrest simulation) jr_params = JansenRitParams() jr_column = JansenRitColumn(jr_params=jr_params, noise_amp=0.01) eeg_vals = [] # 2. 2D neural field for visual cortex (size 32x32) nx, ny = 32, 32 visual_field = NeuralField2D(nx, ny, dx=0.5, wc_params=engine.wc_params.__dict__) # 3. Hidden shoe pattern (to be perceived remotely) # Create a pattern representing a shoe: a small oval shape X, Y = np.meshgrid(np.linspace(-2, 2, nx), np.linspace(-2, 2, ny)) shoe_pattern = np.exp(-((X - 0.3) ** 2 + (Y - 0.5) ** 2) / 0.1) + 0.8 * np.exp( -((X + 0.2) ** 2 + (Y + 0.2) ** 2) / 0.15 ) # Add a "lace" detail shoe_pattern += 0.6 * np.exp(-((X) ** 2 + (Y - 0.8) ** 2) / 0.05) dt = 0.001 t_span = (0.0, 2.0) steps = int((t_span[1] - t_span[0]) / dt) for step in range(steps): t = step * dt # Cardiac arrest: normal input before 0.5 s, then flat EEG if t < 0.5: jr_column.step(dt, p_ext=100.0) else: jr_column.step(dt, p_ext=0.0) eeg = jr_column.get_EEG() eeg_vals.append(eeg) # DPR: direct injection of shoe pattern into visual cortex during cardiac arrest if t >= 0.5: P_ext = 8.0 * shoe_pattern # strong coupling for remote perception else: P_ext = np.zeros((nx, ny)) visual_field.step(dt, P_ext=P_ext) # Correlation between final visual field and the shoe pattern final_vis = visual_field.E correlation = np.corrcoef(final_vis.flatten(), shoe_pattern.flatten())[0, 1] print(f"Correlation between final visual field and shoe pattern: {correlation:.3f}") # Plot EEG plt.figure() plt.plot(np.arange(len(eeg_vals)) * dt, eeg_vals) plt.xlabel("Time (s)") plt.ylabel("EEG (mV)") plt.title("Maria's shoe – Simulated EEG (flat after 0.5s)") plt.grid(True) plt.show() # Plot final visual field plt.figure() plt.imshow(final_vis, cmap="hot") plt.colorbar() plt.title("Final visual cortex activity (should resemble shoe)") plt.show() return correlation
if __name__ == "__main__": run_maria_shoe()