// 5-Mode Schumann Spectrogram visualization import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Progress } from '@/components/ui/progress'; import { Activity, Radio, Waves } from 'lucide-react'; import type { SchumannFeatures } from '@/lib/earth-data-loader'; interface Props { currentSchumann: SchumannFeatures | null; coherenceIndex: number; } export function SchumannSpectrogramPanel({ currentSchumann, coherenceIndex }: Props) { if (!currentSchumann) { return (
Loading Schumann data...
); } const modes = [ { freq: 7.83, label: 'Mode 1', amplitude: currentSchumann.A7_83, envelope: currentSchumann.envelope_7_83, color: 'bg-destructive', key: 'C' }, { freq: 14.3, label: 'Mode 2', amplitude: currentSchumann.A14_3, envelope: currentSchumann.envelope_14_3, color: 'bg-warning', key: 'G' }, { freq: 20.8, label: 'Mode 3', amplitude: currentSchumann.A20_8, envelope: currentSchumann.envelope_20_8, color: 'bg-warning', key: 'D' }, { freq: 27.3, label: 'Mode 4', amplitude: currentSchumann.A27_3, envelope: currentSchumann.envelope_27_3, color: 'bg-success', key: 'A' }, { freq: 33.8, label: 'Mode 5', amplitude: currentSchumann.A33_8, envelope: currentSchumann.envelope_33_8, color: 'bg-primary', key: 'E' } ]; const maxAmplitude = Math.max(...modes.map(m => m.amplitude)); return (
Schumann Spectrogram 0.75 ? "default" : "secondary"}> Coherence: {(coherenceIndex * 100).toFixed(1)}%
{/* Spectrogram bars */}
{modes.map((mode) => { const heightPercent = maxAmplitude > 0 ? (mode.amplitude / maxAmplitude) * 100 : 0; return (
{mode.freq} Hz
{mode.key}
); })}
{/* Mode details */}
{modes.map((mode) => (
{mode.label}
{mode.amplitude.toFixed(3)}
A: {mode.envelope.toFixed(3)}
))}
{/* Timestamp */}
{currentSchumann.timestamp_utc}
); }