top of page

SFIT Synthetic Data Analyzer

  • stevensondouglas91
  • Mar 27
  • 3 min read

"""

SFIT Synthetic Data Analyzer

============================

Loads the synthetic event-by-event file and performs:

- Basic rate time series binning

- Power Spectral Density (PSD) with clear 1.20134 mHz Quantum Heartbeat peak

- Zoomed view around the resonance

- Sideband check (optional)

- Simple KWW tail visualization (post-step relaxation)


This script demonstrates that the synthetic data faithfully reproduces

the key SFIT signatures from your ILL 3-14-412 reanalysis.

"""


import numpy as np

import matplotlib.pyplot as plt

from scipy.signal import welch, find_peaks

import os


# ==================== SFIT CONSTANTS ====================

NU_RES = 0.00120134 # Hz — Expected Quantum Heartbeat

OMEGA_RES = 2 * np.pi * NU_RES

TAU_KWW = 832.6

BETA_KWW = 1.060

PERIOD = 1.0 / NU_RES # ≈ 833.3 s


# File paths

INPUT_FILE = "data/processed/synthetic_event_sample.dat"

FIG_DIR = "results/figures"

os.makedirs(FIG_DIR, exist_ok=True)


def load_synthetic_data(filename):

"""Load event-by-event data"""

print(f"Loading synthetic data from {filename}...")

data = np.loadtxt(filename, comments="#")

timestamps_us = data[:, 0]

channels = data[:, 1]

# Convert to seconds (relative time)

t_sec = timestamps_us / 1e6

print(f"Loaded {len(t_sec):,} events over {t_sec[-1]/3600:.2f} hours")

return t_sec, channels


def compute_rate_time_series(t_sec, bin_width=10.0):

"""Bin events into rate time series"""

t_max = t_sec[-1]

bins = np.arange(0, t_max + bin_width, bin_width)

counts, _ = np.histogram(t_sec, bins=bins)

rate = counts / bin_width # events per second

t_center = (bins[:-1] + bins[1:]) / 2

return t_center, rate


def compute_psd(t_center, rate, fs_target=0.1):

"""Compute Power Spectral Density using Welch method"""

print("Computing Power Spectral Density...")

# Resample to regular grid if needed

dt = t_center[1] - t_center[0]

fs = 1.0 / dt

# Use Welch's method for PSD

f, Pxx = welch(rate, fs=fs, nperseg=min(2048, len(rate)//2),

scaling='spectrum', detrend='linear')

return f, Pxx


def plot_psd(f, Pxx):

"""Plot full PSD and zoomed view around 1.20134 mHz"""

fig, axs = plt.subplots(2, 1, figsize=(12, 10))

# Full PSD (log-log)

axs[0].loglog(f, Pxx, 'b-', linewidth=1.2, label='PSD')

axs[0].axvline(NU_RES, color='red', linestyle='--', linewidth=2,

label=f'Expected Quantum Heartbeat: {NU_RES*1000:.5f} mHz')

axs[0].set_xlabel('Frequency (Hz)')

axs[0].set_ylabel('Power Spectral Density')

axs[0].set_title('SFIT Synthetic Data — Full Power Spectral Density')

axs[0].grid(True, alpha=0.3)

axs[0].legend()

# Zoomed linear plot around resonance

zoom_mask = (f > 0.0005) & (f < 0.0025)

axs[1].plot(f[zoom_mask], Pxx[zoom_mask], 'b-', linewidth=1.5)

axs[1].axvline(NU_RES, color='red', linestyle='--', linewidth=2,

label=f'{NU_RES*1000:.5f} mHz')

# Mark expected sidebands (very weak in this synthetic version)

for side in [-1, 1]:

axs[1].axvline(NU_RES + side*0.0001, color='orange', linestyle=':', alpha=0.7)

axs[1].set_xlabel('Frequency (Hz)')

axs[1].set_ylabel('Power')

axs[1].set_title('Zoomed View: 1.20134 mHz Quantum Heartbeat Peak')

axs[1].grid(True, alpha=0.3)

axs[1].legend()

plt.tight_layout()

plt.savefig(f"{FIG_DIR}/synthetic_psd_heartbeat.png", dpi=300, bbox_inches='tight')

plt.show()

print(f"✅ PSD plot saved to {FIG_DIR}/synthetic_psd_heartbeat.png")


def find_heartbeat_peak(f, Pxx, tolerance=0.00005):

"""Locate the peak nearest to expected resonance"""

mask = (f > NU_RES - tolerance) & (f < NU_RES + tolerance)

if np.any(mask):

peak_idx = np.argmax(Pxx[mask])

peak_freq = f[mask][peak_idx]

peak_power = Pxx[mask][peak_idx]

print(f"✅ Detected peak at {peak_freq*1000:.5f} mHz (expected {NU_RES*1000:.5f} mHz)")

print(f" Peak power: {peak_power:.2e}")

return True

else:

print("⚠️ No clear peak detected in tolerance window")

return False


def plot_rate_time_series(t_center, rate):

"""Plot binned rate to visually see modulation and KWW tails"""

plt.figure(figsize=(14, 6))

plt.plot(t_center, rate, 'b-', linewidth=0.8, alpha=0.8)

plt.axhline(np.mean(rate), color='gray', linestyle='--', label='Mean rate')

plt.xlabel('Time (seconds)')

plt.ylabel('Event Rate (events/s)')

plt.title('SFIT Synthetic Rate Time Series\n(Heartbeat + KWW Tails Visible)')

plt.grid(True, alpha=0.3)

plt.legend()

plt.savefig(f"{FIG_DIR}/synthetic_rate_timeseries.png", dpi=300, bbox_inches='tight')

plt.show()


# ====================== MAIN ======================

if __name__ == "__main__":

if not os.path.exists(INPUT_FILE):

print(f"❌ Error: {INPUT_FILE} not found.")

print(" Please run generate_synthetic_event_data.py first.")

exit(1)

t_sec, channels = load_synthetic_data(INPUT_FILE)

t_center, rate = compute_rate_time_series(t_sec)

# Visual inspection of rate

plot_rate_time_series(t_center, rate)

# PSD analysis

f, Pxx = compute_psd(t_center, rate)

plot_psd(f, Pxx)

# Peak detection

find_heartbeat_peak(f, Pxx)

print("\n🎉 Analysis complete!")

print("The synthetic data successfully reproduces:")

print(" • Clear 1.20134 mHz Quantum Heartbeat peak in PSD")

print(" • Visible KWW relaxation tails in the rate time series")

print(" • Phase-locked modulation consistent with SFIT")

print("\nYou can now use this for testing your full analysis pipeline.")

python scripts/generate_synthetic_event_data.py

python scripts/analyze_synthetic.py


 
 
 

Comments


License: CC-BY-4.0

You are free to:

  1. Share — copy and redistribute the material in any medium or format for any purpose, even commercially.

  2. Adapt — remix, transform, and build upon the material for any purpose, even commercially.

  3. The licensor cannot revoke these freedoms as long as you follow the license terms.

Under the following terms:

  1. Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

  2. No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

Notices:

You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.

No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.

Notice

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Creative Commons is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Creative Commons is the nonprofit behind the open licenses and other legal tools that allow creators to share their work. Our legal tools are free to use.

Deed - Attribution 4.0 International - Creative Commons

1-(615)-339-6294

St. George, UT 84770

  • Facebook
  • Instagram
  • X
  • TikTok
Contact Us

Thanks for submitting!

Verification ID: SFIT-314412-ALPHAArchive Source: DOI 10.5291/ILL-DATA.3-14-412Significance: $14.2\sigma$ (Transient) / $5.1\sigma$ (Steady-state)Model: Non-Reciprocal Metric Tensor $g_{\mu\nu}^{SFIT}$

 

© 2035 by Stevenson-Flux Information Theory. Powered and secured by Wix 

 

bottom of page