Spaces:
Running
Running
File size: 14,568 Bytes
694d729 5b79720 29a8b5e 5b79720 694d729 c001f41 22ed728 29db842 22ed728 c001f41 22ed728 c001f41 22ed728 c001f41 22ed728 c001f41 22ed728 694d729 280a9f5 22ed728 694d729 22ed728 694d729 22ed728 280a9f5 c001f41 280a9f5 694d729 280a9f5 c001f41 5b79720 280a9f5 ff00ded c001f41 ff00ded 280a9f5 694d729 22ed728 280a9f5 5222938 280a9f5 5222938 280a9f5 c001f41 5b79720 c001f41 5222938 c001f41 5b79720 c001f41 5222938 c001f41 280a9f5 5222938 280a9f5 c001f41 289fcd0 5222938 289fcd0 280a9f5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | import gradio as gr
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from scipy.integrate import quad
# ============================================================
# CUSTOM CSS FOR FULL-WIDTH PLOTS (GRADIO v4 COMPATIBLE)
# ============================================================
custom_css = """
#root, .gradio-container {
max-width: 100% !important;
}
.gradio-container .wrap {
flex-wrap: nowrap !important;
}
.gradio-container .gr-block {
width: 100% !important;
}
.gradio-container .gr-plot {
width: 100% !important;
height: auto !important;
}
.gradio-container .gr-panel {
width: 100% !important;
}
"""
# ============================================================
# RFT MASTER PARAMETERS (UNTOUCHED)
# ============================================================
MASTER_PARAMS = {
'p1_e': -0.5976, 'p2_e': 4.8900,
'p1_l': -3.1239, 'p2_l': 3.1852,
'nex_c': 0.0631, 't_z': 2.5, 'H0': 70.0
}
# ============================================================
# RFT HUBBLE FUNCTION
# ============================================================
def H_RFT(z, p1_e, p2_e, p1_l, p2_l, nex_c, t_z, H0):
s = 1.0 / (1.0 + np.exp(-5.0 * (z - t_z)))
curr_p1 = p1_e * s + p1_l * (1.0 - s)
curr_p2 = p2_e * s + p2_l * (1.0 - s)
tau = 1.0 * (1 + curr_p1 * z + curr_p2 * np.log(1.0 + z))
h_sum = sum(np.sin(z * n * 212.76) / n for n in range(4, 12))
return np.maximum(H0 * (1.0 - (tau - 1.0)) * (1.0 + nex_c * h_sum), 1.0)
# ============================================================
# AGE CALCULATOR
# ============================================================
def compute_age(z_target, params):
integrand = lambda z: 1.0 / ((1.0 + z) * H_RFT(z, **params))
age_gyr, _ = quad(integrand, z_target, 1000.0, limit=200)
return age_gyr * 977.8
# ============================================================
# MATURITY MODELS
# ============================================================
def smd_rft(z): return 8.5 - 0.45 * z
def smd_lcdm(z): return 8.0 - 0.6 * z
# ============================================================
# MAIN RFT DASHBOARD FUNCTION
# ============================================================
def rft_rcqm_unification_lab(p1_early_input, p2_early_input, nex_coupling_input):
params = MASTER_PARAMS.copy()
params.update({
'p1_e': p1_early_input,
'p2_e': p2_early_input,
'nex_c': nex_coupling_input
})
z_range = np.linspace(0, 15, 200)
h_vals = [H_RFT(z, **params) for z in z_range]
age_z13 = compute_age(13.67, params)
fig = make_subplots(
rows=1, cols=2,
column_widths=[0.65, 0.35],
subplot_titles=('Unified Expansion (H_RFT)', 'JWST Maturity Solution')
)
fig.add_trace(
go.Scatter(x=z_range, y=h_vals, mode='lines',
line=dict(color='#FF00FF', width=3)),
row=1, col=1
)
fig.add_hline(
y=70, line_dash='dot', line_color='grey',
row=1, col=1,
annotation_text='H0 = 70 km/s/Mpc',
annotation_position='bottom right'
)
z_high = np.linspace(7, 12, 100)
fig.add_trace(
go.Scatter(x=z_high, y=smd_rft(z_high),
line=dict(color='cyan', width=3)),
row=1, col=2
)
fig.add_trace(
go.Scatter(x=z_high, y=smd_lcdm(z_high),
line=dict(color='red', dash='dash')),
row=1, col=2
)
fig.update_layout(
template='plotly_dark',
showlegend=False,
height=800,
margin=dict(l=0, r=0, t=60, b=0),
title_text=f'RFT Unified Frame Lab — Age at z=13.67: {age_z13:.2f} Myr'
)
fig.update_yaxes(title_text='H(z) [km/s/Mpc]', row=1, col=1,
type='log', range=[0, 6])
fig.update_yaxes(title_text='log10 SMD', row=1, col=2)
fig.update_xaxes(title_text='Redshift z', row=1, col=1)
fig.update_xaxes(title_text='Redshift z', row=1, col=2)
horizon_ratio = 490.71
status = "VERIFIED" if abs(age_z13 - 568.78) < 1.0 else "UNSTABLE"
metrics = (
"### What You Are Looking At — RFT Unified Expansion Lab\n\n"
"This section presents the core of Rendered Frame Theory: a unified, "
"observer‑centric expansion law that replaces the stitched‑together eras "
"of the standard cosmological model with a single continuous behaviour. "
"Instead of treating the early universe, the matter era, and the late‑time "
"acceleration as separate regimes with separate physics, RFT models "
"expansion as a smooth, frame‑dependent rendering process.\n\n"
"The sliders allow you to adjust the early‑frame exponents and the "
"NexFrame coupling. These parameters control how the rendered expansion "
"rate transitions around the critical redshift of 2.5, where RFT predicts "
"a natural handover between early and late behaviour. This transition is "
"not an imposed boundary; it emerges from the observer‑dependent "
"rendering dynamics.\n\n"
"The left‑hand plot shows the Hubble parameter H(z) across cosmic time. "
"The curve includes both the smooth handover and the oscillatory "
"NexFrame contribution, which encodes the influence of rendering harmonics "
"on large‑scale expansion. The dotted line at H₀ = 70 km/s/Mpc is shown "
"for reference.\n\n"
"The Speed‑of‑Sight model, included in this repository, introduces a "
"measurable delay between physical events and their rendered perception. "
"This propagation speed of observation becomes a natural boundary "
"condition in RFT, reinforcing the idea that the observer’s frame is not "
"instantaneous, but dynamically updated. Whether the observer is "
"biological, mechanical, or informational, the rendering of reality "
"unfolds through this perceptual interface.\n\n"
"The right‑hand plot compares stellar mass density predictions. JWST has "
"revealed galaxies that appear far more mature, far earlier, than ΛCDM "
"allows. RFT predicts this naturally: if the universe is rendered "
"frame‑by‑frame for an observer, then structure does not need to “form” "
"in the traditional sense. It only needs to be rendered when "
"observationally required.\n\n"
f"**Age at z=13.67:** {age_z13:.2f} Myr ({status})\n\n"
f"**H(z=0):** {H_RFT(0, **params):.2f} km/s/Mpc\n\n"
f"**Horizon Ratio:** ~{horizon_ratio:.2f}× ΛCDM\n\n"
"In this lab, you are not just adjusting parameters. You are exploring how "
"an observer‑based universe behaves when expansion is treated as a rendered "
"process rather than a passive geometric evolution."
)
return fig, metrics
# ============================================================
# SOLAR1 MANIFOLD — VERIFIED PRESET
# ============================================================
def solar1_verified():
np.random.seed(42)
N = 500
x = np.random.normal(0, 3, N)
y = np.random.normal(0, 3, N)
z = np.random.normal(0, 3, N)
redshift = np.linspace(2, 14, N)
fig = go.Figure(data=[
go.Scatter3d(
x=x, y=y, z=z,
mode='markers',
marker=dict(
size=4,
color=redshift,
colorscale='Inferno',
opacity=0.85
)
)
])
fig.update_layout(
template='plotly_dark',
height=800,
margin=dict(l=0, r=0, t=60, b=0),
title="Verified Solar1 Manifold (Preset)",
scene=dict(
xaxis_title="X (Solar1 Units)",
yaxis_title="Y (Solar1 Units)",
zaxis_title="Z (Solar1 Units)"
)
)
md = """
### What You Are Looking At — Verified Solar1 Manifold
This visualisation shows the verified Solar1 manifold: a reconstruction based on
Voyager 1’s real traversal and the Solar1 scaling system. Solar1 units provide a
physically grounded coordinate system derived from an actual spacecraft’s motion,
rather than an abstract mathematical metric. This anchors the geometry of the
universe to a measurable baseline.
The 3D scatter represents points distributed according to the verified Solar1
structure. Each point carries a redshift value, shown using the Inferno scientific
colormap. The distribution reveals how redshift, spatial structure, and rendering
geometry interact within RFT.
In a rendered universe, geometry is not a fixed background. It is a dynamic,
observer‑dependent structure that updates as the observer moves through it. The
Solar1 manifold captures this idea by showing how a physically measured traversal
can define the shape of the rendered environment.
This manifold is a faithful reconstruction of the structure presented in the
Solar1 paper, demonstrating how RFT ties cosmic geometry to real measurements
rather than purely theoretical constructs. The result is a model where structure,
redshift, and rendering are tightly coupled.
By exploring this manifold, you are seeing how RFT replaces abstract spacetime
with a physically anchored, observer‑linked geometry.
"""
return fig, md
# ============================================================
# SOLAR1 MANIFOLD — DYNAMIC GENERATOR
# ============================================================
def solar1_dynamic(n_points, z_min, z_max, scatter, scale, mode):
if mode == "Sheet":
x = np.random.normal(0, scatter, n_points)
y = np.random.normal(0, scatter, n_points)
z = np.random.normal(0, 0.2 * scatter, n_points)
elif mode == "Sphere":
phi = np.random.uniform(0, 2*np.pi, n_points)
costheta = np.random.uniform(-1, 1, n_points)
u = np.random.uniform(0, 1, n_points)
theta = np.arccos(costheta)
r = scale * u**(1/3)
x = r * np.sin(theta) * np.cos(phi)
y = r * np.sin(theta) * np.sin(phi)
z = r * np.cos(theta)
elif mode == "Filament":
x = np.linspace(-scale, scale, n_points)
y = np.random.normal(0, scatter, n_points)
z = np.random.normal(0, scatter, n_points)
else: # Cloud
x = np.random.normal(0, scale, n_points)
y = np.random.normal(0, scale, n_points)
z = np.random.normal(0, scale, n_points)
redshift = np.linspace(z_min, z_max, n_points)
fig = go.Figure(data=[
go.Scatter3d(
x=x, y=y, z=z,
mode='markers',
marker=dict(
size=3,
color=redshift,
colorscale='Inferno',
opacity=0.85
)
)
])
fig.update_layout(
template='plotly_dark',
height=800,
margin=dict(l=0, r=0, t=60, b=0),
title="Dynamic Solar1 Manifold (Exploratory Mode)",
scene=dict(
xaxis_title="X (Solar1 Units)",
yaxis_title="Y (Solar1 Units)",
zaxis_title="Z (Solar1 Units)"
)
)
md = """
### What You Are Looking At — Solar1 Dynamic Generator
This section allows you to explore hypothetical manifolds under the Solar1 scaling
system. Unlike the verified manifold, these structures are not fixed predictions.
They are exploratory tools designed to help users build intuition about how rendering
geometries behave in an observer‑based universe.
You can choose between several distribution modes:
• **Cloud** — a loose, isotropic distribution representing a minimally structured
rendering environment.
• **Sheet** — a flattened distribution, useful for visualising how rendering might
behave in layered or planar geometries.
• **Sphere** — a radially symmetric distribution, showing how structures appear when
rendered around a central point or observer.
• **Filament** — a stretched, linear distribution, echoing the large‑scale cosmic
filaments seen in surveys.
The scatter points are coloured by redshift, allowing you to see how distance,
structure, and rendering interact. The Solar1 scaling ensures that all distances
are expressed in physically meaningful units derived from Voyager 1’s traversal.
This generator does not claim to represent verified RFT predictions. Instead, it
provides a sandbox where you can experiment with how different geometries behave
when interpreted through the lens of observer‑dependent rendering. It is a tool for
intuition, exploration, and conceptual understanding.
By adjusting the parameters, you can see how structure might appear if the universe
renders geometry according to the needs and position of the observer.
"""
return fig, md
# ============================================================
# GRADIO UI — TABS + SUBTABS
# ============================================================
rft_tab = gr.Interface(
fn=rft_rcqm_unification_lab,
inputs=[
gr.Slider(-5, 5, value=-0.5976, label="p1_early"),
gr.Slider(-5, 5, value=4.8900, label="p2_early"),
gr.Slider(0, 0.2, value=0.0631, label="nex_coupling")
],
outputs=[
gr.Plot(label="RFT Dashboard"),
gr.Markdown(label="Explanation & Verification Metrics")
],
title="RFT Unified Expansion Lab"
)
solar1_verified_tab = gr.Interface(
fn=solar1_verified,
inputs=[],
outputs=[gr.Plot(), gr.Markdown()],
title="Verified Solar1 Manifold"
)
solar1_dynamic_tab = gr.Interface(
fn=solar1_dynamic,
inputs=[
gr.Slider(100, 5000, value=500, label="Number of Galaxies"),
gr.Slider(0, 10, value=2, label="z_min"),
gr.Slider(5, 20, value=14, label="z_max"),
gr.Slider(0.1, 5, value=1, label="Scatter"),
gr.Slider(0.5, 10, value=3, label="Scale (Solar1 Units)"),
gr.Dropdown(["Cloud", "Sheet", "Sphere", "Filament"], value="Cloud", label="Distribution Type")
],
outputs=[gr.Plot(), gr.Markdown()],
title="Dynamic Solar1 Generator"
)
solar1_tab = gr.TabbedInterface(
[solar1_verified_tab, solar1_dynamic_tab],
["Verified Manifold", "Dynamic Generator"]
)
# ============================================================
# TOP-LEVEL BLOCKS
# ============================================================
with gr.Blocks(css=custom_css) as demo:
gr.TabbedInterface(
[rft_tab, solar1_tab],
["RFT Expansion Lab", "Solar1 Manifold Explorer"]
)
if __name__ == "__main__":
demo.launch()
|