Friday, September 19, 2025

Obloid inversion setup for time-dialation testing and simulation of cosmic string and other phenomenon.

 #!/usr/bin/env bash
# ============================================================
# Bash build script for "obloid" simulation + ASCII diagram
# Creates a tar.gz archive with all components.
# This thing was a physics quandry of how to simulate cosmic string information and yield

# anyon grid as a means of testbenching for cosmic phenomena.
# ============================================================

# 1. Create a clean working directory
WORKDIR="obloid_package"
rm -rf "$WORKDIR"
mkdir "$WORKDIR"

# 2. Write obloid_sim_salient.py (main simulation script)
cat > "$WORKDIR/obloid_sim_salient.py" <<'PYCODE'
# obloid_sim_salient.py
# Saliency-optimized angular sweep, phase correction, and velocity prediction.
# Expansion: includes functions for Schwarzschild radius, obloid dilation,
# decay constant, activity, gamma rate, phase correction, sled velocity, gamma profile.

import numpy as np
import matplotlib.pyplot as plt

G = 6.67430e-11
c = 2.99792458e8
CURIE_TO_BQ = 3.7e10
LN2 = np.log(2)

def schwarzschild_radius(mass_kg):
    return 2 * G * mass_kg / (c**2) if mass_kg > 0 else 0.0

def obloid_dilation(mass_kg, r_m, theta_rad, a_m):
    rs = schwarzschild_radius(mass_kg)
    f = np.sqrt(r_m**2 + a_m**2 * np.cos(theta_rad)**2)
    if mass_kg <= 0 or f <= rs:
        return 0.0
    return np.sqrt(1.0 - rs / f)

def decay_constant_from_half_life_days(t12_days):
    if t12_days is None or t12_days <= 0:
        return 0.0
    return LN2 / (t12_days * 24 * 3600)

def activity_at_time(A0_Bq, lam, t_seconds):
    if lam == 0:
        return A0_Bq
    return A0_Bq * np.exp(-lam * t_seconds)

def gamma_rate_curies(A_Bq, total_yield):
    return (A_Bq * total_yield) / CURIE_TO_BQ

def gate_phase_correction(theta_array, mass_kg, r_m, a_m):
    alphas = np.array([obloid_dilation(mass_kg, r_m, th, a_m) for th in theta_array])
    inv_alpha = np.where(alphas > 0, 1.0 / alphas, np.inf)
    corr = np.cumsum(inv_alpha)
    corr -= corr[0]
    corr = (corr / corr[-1]) * 2.0 * np.pi
    return corr, alphas

def sled_velocity_profile(theta_array, base_velocity, alphas, apply_correction):
    if apply_correction:
        return np.full_like(alphas, base_velocity)
    mean_alpha = np.mean(alphas[alphas > 0]) if np.any(alphas > 0) else 1.0
    return base_velocity * (alphas / mean_alpha)

def gamma_profile(theta_array, A0_Bq, t_days, lam, alphas, total_yield, inverse_time=False):
    t_sec = t_days * 24 * 3600
    sgn = -1.0 if inverse_time else 1.0
    At = np.array([activity_at_time(A0_Bq, lam, sgn * a * t_sec) for a in alphas])
    return gamma_rate_curies(At, total_yield)

def run_obloid_demo(
    mass_kg=2.7e23,
    r_m=1.0e-3,
    a_m=0.8e-3,
    A0_Bq=1.0e9,
    t12_days=30.0,
    total_yield=0.85,
    t_days=10.0,
    base_velocity=50.0,
    n_angles=361,
    inverse_time=False,
    save_prefix=None,
    show=True
):
    theta = np.linspace(0, 2*np.pi, n_angles)
    phase_corr, alphas = gate_phase_correction(theta, mass_kg, r_m, a_m)

    lam = decay_constant_from_half_life_days(t12_days)
    gamma_uncorrected = gamma_profile(theta, A0_Bq, t_days, lam, alphas, total_yield, inverse_time)
    v_uncorrected = sled_velocity_profile(theta, base_velocity, alphas, apply_correction=False)
    v_corrected = sled_velocity_profile(theta, base_velocity, alphas, apply_correction=True)

    # Plotting
    fig1, ax1 = plt.subplots()
    ax1.plot(np.degrees(theta), alphas)
    ax1.set_title("Alpha(theta) dilation")
    ax1.set_xlabel("Angle (deg)")
    ax1.set_ylabel("alpha")
    ax1.grid(True)

    fig2, ax2 = plt.subplots()
    ax2.plot(np.degrees(theta), phase_corr * 180/np.pi)
    ax2.set_title("Gate phase correction (deg)")
    ax2.set_xlabel("Angle (deg)")
    ax2.set_ylabel("Phase (deg)")
    ax2.grid(True)

    fig3, ax3 = plt.subplots()
    ax3.plot(np.degrees(theta), v_uncorrected, label="Uncorrected")
    ax3.plot(np.degrees(theta), v_corrected, "--", label="Corrected")
    ax3.set_title("Sled velocity vs angle")
    ax3.set_xlabel("Angle (deg)")
    ax3.set_ylabel("Velocity (um/s)")
    ax3.legend()
    ax3.grid(True)

    fig4, ax4 = plt.subplots()
    ax4.plot(np.degrees(theta), gamma_uncorrected)
    ax4.set_title("Gamma rate vs angle (Curies)")
    ax4.set_xlabel("Angle (deg)")
    ax4.set_ylabel("Gamma (Ci)")
    ax4.grid(True)

    if save_prefix:
        fig1.savefig(f"{save_prefix}_alpha_theta.png", dpi=200)
        fig2.savefig(f"{save_prefix}_phase_correction.png", dpi=200)
        fig3.savefig(f"{save_prefix}_velocity_profiles.png", dpi=200)
        fig4.savefig(f"{save_prefix}_gamma_vs_angle.png", dpi=200)

    if show:
        plt.show()
    else:
        plt.close('all')

    return {
        "theta_deg": np.degrees(theta),
        "alpha": alphas,
        "phase_corr_deg": phase_corr * 180/np.pi,
        "v_uncorrected_um_s": v_uncorrected,
        "v_corrected_um_s": v_corrected,
        "gamma_curies": gamma_uncorrected
    }
PYCODE

# 3. Write export_salient.py (runner + CSV export)
cat > "$WORKDIR/export_salient.py" <<'PYCODE'
# export_salient.py
# Runs the salient demo, saves plots and a CSV.
# Declaration: imports run_obloid_demo from obloid_sim_salient and writes CSV.

import csv
from obloid_sim_salient import run_obloid_demo

if __name__ == "__main__":
    results = run_obloid_demo(
        mass_kg=2.7e23,
        r_m=1.0e-3,
        a_m=0.8e-3,
        A0_Bq=1.0e9,
        t12_days=30.0,
        total_yield=0.85,
        t_days=10.0,
        base_velocity=50.0,
        n_angles=361,
        inverse_time=False,
        save_prefix="salient",
        show=True
    )

    with open("obloid_angular_sweep.csv", "w", newline="") as f:
        w = csv.writer(f)
        w.writerow(["theta_deg", "alpha", "phase_corr_deg",
                    "velocity_uncorrected_um_s", "velocity_corrected_um_s",
                    "gamma_curies"])
        for i in range(len(results["theta_deg"])):
            w.writerow([
                results["theta_deg"][i],
                results["alpha"][i],
                results["phase_corr_deg"][i],
                results["v_uncorrected_um_s"][i],
                results["v_corrected_um_s"][i],
                results["gamma_curies"][i]
            ])

    print("Saved: salient_* plots and obloid_angular_sweep.csv")
PYCODE

# 4. Write ASCII diagram file (continued)
cat >> "$WORKDIR/obloid_ascii_diagram.txt" <<'TXT'
   │   │   Racetrack Edge (graphene/hBN or Si/SiGe 2DEG)                │
   │   │                                                                │
   │   │   ← Chiral Edge Direction (CW under +B)                        │
   │   │                                                                │
   │   │   ┌───────────── Pump / RF Section ──────────────┐              │
   │   │   │  G1 (0°)   G2 (120°)   G3 (240°)             │              │
   │   │   │  ┌───────┐  ┌───────┐  ┌───────┐             │              │
   │   │   │  │  G1   │  │  G2   │  │  G3   │             │              │
   │   │   │  └───────┘  └───────┘  └───────┘             │              │
   │   │   └──────────────────────────────────────────────┘              │
   │   │                                                                │
   │   │   [QPC1]                                           [QPC2]      │
   │   │                                                                │
   │   │            █████████    (Magnetic SLED zone)                   │
   │   │            █  SLED  █    Fe / FeCo, 200–300 nm                 │
   │   │            █████████                                        ▲  │
   │   │                                                                │
   │   │   Hall(0°)  Hall(60°) ... Hall(300°)                            │
   │   └──────────────────────────────────────────────────────────────┘
   │
   │  SAW IDT A (equator, along edge)     SAW IDT B (axis spur)
   └────────────────────────────────────────────────────────────────────┘

Side View (axis of obloid perpendicular to device plane)
--------------------------------------------------------

      z ↑ (Obloid symmetry axis)
        │
        │                SLED
        │               █████
        │   Spacer     ███████   (ALD Al2O3)
        │───────────────┄┄┄┄┄┄┄────────────── (device plane, equator: θ = 90°)
        │         2DEG / Graphene Edge
        │────────────── substrate ───────────
        │
        └────────────→ x (racetrack tangent)

Obloid Metric Proxy (not physical structure):
   α(θ) = sqrt(1 - r_s / sqrt(r^2 + a^2 cos^2 θ))
   Strongest redshift at θ = 90° (equator, device plane).
   Weaker along θ = 0° (axis), probed via axis spur + SAW IDT B.

RF Timing Overlay:
   G1: sin(ωt + φ1(φ))   G2: sin(ωt + φ2(φ))   G3: sin(ωt + φ3(φ))
   with φ-corrections chosen so local phase velocity ~ constant:
   dφ/ds ∝ 1/α(φ); cumulative correction wraps to 2π around track.
TXT

# 5. Create the tar.gz archive
tar -czf obloid_package.tar.gz "$WORKDIR"

# 6. Final message
echo "Archive created: obloid_package.tar.gz"
echo "Contains:"
echo " - obloid_sim_salient.py (simulation)"
echo " - export_salient.py (runner + CSV export)"
echo " - obloid_ascii_diagram.txt (functional ASCII schematic)"

 

No comments: