{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Research Stack Manifold Visualizer\n", "\n", "Interactive visualization of PIST/SVQF/FAMM quaternion manifold structures.\n", "\n", "**Layers:**\n", "1. PIST shell generation (integer-based coordinates)\n", "2. Quaternion sieve (counter-rotation band-pass)\n", "3. FAMM frustration pruning (stress tensor filtering)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from mpl_toolkits.mplot3d import Axes3D\n", "import sys\n", "from pathlib import Path\n", "\n", "sys.path.insert(0, str(Path(\"/home/allaun/Documents/Research Stack/5-Applications/scripts\")))\n", "from manifold_visualizer import ManifoldMapper, QuaternionField" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Generate Manifold" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mapper = ManifoldMapper(resolution=32)\n", "result = mapper.map_manifold()\n", "print(f\"Survivors: {result['post_famm']} / {result['total_points']}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Visualize S³ Stereographic Projection" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig = plt.figure(figsize=(12, 5))\n", "\n", "# Raw shell points\n", "ax1 = fig.add_subplot(121, projection='3d')\n", "raw_pts = np.array(result['sample_points'][:50])\n", "# Stereographic projection\n", "x = raw_pts[:, 1] / (1 - raw_pts[:, 0] + 1e-10)\n", "y = raw_pts[:, 2] / (1 - raw_pts[:, 0] + 1e-10)\n", "z = raw_pts[:, 3] / (1 - raw_pts[:, 0] + 1e-10)\n", "ax1.scatter(x, y, z, c='blue', alpha=0.6, s=20)\n", "ax1.set_title('S³ Manifold (Stereographic)')\n", "\n", "# Quaternion phase space\n", "ax2 = fig.add_subplot(122, projection='3d')\n", "ax2.scatter(raw_pts[:, 0], raw_pts[:, 1], raw_pts[:, 2], c='red', alpha=0.6, s=20)\n", "ax2.set_title('Quaternion Components (w,x,y)')\n", "\n", "plt.tight_layout()\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Frustration Heatmap" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Simulate frustration across k-t grid\n", "resolution = 32\n", "frustration_map = np.zeros((resolution, resolution//2))\n", "\n", "for k in range(resolution):\n", " for t in range(resolution//2):\n", " mass = (k+1)*(t+1)\n", " theta = 2 * np.pi * k / resolution\n", " phi = np.pi * t / resolution\n", " # Approximate frustration from curvature\n", " frustration_map[k, t] = np.abs(np.sin(theta*2) * np.cos(phi*3))\n", "\n", "plt.figure(figsize=(10, 4))\n", "plt.imshow(frustration_map.T, aspect='auto', cmap='hot', origin='lower')\n", "plt.colorbar(label='Φ (frustration)')\n", "plt.xlabel('k (shell index)')\n", "plt.ylabel('t (time step)')\n", "plt.title('FAMM Frustration Heatmap — Φ > 1 regions pruned')\n", "plt.axhline(y=resolution//4, color='cyan', linestyle='--', label='φ = 1 threshold')\n", "plt.legend()\n", "plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.10.0" } }, "nbformat": 4, "nbformat_minor": 4 }