The Python Verification Script
- stevensondouglas91
- Mar 22
- 1 min read

import numpy as np
import matplotlib.pyplot as plt
from scipy.fft import fft, fftfreq
# --- 1. SET THE SFIT PARAMETERS ---
nu_echo = 0.0012 # The 1.2 mHz Predicted Heartbeat
T_period = 1 / nu_echo # ~833 seconds
duration = 5000 # Total observation time (seconds)
fs = 0.1 # Sampling rate (10 samples per second)
alpha = 0.05 # Modulation depth from k constant
# --- 2. GENERATE TIME-SERIES DATA ---
t = np.arange(0, duration, 1/fs)
# Standard Rabi Oscillation (Simulating a 10mHz transition)
rabi_freq = 0.01
standard_p = 0.5 * (1 + np.sin(2 * np.pi * rabi_freq * t))
# Apply the Stevenson-Flux Modulation (The 1.2 mHz Echo)
sfit_p = standard_p * (1 + alpha * np.cos(2 * np.pi * nu_echo * t))
# Add Gaussian Noise (Simulating detector background)
noise = np.random.normal(0, 0.02, len(t))
raw_data = sfit_p + noise
# --- 3. FOURIER ANALYSIS (The "Hunt" for 1.2 mHz) ---
# We subtract the mean to focus on the oscillations (residuals)
residuals = raw_data - np.mean(raw_data)
yf = fft(residuals)
xf = fftfreq(len(t), 1/fs)
# --- 4. VISUALIZATION ---
plt.figure(figsize=(12, 6))
# Plotting the Power Spectral Density
plt.plot(xf, np.abs(yf))
plt.xlim(0, 0.005) # Zooming in on the sub-mHz window
plt.axvline(x=nu_echo, color='r', linestyle='--', label='SFIT Prediction (1.2 mHz)')
plt.title("Power Spectral Density: Hunting for the Stevenson Resonance")
plt.xlabel("Frequency (Hz)")
plt.ylabel("Magnitude")
plt.legend()
plt.grid()
plt.show()




Comments