This test implements the CCF prediction that the effective decoherence rate depends linearly on a “coherence load” L at fixed hardware and environment, according to

\Gamma_{\text{eff}}(L) = \Gamma_{\text{env}}[1 + \chi (L/L_I)], so that the excess-decoherence signature is \Delta\Gamma(L) = \Gamma_{\text{eff}}(L) - \Gamma_{\text{env}} = \chi,\Gamma_{\text{env}}(L/L_I). The code below generates synthetic data from this model for a chosen \chi_{\text{true}}, adds Gaussian noise, and then fits a straight line in L to recover an estimated \chi; by varying the noise level and the range/density of L-values, users can see when the CCF slope is statistically distinguishable from a χ = 0 null model.

import numpy as np

import matplotlib.pyplot as plt

from scipy import stats

# --- CCF-inspired decoherence model ---

# Gamma_eff(L) = Gamma_env * [1 + chi * (L / L_I)]

# DeltaGamma(L) = Gamma_eff(L) - Gamma_env = chi * Gamma_env * (L / L_I)

# 1. Choose "true" parameters (edit these as you like)

Gamma_env = 1.0 # baseline decoherence rate

chi_true = 0.3 # true coherence-capacity strength

L_I = 5.0 # reference complexity scale

# 2. Choose coherence-load values L (try changing this)

L_values = np.linspace(1, 20, 20) # 20 points from L=1 to L=20

# 3. Simulate data from the model with noise

np.random.seed(0) # for reproducibility

noise_sigma = 0.15 # noise level; try 0.05, 0.1, 0.2, etc.

Gamma_eff_true = Gamma_env * (1 + chi_true * (L_values / L_I))

Gamma_eff_obs = Gamma_eff_true + np.random.normal(0, noise_sigma, size=L_values.shape)

# 4. Fit a straight line: Gamma_eff(L) ≈ a + b * L

slope, intercept, r_value, p_value, std_err = stats.linregress(L_values, Gamma_eff_obs)

# 5. Map slope b back to an estimated chi

# From the model: b = Gamma_env * chi / L_I => chi_est = b * L_I / Gamma_env

chi_est = slope * L_I / Gamma_env

print(f"True chi: {chi_true:.3f}")

print(f"Estimated chi: {chi_est:.3f}")

print(f"p-value for slope != 0: {p_value:.3e}")

# 6. Plot data and fitted line

L_fit = np.linspace(L_values.min(), L_values.max(), 200)

Gamma_fit = intercept + slope * L_fit

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

plt.scatter(L_values, Gamma_eff_obs, label='Simulated data')

plt.plot(L_fit, Gamma_fit, 'r-', label='Linear fit')

plt.xlabel("Coherence load L")

plt.ylabel("Effective decoherence rate Γ_eff(L)")

plt.legend()

plt.grid(True)

plt.show()

Reply to this note

Please Login to reply.

Discussion

No replies yet.