RFTSystems's picture
Update app.py
c3a4755 verified
import math
import numpy as np
import plotly.graph_objects as go
import gradio as gr
# ---------------------------------------------------------
# SPEED OF SIGHT
# ---------------------------------------------------------
def speed_of_sight(AR_visual, AT_ms, R_obs):
return AR_visual / (AT_ms * R_obs)
def physical_delay(distance_ly):
return distance_ly
def perceptual_delay(AT_ms):
return AT_ms
def sos_compute(distance_ly, AR_visual, AT_ms, R_obs):
sos_val = speed_of_sight(AR_visual, AT_ms, R_obs)
phys = physical_delay(distance_ly)
perc = perceptual_delay(AT_ms)
fig = go.Figure()
fig.add_trace(go.Bar(
x=["Physical Delay (years)", "Perceptual Delay (seconds)"],
y=[phys, perc / 1000.0],
marker_color=["#636EFA", "#EF553B"]
))
fig.update_layout(
title="Physical vs Perceptual Delay",
yaxis_title="Delay"
)
return sos_val, phys, perc, fig
def sos_animation(distance_ly, AR_visual, AT_ms, R_obs):
phys = physical_delay(distance_ly)
perc = perceptual_delay(AT_ms) / 1000.0
times = np.linspace(0, 1.0, 20)
frames = []
for i, t in enumerate(times):
frames.append(go.Frame(
data=[
go.Scatter(
x=[0, phys * t],
y=[0, 0],
mode="lines+markers",
line=dict(color="#636EFA", width=4),
marker=dict(size=8),
name="Photon Path"
),
go.Scatter(
x=[0, min(perc * t * 10, perc)],
y=[0.2, 0.2],
mode="lines+markers",
line=dict(color="#EF553B", width=4),
marker=dict(size=8),
name="Perceptual Frame"
)
],
name=f"frame{i}"
))
fig = go.Figure(data=frames[0].data, frames=frames)
fig.frames = frames
fig.update_layout(
title="Speed of Sight Timeline",
xaxis_title="Time (scaled)",
yaxis=dict(showticklabels=False),
updatemenus=[dict(
type="buttons",
showactive=False,
buttons=[dict(
label="Play",
method="animate",
args=[None, {"frame": {"duration": 80, "redraw": True},
"fromcurrent": True}]
)]
)]
)
return fig
# ---------------------------------------------------------
# MOTION-BASED UNITS
# ---------------------------------------------------------
LOU = 9.94e-5
GVU = 5.35e-5
Solar1 = 0.00257
def distance_in_unit(distance_ly, unit):
if unit == "LOU":
return distance_ly / LOU
if unit == "GVU":
return distance_ly / GVU
if unit == "Solar1":
return distance_ly / Solar1
return distance_ly
def units_compute(distance_ly, unit):
val = distance_in_unit(distance_ly, unit)
fig = go.Figure()
fig.add_trace(go.Bar(
x=["Light-years", unit],
y=[distance_ly, val],
marker_color=["#636EFA", "#00CC96"]
))
fig.update_layout(
title="Distance Conversion",
yaxis_title="Value"
)
return val, fig
# ---------------------------------------------------------
# PARADOXES
# ---------------------------------------------------------
V1_SPEED = 5.6e-5
AND_LCDM = 2.5e6
AND_RFT = 4.5e5
RFT_HORIZON = 6.8379e6
LCDM_HORIZON = 1.3935e4
def voyager_travel_time(distance_ly):
return distance_ly / V1_SPEED
def andromeda_compute():
t_lcdm = voyager_travel_time(AND_LCDM)
t_rft = voyager_travel_time(AND_RFT)
ratio = t_lcdm / t_rft
fig = go.Figure()
fig.add_trace(go.Bar(
x=["ΛCDM Distance", "RFT Distance"],
y=[AND_LCDM, AND_RFT],
marker_color=["#636EFA", "#00CC96"]
))
fig.update_layout(
title="Andromeda Distance: ΛCDM vs RFT",
yaxis_title="Distance (light-years)"
)
return t_lcdm, t_rft, ratio, fig
def horizon_compute():
ratio = RFT_HORIZON / LCDM_HORIZON
fig = go.Figure()
fig.add_trace(go.Bar(
x=["ΛCDM Horizon", "RFT Horizon"],
y=[LCDM_HORIZON, RFT_HORIZON],
marker_color=["#636EFA", "#00CC96"]
))
fig.update_layout(
title="Comoving Horizon: ΛCDM vs RFT",
yaxis_title="Distance (Mpc)"
)
return RFT_HORIZON, LCDM_HORIZON, ratio, fig
def dark_compute():
ratio = RFT_HORIZON / LCDM_HORIZON
factor = ratio ** 2
fig = go.Figure()
fig.add_trace(go.Bar(
x=["True Density", "ΛCDM Inferred Density"],
y=[1.0, 1.0 / factor],
marker_color=["#00CC96", "#EF553B"]
))
fig.update_layout(
title="Density Inflation from Distance Miscalibration",
yaxis_title="Relative Density"
)
return factor, fig
# ---------------------------------------------------------
# EXPANSION ANIMATION
# ---------------------------------------------------------
def expansion_animation():
t = np.linspace(0.01, 1.0, 50)
a_lcdm = t ** (2/3)
a_rft = t ** 0.9
frames = []
for i in range(len(t)):
frames.append(go.Frame(
data=[
go.Scatter(x=t[:i+1], y=a_lcdm[:i+1], mode="lines", name="ΛCDM",
line=dict(color="#636EFA")),
go.Scatter(x=t[:i+1], y=a_rft[:i+1], mode="lines", name="RFT",
line=dict(color="#00CC96"))
],
name=f"frame{i}"
))
fig = go.Figure(data=frames[0].data, frames=frames)
fig.update_layout(
title="Expansion Law: ΛCDM vs RFT (Toy Model)",
xaxis_title="Normalised Time",
yaxis_title="Scale Factor a(t)",
updatemenus=[dict(
type="buttons",
showactive=False,
buttons=[dict(
label="Play",
method="animate",
args=[None, {"frame": {"duration": 80, "redraw": True},
"fromcurrent": True}]
)]
)]
)
return fig
# ---------------------------------------------------------
# SOLAR1 MANIFOLD
# ---------------------------------------------------------
def generate_solar1_manifold_rotating():
rng = np.random.default_rng(42)
n = 300
redshift = rng.uniform(2, 15, n)
radius = rng.uniform(0.1, 5, n)
theta = rng.uniform(0, 2*np.pi, n)
phi = rng.uniform(0, np.pi, n)
x = radius * np.sin(phi) * np.cos(theta)
y = radius * np.sin(phi) * np.sin(theta)
z = radius * np.cos(phi)
base = go.Scatter3d(
x=x, y=y, z=z,
mode="markers",
marker=dict(
size=4,
color=redshift,
colorscale="Viridis",
colorbar=dict(title="Redshift")
)
)
frames = []
for i, angle in enumerate(np.linspace(0, 2*np.pi, 40)):
camera = dict(
eye=dict(x=2.5*math.cos(angle), y=2.5*math.sin(angle), z=1.5)
)
frames.append(go.Frame(
data=[base],
layout=dict(scene_camera=camera),
name=f"frame{i}"
))
fig = go.Figure(data=[base], frames=frames)
fig.update_layout(
title="RFT Solar1 Manifold (Auto-Rotation)",
scene=dict(
xaxis_title="X (Solar1)",
yaxis_title="Y (Solar1)",
zaxis_title="Z (Solar1)"
),
updatemenus=[dict(
type="buttons",
showactive=False,
buttons=[dict(
label="Rotate",
method="animate",
args=[None, {"frame": {"duration": 80, "redraw": True},
"fromcurrent": True}]
)]
)]
)
return fig
# ---------------------------------------------------------
# GRADIO APP WITH ALWAYS-VISIBLE EXPLANATIONS
# ---------------------------------------------------------
with gr.Blocks() as demo:
gr.Markdown("# **Rendered Frame Theory: Interactive Cosmology Lab**")
# Speed of Sight
with gr.Tab("Speed of Sight"):
gr.Markdown("""
### **What you're looking at**
**Speed of Sight (SoS)** compares:
- **Physical delay** — how long light actually takes to reach you
- **Perceptual delay** — your brain’s render cycle (milliseconds)
Even if light left a galaxy millions of years ago, your perceptual update time stays tiny.
You never “see the past” — you see a **rendered present**.
""")
with gr.Row():
with gr.Column():
dist = gr.Slider(0, 1.38e10, value=1e6, label="Distance (ly)")
AR = gr.Slider(1, 1000, value=100, label="AR_visual")
AT = gr.Slider(5, 200, value=50, label="A_T (ms)")
R = gr.Slider(1, 10, value=1, label="R_obs")
compute_btn = gr.Button("Compute")
anim_btn = gr.Button("Play Timeline Animation")
with gr.Column():
sos_val = gr.Number(label="Speed of Sight")
phys = gr.Number(label="Physical Delay (years)")
perc = gr.Number(label="Perceptual Delay (ms)")
sos_plot = gr.Plot(label="Delay Comparison")
sos_anim_plot = gr.Plot(label="Speed of Sight Timeline")
compute_btn.click(
sos_compute,
[dist, AR, AT, R],
[sos_val, phys, perc, sos_plot]
)
anim_btn.click(
sos_animation,
[dist, AR, AT, R],
sos_anim_plot
)
# Motion-Based Units
with gr.Tab("Motion-Based Units"):
gr.Markdown("""
### **What you're looking at**
This converts a distance in light‑years into **motion‑anchored units**:
- **LOU** — Earth’s orbital path
- **GVU** — Voyager 1’s verified displacement
- **Solar1** — humanity’s first interstellar baseline
Light‑years measure **delay**, not distance.
Motion‑anchored units measure **real displacement**, collapsing astronomical scales into physically meaningful numbers.
""")
with gr.Row():
with gr.Column():
dist2 = gr.Slider(0, 1e9, value=1e6, label="Distance (ly)")
unit = gr.Dropdown(["LOU", "GVU", "Solar1"], value="Solar1", label="Unit")
convert_btn = gr.Button("Convert")
with gr.Column():
unit_val = gr.Number(label="Distance in Selected Unit")
unit_plot = gr.Plot(label="Distance Comparison")
convert_btn.click(
units_compute,
[dist2, unit],
[unit_val, unit_plot]
)
# Paradoxes
with gr.Tab("RFT Paradoxes"):
gr.Markdown("""
### **What you're looking at**
**Andromeda–Voyager Paradox**
ΛCDM places Andromeda so far away that Voyager would need multiple universe lifetimes to reach it.
RFT places it at a physically reachable scale.
**Horizon Problem**
ΛCDM horizon is too small to explain CMB uniformity.
RFT horizon is ~490× larger.
**Density Inflation**
Mis‑scaled distances create the illusion of dark matter and dark energy.
These paradoxes dissolve when distance is anchored to traversal instead of delay.
""")
# Andromeda
and_btn = gr.Button("Compute Andromeda Paradox")
and_lcdm = gr.Number(label="Voyager Time (ΛCDM, years)")
and_rft = gr.Number(label="Voyager Time (RFT, years)")
and_ratio = gr.Number(label="Time Ratio (ΛCDM / RFT)")
and_plot = gr.Plot(label="Andromeda Distance Comparison")
and_btn.click(
andromeda_compute,
[],
[and_lcdm, and_rft, and_ratio, and_plot]
)
# Horizon
h_btn = gr.Button("Compute Horizon Comparison")
h_rft = gr.Number(label="RFT Horizon (Mpc)")
h_lcdm = gr.Number(label="ΛCDM Horizon (Mpc)")
h_ratio = gr.Number(label="Horizon Ratio (RFT / ΛCDM)")
h_plot = gr.Plot(label="Horizon Comparison")
h_btn.click(
horizon_compute,
[],
[h_rft, h_lcdm, h_ratio, h_plot]
)
# Density
d_btn = gr.Button("Compute Density Inflation")
d_factor = gr.Number(label="Density Inflation Factor")
d_plot = gr.Plot(label="Density Inflation")
d_btn.click(
dark_compute,
[],
[d_factor, d_plot]
)
# Expansion Animation
exp_plot = gr.Plot(label="Expansion Law Animation")
gr.Button("Play Expansion Animation").click(
lambda: expansion_animation(),
None,
exp_plot
)
# Solar1 Manifold
with gr.Tab("Solar1 Manifold"):
gr.Markdown("""
### **What you're looking at**
A rotating 3D map of galaxies expressed in **Solar1 units** — the distance humanity has actually travelled.
This reveals:
- smooth, continuous structure
- no “impossible early giants”
- no exotic formation scenarios
When measured in real traversal units, the universe behaves like a coherent physical system.
""")
manifold_plot = gr.Plot(label="Solar1 Manifold (Auto-Rotation)")
gr.Button("Load / Rotate Manifold").click(
lambda: generate_solar1_manifold_rotating(),
None,
manifold_plot
)
demo.launch()