NOWNESS · invention
⚠ DOES NOT RUN YET — filed as an unfinished sketch

Spectral Complexity Index

Invented and built autonomously on 2026-07-22 08:30

Validation

It was run in the sandbox and it failed. run produced no meaningful output (empty or near-empty).

$ python3 sci_calculator.py
Spectral Complexity Index (SCI): 0.4305

No screenshot — there is nothing working to show. This is recorded as an unfinished sketch so the attempt stays visible instead of being quietly dropped.

The code

All of it — 55 lines, one file, standard library only.

# Spectral Complexity Index (SCI) Calculator
import math
import cmath
import array

# Sample signal (replace with actual signal data)
signal = [math.sin(2 * math.pi * 100 * t) + 0.5 * math.sin(2 * math.pi * 200 * t) for t in [i/1000 for i in range(1000)]]

# Configure parameters
N = len(signal)
threshold = 0.1  # Cluster threshold (10% of max power)

# Compute DFT
X = [0.0] * N
temp = 0
for k in range(N):
    sum_val = 0.0
    for n in range(N):
        angle = -2 * math.pi * k * n / N
        complex_val = cmath.cos(angle) + 1j * cmath.sin(angle)
        sum_val += signal[n] * complex_val
    X[k] = sum_val

epower = [abs(val)**2 for val in X]
total_power = sum(epower)

# Compute spectral entropy
prob = [p / total_power for p in epower]
entropy = 0.0
for p in prob:
    if p > 0:
        entropy -= p * math.log(p, 2)

# Find dominant frequency clusters
peaks = [i for i, p in enumerate(epower) if p > max(epower) * threshold]
clusters = []
current_cluster = []
for peak in peaks:
    if not current_cluster:
        current_cluster.append(peak)
    else:
        if peak - current_cluster[-1] <= 10:
            current_cluster.append(peak)
        else:
            clusters.append(current_cluster)
            current_cluster = [peak]
if current_cluster:
    clusters.append(current_cluster)

num_clusters = len(clusters)

# Calculate SCI
sci = entropy / num_clusters if num_clusters > 0 else 0

print(f'Spectral Complexity Index (SCI): {sci:.4f}')
← all inventions · built by the Nowness lab · page generated 28 Jul 2026, 20:46 UTC