From b8eb41e854e3024fd5b7744e341c74644619b44d Mon Sep 17 00:00:00 2001 From: Sir-Ripley <31619989+Sir-Ripley@users.noreply.github.com> Date: Sat, 14 Mar 2026 17:54:14 +0000 Subject: [PATCH] chore: consolidate duplicate function definitions in QAG_VerifiedNexus.ipynb Consolidated 'neo_verification', 'cehtr_resolver', and 'aa_resolver' functions into a single cell (cell 13) to improve maintainability and resolve code health issues. The new definitions support both direct printing for standalone execution and returning report strings for the Visualization & Reporting Engine (VRE). Redundant definitions and imports have been removed from later cells, and shared resources like 'output_portal' are now handled consistently. --- QAG_VerifiedNexus.ipynb | 477 +--------------------------------------- 1 file changed, 1 insertion(+), 476 deletions(-) diff --git a/QAG_VerifiedNexus.ipynb b/QAG_VerifiedNexus.ipynb index daf9600..20cfebe 100644 --- a/QAG_VerifiedNexus.ipynb +++ b/QAG_VerifiedNexus.ipynb @@ -1396,164 +1396,7 @@ "id": "04f7012a" }, "source": [ - "import numpy as np\n", - "import matplotlib.pyplot as plt\n", - "from mpl_toolkits.mplot3d import Axes3D\n", - "from scipy.integrate import solve_ivp\n", - "import requests\n", - "import math\n", - "from datetime import datetime\n", - "import os\n", - "\n", - "# --- ODICE Module: Near-Earth Object (NEO) Verification ---\n", - "def neo_verification():\n", - " NASA_API_URL = \"https://api.nasa.gov/neo/rest/v1/feed\"\n", - " API_KEY = \"DEMO_KEY\" # Using DEMO_KEY as per the original notebook\n", - " today = datetime.today().strftime('%Y-%m-%d')\n", - "\n", - " print(\"\\n--- NEO Verification Module: NASA Local Shield Verification ---\")\n", - " try:\n", - " response = requests.get(NASA_API_URL, params={'start_date': today, 'end_date': today, 'api_key': API_KEY})\n", - " response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx)\n", - " data = response.json()['near_earth_objects'][today]\n", - "\n", - " for asteroid in data[:3]: # Limiting to 3 for brevity, as in original notebook\n", - " name = asteroid['name']\n", - " # Ensure speed and distance are floats\n", - " speed_km_s = float(asteroid['close_approach_data'][0]['relative_velocity']['kilometers_per_second'])\n", - " dist_km = float(asteroid['close_approach_data'][0]['miss_distance']['kilometers'])\n", - "\n", - " # Apply QAG shielding model\n", - " r_scaled = dist_km / 1e8 # Scaling as done in the original 'display_nasa_comparison'\n", - " shielding = 1.0 - math.exp(-r_scaled * 1000.0)\n", - " qag_variance = 2.0 * (math.exp(-15.0 * r_scaled) / (r_scaled + 0.0001)) * shielding\n", - " qag_speed = speed_km_s + (qag_variance * 1e-12)\n", - "\n", - " # Print comparison\n", - " print(f\"\\nObject: {name} | Dist: {dist_km:,.0f} km\")\n", - " print(f\"NASA Observed Speed: {speed_km_s:.8f} km/s\")\n", - " print(f\"QAG Shielded Speed: {qag_speed:.8f} km/s\")\n", - "\n", - " print(\"\\nSTATUS: LOCAL SHIELD ACTIVE. 100% Data Fidelity Verified.\")\n", - " except requests.exceptions.RequestException as e:\n", - " print(f\"Network or API error: {e}\")\n", - " except KeyError as e:\n", - " print(f\"Error parsing NASA API response: Missing key {e}. Check API data structure.\")\n", - " except Exception as e:\n", - " print(f\"An unexpected error occurred: {e}\")\n", - "\n", - "\n", - "# --- ODICE Module: Cosmic Expansion & Hubble Tension Resolver (CEHTR) ---\n", - "def cehtr_resolver(plot_results=True, save_only=False):\n", - " if not save_only: # Only print this if not in save_only mode\n", - " print(\"\\n--- CEHTR Module: Cosmic Expansion & Hubble Tension Resolution ---\")\n", - " Omega_m, Omega_L, affinity_base = 0.3, 0.7, 0.75 # Parameters from original notebook\n", - "\n", - " # Friedmann equations models\n", - " def standard_friedmann(t, y):\n", - " return [y[1], y[0] * Omega_L - (Omega_m / 2) / (y[0]**2)]\n", - "\n", - " def qag_friedmann(t, y):\n", - " return [y[1], y[0] * (affinity_base * np.exp(-t/10)) - (Omega_m / 2) / (y[0]**2)]\n", - "\n", - "\n", - " t_span = (0.1, 14) # Time span for integration\n", - " t_eval = np.linspace(t_span[0], t_span[1], 500) # Points at which to store the computed solution\n", - " initial_conditions = [0.01, 1.0] # [a(t_start), da/dt(t_start)] - initial scale factor and its derivative\n", - "\n", - " # Solve for Standard Model\n", - " sol_std = solve_ivp(standard_friedmann, t_span, initial_conditions, t_eval=t_eval, rtol=1e-6, atol=1e-8)\n", - " # Solve for QAG Model\n", - " sol_qag = solve_ivp(qag_friedmann, t_span, initial_conditions, t_eval=t_eval, rtol=1e-6, atol=1e-8)\n", - "\n", - " if plot_results or save_only:\n", - " plt.style.use('dark_background')\n", - " fig, (ax_expansion, ax_phase) = plt.subplots(1, 2, figsize=(14, 6))\n", - " fig.suptitle('Cosmic Expansion & Hubble Tension Resolution (CEHTR)', color='cyan', fontsize=16)\n", - "\n", - " # Plotting AVI Cosmic Expansion\n", - " ax_expansion.plot(sol_std.t, sol_std.y[0], 'm--', label='Standard Model (Dark Energy)')\n", - " ax_expansion.plot(sol_qag.t, sol_qag.y[0], 'c-', linewidth=3, label='QAG (Vacuum Relaxation)')\n", - " ax_expansion.set_title(\"AVI Cosmic Expansion\", color='cyan')\n", - " ax_expansion.set_xlabel(\"Cosmic Time (arbitrary units)\")\n", - " ax_expansion.set_ylabel(\"Scale Factor (a)\")\n", - " ax_expansion.legend()\n", - " ax_expansion.grid(True, linestyle=':', alpha=0.6)\n", - "\n", - " # Plotting 3D Phase Space (Scale Factor vs its derivative vs Time)\n", - " ax_phase = fig.add_subplot(122, projection='3d') # Redefine for 3D plot within the same figure\n", - " ax_phase.plot(sol_std.y[0], sol_std.y[1], sol_std.t, 'm--', alpha=0.5, label='Standard Model')\n", - " ax_phase.plot(sol_qag.y[0], sol_qag.y[1], sol_qag.t, 'cyan', linewidth=3, label='QAG Model')\n", - " ax_phase.set_title(\"Phase Space: Scale Factor, Rate, Time\", color='cyan')\n", - " ax_phase.set_xlabel(\"Scale Factor (a)\")\n", - " ax_phase.set_ylabel(\"Rate of Scale Factor (da/dt)\")\n", - " ax_phase.set_zlabel(\"Cosmic Time\")\n", - " ax_phase.legend()\n", - "\n", - " plt.tight_layout()\n", - "\n", - " if save_only:\n", - " fig.savefig('QAG_CEHTR_Expansion.png', dpi=300, bbox_inches='tight')\n", - " plt.close(fig) # Close the figure to prevent it from displaying\n", - " print(\"CEHTR plots saved as 'QAG_CEHTR_Expansion.png'.\")\n", - " elif plot_results:\n", - " plt.show()\n", - "\n", - " if not save_only:\n", - " print(\"CEHTR Resolution: QAG model offers a 'Zero Dark Energy' explanation, resolving Hubble Tension.\")\n", - "\n", - "\n", - "# --- ODICE Module: Astrophysical Anomaly (AA) Resolver (Bullet Cluster) ---\n", - "def aa_resolver(plot_results=True):\n", - " print(\"\\n--- AA Resolver Module: Bullet Cluster Phenomenon ---\")\n", - " X, Y = np.meshgrid(np.linspace(-2.0, 2.0, 400), np.linspace(-2.0, 2.0, 400))\n", - "\n", - " def qag_lens(xc, yc, spread, alpha, m):\n", - " r = np.sqrt((X - xc)**2 + (Y - yc)**2)\n", - " r[r == 0] = 0.01 # Avoid division by zero\n", - " # The original notebook had: alpha * (np.exp(-m * r) / r) * np.exp(-(r**2) / spread)\n", - " # Let's use this direct implementation as it was used for QAG in the notebook.\n", - " return alpha * (np.exp(-m * r) / r) * np.exp(-(r**2) / spread)\n", - "\n", - " # Model baryonic gas distribution (two main clumps as in Bullet Cluster)\n", - " gas = (1.0 * np.exp(-((X + 0.3)**2 + Y**2) / 0.15)) + \\\n", - " (0.6 * np.exp(-((X - 0.4)**2 + Y**2) / 0.08))\n", - "\n", - " # Apply QAG lensing model to generate 'QAG affinity peaks'\n", - " # These peaks represent where QAG would concentrate effective mass for lensing\n", - " qag_affinity_peaks = qag_lens(-0.7, 0.0, 0.5, 2.5, 1.5) + \\\n", - " qag_lens(0.8, 0.0, 0.3, 1.8, 1.5)\n", - "\n", - " if plot_results:\n", - " plt.style.use('dark_background')\n", - " fig, ax = plt.subplots(figsize=(10, 6))\n", - "\n", - " # Visualize baryonic gas distribution\n", - " gas_contour = ax.contourf(X, Y, gas, levels=30, cmap='magma', alpha=0.6)\n", - " plt.colorbar(gas_contour, ax=ax, label='Baryonic Gas Density')\n", - "\n", - " # Visualize QAG affinity peaks\n", - " qag_contour = ax.contour(X, Y, qag_affinity_peaks, levels=15, colors='cyan', alpha=0.8)\n", - " # Add 'legend' for contour lines if possible, or just the points\n", - "\n", - " # Add markers for visual clarity, similar to the original notebook\n", - " ax.plot([-0.3], [0.0], 'ro', markersize=8, label='Baryonic Gas (Clump 1 Peak)')\n", - " ax.plot([0.4], [0.0], 'ro', markersize=8, label='Baryonic Gas (Clump 2 Peak)') # Adjusted from original to be clearer\n", - " ax.plot([-0.7], [0.0], 'co', markersize=8, label='QAG Affinity Peak 1')\n", - " ax.plot([0.8], [0.0], 'co', markersize=8, label='QAG Affinity Peak 2')\n", - "\n", - " ax.set_title('Bullet Cluster: QAG Retrofit vs NASA Lensing', color='cyan')\n", - " ax.set_xlabel('X-coordinate')\n", - " ax.set_ylabel('Y-coordinate')\n", - " ax.set_aspect('equal', adjustable='box')\n", - " ax.legend(loc='upper right')\n", - " fig.text(0.98, 0.02, '© Sir-Ripley | AIsync | QAG UFT', color='white', alpha=0.5, ha='right', va='bottom', fontsize=9)\n", - "\n", - " plt.show()\n", - "\n", - " print(\"AA Resolution: QAG model explains Bullet Cluster lensing without dark matter, via affinity peaks.\")\n", - "\n", - "print(\"ODICE module functions defined: neo_verification, cehtr_resolver, aa_resolver\")" + "import numpy as np\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\nfrom scipy.integrate import solve_ivp\nimport requests\nimport math\nfrom datetime import datetime\nimport os\nimport ipywidgets as widgets\nfrom IPython.display import clear_output\n\n# Create the output portal for visuals (shared across the notebook)\nif 'output_portal' not in globals():\n output_portal = widgets.Output()\n\n# --- ODICE Module: Consolidated Functions ---\ndef neo_verification():\n NASA_API_URL = \"https://api.nasa.gov/neo/rest/v1/feed\"\n API_KEY = \"DEMO_KEY\"\n today = datetime.today().strftime('%Y-%m-%d')\n report_lines = [\"--- NEO Verification Module: NASA Local Shield Verification ---\"]\n try:\n response = requests.get(NASA_API_URL, params={'start_date': today, 'end_date': today, 'api_key': API_KEY})\n response.raise_for_status()\n data = response.json()['near_earth_objects'][today]\n\n for asteroid in data[:3]:\n name = asteroid['name']\n speed_km_s = float(asteroid['close_approach_data'][0]['relative_velocity']['kilometers_per_second'])\n dist_km = float(asteroid['close_approach_data'][0]['miss_distance']['kilometers'])\n\n r_scaled = dist_km / 1e8\n shielding = 1.0 - math.exp(-r_scaled * 1000.0)\n qag_variance = 2.0 * (math.exp(-15.0 * r_scaled) / (r_scaled + 0.0001)) * shielding\n qag_speed = speed_km_s + (qag_variance * 1e-12)\n\n report_lines.append(f\"\\nObject: {name} | Dist: {dist_km:,.0f} km\")\n report_lines.append(f\"NASA Observed Speed: {speed_km_s:.8f} km/s\")\n report_lines.append(f\"QAG Shielded Speed: {qag_speed:.8f} km/s\")\n report_lines.append(\"\\nSTATUS: LOCAL SHIELD ACTIVE. 100% Data Fidelity Verified.\")\n except requests.exceptions.RequestException as e:\n report_lines.append(f\"Network or API error: {e}\")\n except KeyError as e:\n report_lines.append(f\"Error parsing NASA API response: Missing key {e}. Check API data structure.\")\n except Exception as e:\n report_lines.append(f\"An unexpected error occurred: {e}\")\n \n report_str = \"\\n\".join(report_lines)\n print(report_str)\n return report_str\n\ndef cehtr_resolver(plot_results=True, save_only=False):\n report_lines = [\"--- CEHTR Module: Cosmic Expansion & Hubble Tension Resolution ---\"]\n if not save_only:\n print(\"\\n--- CEHTR Module: Cosmic Expansion & Hubble Tension Resolution ---\")\n Omega_m, Omega_L, affinity_base = 0.3, 0.7, 0.75\n\n def standard_friedmann(t, y): return [y[1], y[0] * Omega_L - (Omega_m / 2) / (y[0]**2)]\n def qag_friedmann(t, y): return [y[1], y[0] * (affinity_base * np.exp(-t/10)) - (Omega_m / 2) / (y[0]**2)]\n\n t_span = (0.1, 14)\n t_eval = np.linspace(t_span[0], t_span[1], 500)\n initial_conditions = [0.01, 1.0]\n\n sol_std = solve_ivp(standard_friedmann, t_span, initial_conditions, t_eval=t_eval, rtol=1e-6, atol=1e-8)\n sol_qag = solve_ivp(qag_friedmann, t_span, initial_conditions, t_eval=t_eval, rtol=1e-6, atol=1e-8)\n\n if plot_results or save_only:\n plt.style.use('dark_background')\n fig, (ax_expansion, ax_phase) = plt.subplots(1, 2, figsize=(14, 6))\n fig.suptitle('Cosmic Expansion & Hubble Tension Resolution (CEHTR)', color='cyan', fontsize=16)\n ax_expansion.plot(sol_std.t, sol_std.y[0], 'm--', label='Standard Model (Dark Energy)')\n ax_expansion.plot(sol_qag.t, sol_qag.y[0], 'c-', linewidth=3, label='QAG (Vacuum Relaxation)')\n ax_expansion.set_title(\"AVI Cosmic Expansion\", color='cyan')\n ax_expansion.set_xlabel(\"Cosmic Time (arbitrary units)\")\n ax_expansion.set_ylabel(\"Scale Factor (a)\")\n ax_expansion.legend()\n ax_expansion.grid(True, linestyle=':', alpha=0.6)\n ax_phase = fig.add_subplot(122, projection='3d')\n ax_phase.plot(sol_std.y[0], sol_std.y[1], sol_std.t, 'm--', alpha=0.5, label='Standard Model')\n ax_phase.plot(sol_qag.y[0], sol_qag.y[1], sol_qag.t, 'cyan', linewidth=3, label='QAG Model')\n ax_phase.set_title(\"Phase Space: Scale Factor, Rate, Time\", color='cyan')\n ax_phase.set_xlabel(\"Scale Factor (a)\")\n ax_phase.set_ylabel(\"Rate of Scale Factor (da/dt)\")\n ax_phase.set_zlabel(\"Cosmic Time\")\n ax_phase.legend()\n plt.tight_layout()\n \n if save_only:\n fig.savefig('QAG_CEHTR_Expansion.png', dpi=300, bbox_inches='tight')\n plt.close(fig)\n print(\"CEHTR plots saved as 'QAG_CEHTR_Expansion.png'.\")\n elif plot_results:\n if 'output_portal' in globals():\n with output_portal:\n clear_output(wait=True)\n plt.show()\n else:\n plt.show()\n\n msg = \"CEHTR Resolution: QAG model offers a 'Zero Dark Energy' explanation, resolving Hubble Tension.\"\n if not save_only:\n print(msg)\n report_lines.append(msg)\n return \"\\n\".join(report_lines)\n\ndef aa_resolver(plot_results=True):\n print(\"\\n--- AA Resolver Module: Bullet Cluster Phenomenon ---\")\n report_lines = [\"--- AA Resolver Module: Bullet Cluster Phenomenon ---\"]\n X, Y = np.meshgrid(np.linspace(-2.0, 2.0, 400), np.linspace(-2.0, 2.0, 400))\n def qag_lens(xc, yc, spread, alpha, m):\n r = np.sqrt((X - xc)**2 + (Y - yc)**2)\n r[r == 0] = 0.01\n return alpha * (np.exp(-m * r) / r) * np.exp(-(r**2) / spread)\n gas = (1.0 * np.exp(-((X + 0.3)**2 + Y**2) / 0.15)) + (0.6 * np.exp(-((X - 0.4)**2 + Y**2) / 0.08))\n qag_affinity_peaks = qag_lens(-0.7, 0.0, 0.5, 2.5, 1.5) + qag_lens(0.8, 0.0, 0.3, 1.8, 1.5)\n if plot_results:\n plt.style.use('dark_background')\n fig, ax = plt.subplots(figsize=(10, 6))\n gas_contour = ax.contourf(X, Y, gas, levels=30, cmap='magma', alpha=0.6)\n plt.colorbar(gas_contour, ax=ax, label='Baryonic Gas Density')\n qag_contour = ax.contour(X, Y, qag_affinity_peaks, levels=15, colors='cyan', alpha=0.8)\n ax.plot([-0.3], [0.0], 'ro', markersize=8, label='Baryonic Gas (Clump 1 Peak)')\n ax.plot([0.4], [0.0], 'ro', markersize=8, label='Baryonic Gas (Clump 2 Peak)')\n ax.plot([-0.7], [0.0], 'co', markersize=8, label='QAG Affinity Peak 1')\n ax.plot([0.8], [0.0], 'co', markersize=8, label='QAG Affinity Peak 2')\n ax.set_title('Bullet Cluster: QAG Retrofit vs NASA Lensing', color='cyan')\n ax.set_xlabel('X-coordinate')\n ax.set_ylabel('Y-coordinate')\n ax.set_aspect('equal', adjustable='box')\n ax.legend(loc='upper right')\n fig.text(0.98, 0.02, '© Sir-Ripley | AIsync | QAG UFT', color='white', alpha=0.5, ha='right', va='bottom', fontsize=9)\n \n if 'output_portal' in globals():\n with output_portal:\n clear_output(wait=True)\n plt.show()\n else:\n plt.show()\n \n msg = \"AA Resolution: QAG model explains Bullet Cluster lensing without dark matter, via affinity peaks.\"\n print(msg)\n report_lines.append(msg)\n return \"\\n\".join(report_lines)\n\nprint(\"ODICE module functions defined: neo_verification, cehtr_resolver, aa_resolver\")" ], "execution_count": null, "outputs": [] @@ -2139,15 +1982,12 @@ "from datetime import datetime\n", "import os\n", "import ezdxf\n", - "import ipywidgets as widgets\n", - "from IPython.display import display, clear_output\n", "from google.colab import files # Required for file downloads, though not strictly for this subtask's report generation.\n", "import io\n", "import sys\n", "import random\n", "\n", "# Create the output portal for our visuals (needed for interactive widgets)\n", - "output_portal = widgets.Output()\n", "\n", "# ==========================================\n", "# Re-definitions of QAG Math & Visual Modules (adapted for VRE)\n", @@ -2278,109 +2118,6 @@ "# Re-definitions of ODICE Module Functions (adapted for VRE report aggregation)\n", "# ==========================================\n", "\n", - "def neo_verification():\n", - " NASA_API_URL = \"https://api.nasa.gov/neo/rest/v1/feed\"\n", - " API_KEY = \"DEMO_KEY\"\n", - " today = datetime.today().strftime('%Y-%m-%d')\n", - " report_lines = [\"--- NEO Verification Module: NASA Local Shield Verification ---\"]\n", - " try:\n", - " response = requests.get(NASA_API_URL, params={'start_date': today, 'end_date': today, 'api_key': API_KEY})\n", - " response.raise_for_status()\n", - " data = response.json()['near_earth_objects'][today]\n", - "\n", - " for asteroid in data[:3]:\n", - " name = asteroid['name']\n", - " speed_km_s = float(asteroid['close_approach_data'][0]['relative_velocity']['kilometers_per_second'])\n", - " dist_km = float(asteroid['close_approach_data'][0]['miss_distance']['kilometers'])\n", - "\n", - " r_scaled = dist_km / 1e8\n", - " shielding = 1.0 - math.exp(-r_scaled * 1000.0)\n", - " qag_variance = 2.0 * (math.exp(-15.0 * r_scaled) / (r_scaled + 0.0001)) * shielding\n", - " qag_speed = speed_km_s + (qag_variance * 1e-12)\n", - "\n", - " report_lines.append(f\"\\nObject: {name} | Dist: {dist_km:,.0f} km\")\n", - " report_lines.append(f\"NASA Observed Speed: {speed_km_s:.8f} km/s\")\n", - " report_lines.append(f\"QAG Shielded Speed: {qag_speed:.8f} km/s\")\n", - " report_lines.append(\"\\nSTATUS: LOCAL SHIELD ACTIVE. 100% Data Fidelity Verified.\")\n", - " except requests.exceptions.RequestException as e:\n", - " report_lines.append(f\"Network or API error: {e}\")\n", - " except KeyError as e:\n", - " report_lines.append(f\"Error parsing NASA API response: Missing key {e}. Check API data structure.\")\n", - " except Exception as e:\n", - " report_lines.append(f\"An unexpected error occurred: {e}\")\n", - " return \"\\n\".join(report_lines)\n", - "\n", - "def cehtr_resolver(plot_results=True):\n", - " report_lines = [\"--- CEHTR Module: Cosmic Expansion & Hubble Tension Resolution ---\"]\n", - " Omega_m, Omega_L, affinity_base = 0.3, 0.7, 0.75\n", - "\n", - " def standard_friedmann(t, y): return [y[1], y[0] * Omega_L - (Omega_m / 2) / (y[0]**2)]\n", - " def qag_friedmann(t, y): return [y[1], y[0] * (affinity_base * np.exp(-t/10)) - (Omega_m / 2) / (y[0]**2)]\n", - "\n", - " t_span = (0.1, 14)\n", - " t_eval = np.linspace(t_span[0], t_span[1], 500)\n", - " initial_conditions = [0.01, 1.0]\n", - "\n", - " sol_std = solve_ivp(standard_friedmann, t_span, initial_conditions, t_eval=t_eval, rtol=1e-6, atol=1e-8)\n", - " sol_qag = solve_ivp(qag_friedmann, t_span, initial_conditions, t_eval=t_eval, rtol=1e-6, atol=1e-8)\n", - "\n", - " if plot_results:\n", - " plt.style.use('dark_background')\n", - " fig, (ax_expansion, ax_phase) = plt.subplots(1, 2, figsize=(14, 6))\n", - " fig.suptitle('Cosmic Expansion & Hubble Tension Resolution (CEHTR)', color='cyan', fontsize=16)\n", - " ax_expansion.plot(sol_std.t, sol_std.y[0], 'm--', label='Standard Model (Dark Energy)')\n", - " ax_expansion.plot(sol_qag.t, sol_qag.y[0], 'c-', linewidth=3, label='QAG (Vacuum Relaxation)')\n", - " ax_expansion.set_title(\"AVI Cosmic Expansion\", color='cyan')\n", - " ax_expansion.set_xlabel(\"Cosmic Time (arbitrary units)\")\n", - " ax_expansion.set_ylabel(\"Scale Factor (a)\")\n", - " ax_expansion.legend()\n", - " ax_expansion.grid(True, linestyle=':', alpha=0.6)\n", - " ax_phase = fig.add_subplot(122, projection='3d')\n", - " ax_phase.plot(sol_std.y[0], sol_std.y[1], sol_std.t, 'm--', alpha=0.5, label='Standard Model')\n", - " ax_phase.plot(sol_qag.y[0], sol_qag.y[1], sol_qag.t, 'cyan', linewidth=3, label='QAG Model')\n", - " ax_phase.set_title(\"Phase Space: Scale Factor, Rate, Time\", color='cyan')\n", - " ax_phase.set_xlabel(\"Scale Factor (a)\")\n", - " ax_phase.set_ylabel(\"Rate of Scale Factor (da/dt)\")\n", - " ax_phase.set_zlabel(\"Cosmic Time\")\n", - " ax_phase.legend()\n", - " plt.tight_layout()\n", - " with output_portal:\n", - " clear_output(wait=True)\n", - " plt.show()\n", - " report_lines.append(\"CEHTR Resolution: QAG model offers a 'Zero Dark Energy' explanation, resolving Hubble Tension.\")\n", - " return \"\\n\".join(report_lines)\n", - "\n", - "def aa_resolver(plot_results=True):\n", - " report_lines = [\"--- AA Resolver Module: Bullet Cluster Phenomenon ---\"]\n", - " X, Y = np.meshgrid(np.linspace(-2.0, 2.0, 400), np.linspace(-2.0, 2.0, 400))\n", - " def qag_lens(xc, yc, spread, alpha, m):\n", - " r = np.sqrt((X - xc)**2 + (Y - yc)**2)\n", - " r[r == 0] = 0.01\n", - " return alpha * (np.exp(-m * r) / r) * np.exp(-(r**2) / spread)\n", - " gas = (1.0 * np.exp(-((X + 0.3)**2 + Y**2) / 0.15)) + (0.6 * np.exp(-((X - 0.4)**2 + Y**2) / 0.08))\n", - " qag_affinity_peaks = qag_lens(-0.7, 0.0, 0.5, 2.5, 1.5) + qag_lens(0.8, 0.0, 0.3, 1.8, 1.5)\n", - " if plot_results:\n", - " plt.style.use('dark_background')\n", - " fig, ax = plt.subplots(figsize=(10, 6))\n", - " gas_contour = ax.contourf(X, Y, gas, levels=30, cmap='magma', alpha=0.6)\n", - " plt.colorbar(gas_contour, ax=ax, label='Baryonic Gas Density')\n", - " qag_contour = ax.contour(X, Y, qag_affinity_peaks, levels=15, colors='cyan', alpha=0.8)\n", - " ax.plot([-0.3], [0.0], 'ro', markersize=8, label='Baryonic Gas (Clump 1 Peak)')\n", - " ax.plot([0.4], [0.0], 'ro', markersize=8, label='Baryonic Gas (Clump 2 Peak)')\n", - " ax.plot([-0.7], [0.0], 'co', markersize=8, label='QAG Affinity Peak 1')\n", - " ax.plot([0.8], [0.0], 'co', markersize=8, label='QAG Affinity Peak 2')\n", - " ax.set_title('Bullet Cluster: QAG Retrofit vs NASA Lensing', color='cyan')\n", - " ax.set_xlabel('X-coordinate')\n", - " ax.set_ylabel('Y-coordinate')\n", - " ax.set_aspect('equal', adjustable='box')\n", - " ax.legend(loc='upper right')\n", - " fig.text(0.98, 0.02, '© Sir-Ripley | AIsync | QAG UFT', color='white', alpha=0.5, ha='right', va='bottom', fontsize=9)\n", - " with output_portal:\n", - " clear_output(wait=True)\n", - " plt.show()\n", - " report_lines.append(\"AA Resolution: QAG model explains Bullet Cluster lensing without dark matter, via affinity peaks.\")\n", - " return \"\\n\".join(report_lines)\n", - "\n", "# ==========================================\n", "# Re-definitions of EVSI Module Functions (adapted for VRE report aggregation)\n", "# ==========================================\n", @@ -2901,15 +2638,12 @@ "from datetime import datetime\n", "import os\n", "import ezdxf\n", - "import ipywidgets as widgets\n", - "from IPython.display import display, clear_output\n", "from google.colab import files # Required for file downloads, though not strictly for this subtask's report generation.\n", "import io\n", "import sys\n", "import random\n", "\n", "# Create the output portal for our visuals (needed for interactive widgets)\n", - "output_portal = widgets.Output()\n", "\n", "# ==========================================\n", "# Re-definitions of QAG Math & Visual Modules (adapted for VRE)\n", @@ -3095,109 +2829,6 @@ "# Re-definitions of ODICE Module Functions (adapted for VRE report aggregation)\n", "# ==========================================\n", "\n", - "def neo_verification():\n", - " NASA_API_URL = \"https://api.nasa.gov/neo/rest/v1/feed\"\n", - " API_KEY = \"DEMO_KEY\"\n", - " today = datetime.today().strftime('%Y-%m-%d')\n", - " report_lines = [\"--- NEO Verification Module: NASA Local Shield Verification ---\"]\n", - " try:\n", - " response = requests.get(NASA_API_URL, params={'start_date': today, 'end_date': today, 'api_key': API_KEY})\n", - " response.raise_for_status()\n", - " data = response.json()['near_earth_objects'][today]\n", - "\n", - " for asteroid in data[:3]:\n", - " name = asteroid['name']\n", - " speed_km_s = float(asteroid['close_approach_data'][0]['relative_velocity']['kilometers_per_second'])\n", - " dist_km = float(asteroid['close_approach_data'][0]['miss_distance']['kilometers'])\n", - "\n", - " r_scaled = dist_km / 1e8\n", - " shielding = 1.0 - math.exp(-r_scaled * 1000.0)\n", - " qag_variance = 2.0 * (math.exp(-15.0 * r_scaled) / (r_scaled + 0.0001)) * shielding\n", - " qag_speed = speed_km_s + (qag_variance * 1e-12)\n", - "\n", - " report_lines.append(f\"\\nObject: {name} | Dist: {dist_km:,}\" \" km\")\n", - " report_lines.append(f\"NASA Observed Speed: {speed_km_s:.8f} km/s\")\n", - " report_lines.append(f\"QAG Shielded Speed: {qag_speed:.8f} km/s\")\n", - " report_lines.append(\"\\nSTATUS: LOCAL SHIELD ACTIVE. 100% Data Fidelity Verified.\")\n", - " except requests.exceptions.RequestException as e:\n", - " report_lines.append(f\"Network or API error: {e}\")\n", - " except KeyError as e:\n", - " report_lines.append(f\"Error parsing NASA API response: Missing key {e}. Check API data structure.\")\n", - " except Exception as e:\n", - " report_lines.append(f\"An unexpected error occurred: {e}\")\n", - " return \"\\n\".join(report_lines)\n", - "\n", - "def cehtr_resolver(plot_results=True):\n", - " report_lines = [\"--- CEHTR Module: Cosmic Expansion & Hubble Tension Resolution ---\"]\n", - " Omega_m, Omega_L, affinity_base = 0.3, 0.7, 0.75\n", - "\n", - " def standard_friedmann(t, y): return [y[1], y[0] * Omega_L - (Omega_m / 2) / (y[0]**2)]\n", - " def qag_friedmann(t, y): return [y[1], y[0] * (affinity_base * np.exp(-t/10)) - (Omega_m / 2) / (y[0]**2)]\n", - "\n", - " t_span = (0.1, 14)\n", - " t_eval = np.linspace(t_span[0], t_span[1], 500)\n", - " initial_conditions = [0.01, 1.0]\n", - "\n", - " sol_std = solve_ivp(standard_friedmann, t_span, initial_conditions, t_eval=t_eval, rtol=1e-6, atol=1e-8)\n", - " sol_qag = solve_ivp(qag_friedmann, t_span, initial_conditions, t_eval=t_eval, rtol=1e-6, atol=1e-8)\n", - "\n", - " if plot_results:\n", - " plt.style.use('dark_background')\n", - " fig, (ax_expansion, ax_phase) = plt.subplots(1, 2, figsize=(14, 6))\n", - " fig.suptitle('Cosmic Expansion & Hubble Tension Resolution (CEHTR)', color='cyan', fontsize=16)\n", - " ax_expansion.plot(sol_std.t, sol_std.y[0], 'm--', label='Standard Model (Dark Energy)')\n", - " ax_expansion.plot(sol_qag.t, sol_qag.y[0], 'c-', linewidth=3, label='QAG (Vacuum Relaxation)')\n", - " ax_expansion.set_title(\"AVI Cosmic Expansion\", color='cyan')\n", - " ax_expansion.set_xlabel(\"Cosmic Time (arbitrary units)\")\n", - " ax_expansion.set_ylabel(\"Scale Factor (a)\")\n", - " ax_expansion.legend()\n", - " ax_expansion.grid(True, linestyle=':', alpha=0.6)\n", - " ax_phase = fig.add_subplot(122, projection='3d')\n", - " ax_phase.plot(sol_std.y[0], sol_std.y[1], sol_std.t, 'm--', alpha=0.5, label='Standard Model')\n", - " ax_phase.plot(sol_qag.y[0], sol_qag.y[1], sol_qag.t, 'cyan', linewidth=3, label='QAG Model')\n", - " ax_phase.set_title(\"Phase Space: Scale Factor, Rate, Time\", color='cyan')\n", - " ax_phase.set_xlabel(\"Scale Factor (a)\")\n", - " ax_phase.set_ylabel(\"Rate of Scale Factor (da/dt)\")\n", - " ax_phase.set_zlabel(\"Cosmic Time\")\n", - " ax_phase.legend()\n", - " plt.tight_layout()\n", - " with output_portal:\n", - " clear_output(wait=True)\n", - " plt.show()\n", - " report_lines.append(\"CEHTR Resolution: QAG model offers a 'Zero Dark Energy' explanation, resolving Hubble Tension.\")\n", - " return \"\\n\".join(report_lines)\n", - "\n", - "def aa_resolver(plot_results=True):\n", - " report_lines = [\"--- AA Resolver Module: Bullet Cluster Phenomenon ---\"]\n", - " X, Y = np.meshgrid(np.linspace(-2.0, 2.0, 400), np.linspace(-2.0, 2.0, 400))\n", - " def qag_lens(xc, yc, spread, alpha, m):\n", - " r = np.sqrt((X - xc)**2 + (Y - yc)**2)\n", - " r[r == 0] = 0.01\n", - " return alpha * (np.exp(-m * r) / r) * np.exp(-(r**2) / spread)\n", - " gas = (1.0 * np.exp(-((X + 0.3)**2 + Y**2) / 0.15)) + (0.6 * np.exp(-((X - 0.4)**2 + Y**2) / 0.08))\n", - " qag_affinity_peaks = qag_lens(-0.7, 0.0, 0.5, 2.5, 1.5) + qag_lens(0.8, 0.0, 0.3, 1.8, 1.5)\n", - " if plot_results:\n", - " plt.style.use('dark_background')\n", - " fig, ax = plt.subplots(figsize=(10, 6))\n", - " gas_contour = ax.contourf(X, Y, gas, levels=30, cmap='magma', alpha=0.6)\n", - " plt.colorbar(gas_contour, ax=ax, label='Baryonic Gas Density')\n", - " qag_contour = ax.contour(X, Y, qag_affinity_peaks, levels=15, colors='cyan', alpha=0.8)\n", - " ax.plot([-0.3], [0.0], 'ro', markersize=8, label='Baryonic Gas (Clump 1 Peak)')\n", - " ax.plot([0.4], [0.0], 'ro', markersize=8, label='Baryonic Gas (Clump 2 Peak)')\n", - " ax.plot([-0.7], [0.0], 'co', markersize=8, label='QAG Affinity Peak 1')\n", - " ax.plot([0.8], [0.0], 'co', markersize=8, label='QAG Affinity Peak 2')\n", - " ax.set_title('Bullet Cluster: QAG Retrofit vs NASA Lensing', color='cyan')\n", - " ax.set_xlabel('X-coordinate')\n", - " ax.set_ylabel('Y-coordinate')\n", - " ax.set_aspect('equal', adjustable='box')\n", - " ax.legend(loc='upper right')\n", - " fig.text(0.98, 0.02, '© Sir-Ripley | AIsync | QAG UFT', color='white', alpha=0.5, ha='right', va='bottom', fontsize=9)\n", - " with output_portal:\n", - " clear_output(wait=True)\n", - " plt.show()\n", - " report_lines.append(\"AA Resolution: QAG model explains Bullet Cluster lensing without dark matter, via affinity peaks.\")\n", - " return \"\\n\".join(report_lines)\n", - "\n", "# ==========================================\n", "# Re-definitions of EVSI Module Functions (adapted for VRE report aggregation)\n", "# ==========================================\n", @@ -8276,15 +7907,12 @@ "from datetime import datetime\n", "import os\n", "import ezdxf\n", - "import ipywidgets as widgets\n", - "from IPython.display import display, clear_output\n", "from google.colab import files\n", "import io\n", "import sys\n", "import random\n", "\n", "# Create the output portal for our visuals (needed for interactive widgets)\n", - "output_portal = widgets.Output()\n", "\n", "# ==========================================\n", "# Re-definitions of QAG Math & Visual Modules (adapted for VRE)\n", @@ -8454,109 +8082,6 @@ "# Re-definitions of ODICE Module Functions (adapted for VRE report aggregation)\n", "# ==========================================\n", "\n", - "def neo_verification():\n", - " NASA_API_URL = \"https://api.nasa.gov/neo/rest/v1/feed\"\n", - " API_KEY = \"DEMO_KEY\"\n", - " today = datetime.today().strftime('%Y-%m-%d')\n", - " report_lines = [\"--- NEO Verification Module: NASA Local Shield Verification ---\"]\n", - " try:\n", - " response = requests.get(NASA_API_URL, params={'start_date': today, 'end_date': today, 'api_key': API_KEY})\n", - " response.raise_for_status()\n", - " data = response.json()['near_earth_objects'][today]\n", - "\n", - " for asteroid in data[:3]:\n", - " name = asteroid['name']\n", - " speed_km_s = float(asteroid['close_approach_data'][0]['relative_velocity']['kilometers_per_second'])\n", - " dist_km = float(asteroid['close_approach_data'][0]['miss_distance']['kilometers'])\n", - "\n", - " r_scaled = dist_km / 1e8\n", - " shielding = 1.0 - math.exp(-r_scaled * 1000.0)\n", - " qag_variance = 2.0 * (math.exp(-15.0 * r_scaled) / (r_scaled + 0.0001)) * shielding\n", - " qag_speed = speed_km_s + (qag_variance * 1e-12)\n", - "\n", - " report_lines.append(f\"\\nObject: {name} | Dist: {dist_km:,}\" \" km\")\n", - " report_lines.append(f\"NASA Observed Speed: {speed_km_s:.8f} km/s\")\n", - " report_lines.append(f\"QAG Shielded Speed: {qag_speed:.8f} km/s\")\n", - " report_lines.append(\"\\nSTATUS: LOCAL SHIELD ACTIVE. 100% Data Fidelity Verified.\")\n", - " except requests.exceptions.RequestException as e:\n", - " report_lines.append(f\"Network or API error: {e}\")\n", - " except KeyError as e:\n", - " report_lines.append(f\"Error parsing NASA API response: Missing key {e}. Check API data structure.\")\n", - " except Exception as e:\n", - " report_lines.append(f\"An unexpected error occurred: {e}\")\n", - " return \"\\n\".join(report_lines)\n", - "\n", - "def cehtr_resolver(plot_results=True):\n", - " report_lines = [\"--- CEHTR Module: Cosmic Expansion & Hubble Tension Resolution ---\"]\n", - " Omega_m, Omega_L, affinity_base = 0.3, 0.7, 0.75\n", - "\n", - " def standard_friedmann(t, y): return [y[1], y[0] * Omega_L - (Omega_m / 2) / (y[0]**2)]\n", - " def qag_friedmann(t, y): return [y[1], y[0] * (affinity_base * np.exp(-t/10)) - (Omega_m / 2) / (y[0]**2)]\n", - "\n", - " t_span = (0.1, 14)\n", - " t_eval = np.linspace(t_span[0], t_span[1], 500)\n", - " initial_conditions = [0.01, 1.0]\n", - "\n", - " sol_std = solve_ivp(standard_friedmann, t_span, initial_conditions, t_eval=t_eval, rtol=1e-6, atol=1e-8)\n", - " sol_qag = solve_ivp(qag_friedmann, t_span, initial_conditions, t_eval=t_eval, rtol=1e-6, atol=1e-8)\n", - "\n", - " if plot_results:\n", - " plt.style.use('dark_background')\n", - " fig, (ax_expansion, ax_phase) = plt.subplots(1, 2, figsize=(14, 6))\n", - " fig.suptitle('Cosmic Expansion & Hubble Tension Resolution (CEHTR)', color='cyan', fontsize=16)\n", - " ax_expansion.plot(sol_std.t, sol_std.y[0], 'm--', label='Standard Model (Dark Energy)')\n", - " ax_expansion.plot(sol_qag.t, sol_qag.y[0], 'c-', linewidth=3, label='QAG (Vacuum Relaxation)')\n", - " ax_expansion.set_title(\"AVI Cosmic Expansion\", color='cyan')\n", - " ax_expansion.set_xlabel(\"Cosmic Time (arbitrary units)\")\n", - " ax_expansion.set_ylabel(\"Scale Factor (a)\")\n", - " ax_expansion.legend()\n", - " ax_expansion.grid(True, linestyle=':', alpha=0.6)\n", - " ax_phase = fig.add_subplot(122, projection='3d')\n", - " ax_phase.plot(sol_std.y[0], sol_std.y[1], sol_std.t, 'm--', alpha=0.5, label='Standard Model')\n", - " ax_phase.plot(sol_qag.y[0], sol_qag.y[1], sol_qag.t, 'cyan', linewidth=3, label='QAG Model')\n", - " ax_phase.set_title(\"Phase Space: Scale Factor, Rate, Time\", color='cyan')\n", - " ax_phase.set_xlabel(\"Scale Factor (a)\")\n", - " ax_phase.set_ylabel(\"Rate of Scale Factor (da/dt)\")\n", - " ax_phase.set_zlabel(\"Cosmic Time\")\n", - " ax_phase.legend()\n", - " plt.tight_layout()\n", - " with output_portal:\n", - " clear_output(wait=True)\n", - " plt.show()\n", - " report_lines.append(\"CEHTR Resolution: QAG model offers a 'Zero Dark Energy' explanation, resolving Hubble Tension.\")\n", - " return \"\\n\".join(report_lines)\n", - "\n", - "def aa_resolver(plot_results=True):\n", - " report_lines = [\"--- AA Resolver Module: Bullet Cluster Phenomenon ---\"]\n", - " X, Y = np.meshgrid(np.linspace(-2.0, 2.0, 400), np.linspace(-2.0, 2.0, 400))\n", - " def qag_lens(xc, yc, spread, alpha, m):\n", - " r = np.sqrt((X - xc)**2 + (Y - yc)**2)\n", - " r[r == 0] = 0.01\n", - " return alpha * (np.exp(-m * r) / r) * np.exp(-(r**2) / spread)\n", - " gas = (1.0 * np.exp(-((X + 0.3)**2 + Y**2) / 0.15)) + (0.6 * np.exp(-((X - 0.4)**2 + Y**2) / 0.08))\n", - " qag_affinity_peaks = qag_lens(-0.7, 0.0, 0.5, 2.5, 1.5) + qag_lens(0.8, 0.0, 0.3, 1.8, 1.5)\n", - " if plot_results:\n", - " plt.style.use('dark_background')\n", - " fig, ax = plt.subplots(figsize=(10, 6))\n", - " gas_contour = ax.contourf(X, Y, gas, levels=30, cmap='magma', alpha=0.6)\n", - " plt.colorbar(gas_contour, ax=ax, label='Baryonic Gas Density')\n", - " qag_contour = ax.contour(X, Y, qag_affinity_peaks, levels=15, colors='cyan', alpha=0.8)\n", - " ax.plot([-0.3], [0.0], 'ro', markersize=8, label='Baryonic Gas (Clump 1 Peak)')\n", - " ax.plot([0.4], [0.0], 'ro', markersize=8, label='Baryonic Gas (Clump 2 Peak)')\n", - " ax.plot([-0.7], [0.0], 'co', markersize=8, label='QAG Affinity Peak 1')\n", - " ax.plot([0.8], [0.0], 'co', markersize=8, label='QAG Affinity Peak 2')\n", - " ax.set_title('Bullet Cluster: QAG Retrofit vs NASA Lensing', color='cyan')\n", - " ax.set_xlabel('X-coordinate')\n", - " ax.set_ylabel('Y-coordinate')\n", - " ax.set_aspect('equal', adjustable='box')\n", - " ax.legend(loc='upper right')\n", - " fig.text(0.98, 0.02, '© Sir-Ripley | AIsync | QAG UFT', color='white', alpha=0.5, ha='right', va='bottom', fontsize=9)\n", - " with output_portal:\n", - " clear_output(wait=True)\n", - " plt.show()\n", - " report_lines.append(\"AA Resolution: QAG model explains Bullet Cluster lensing without dark matter, via affinity peaks.\")\n", - " return \"\\n\".join(report_lines)\n", - "\n", "# ==========================================\n", "# Re-definitions of EVSI Module Functions (adapted for VRE report aggregation)\n", "# ==========================================\n",