[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-79953":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":16,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":17,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":15,"starSnapshotCount":15,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},79953,"CUDA_spectrum","mebrown47\u002FCUDA_spectrum","mebrown47","A simple CUDA FFT spectrum tool","",null,"Python",79,9,4,0,1,3,"MIT License",false,"main",true,[23,24,25,26,27],"cuda","dsp","fft","sdr","spectrum-analyzer","2026-06-12 02:03:56","# cuda_spectrum\n\nGPU-accelerated spectrum analyzer. Reads interleaved float32 IQ samples from stdin, computes large FFTs on the GPU via cuFFT, outputs power spectrum to stdout and\u002For ZMQ. Built this for large FFT sizes and long integration times across saved datasets.\n\n\n## Build\n\n```bash\nnvcc -O2 -o cuda_spectrum main.cpp cuda_processing.cu -lcufft -lzmq\n```\n\n**Dependencies:**\n- CUDA toolkit (nvcc + cuFFT) — [nvidia.com\u002Fcuda](https:\u002F\u002Fdeveloper.nvidia.com\u002Fcuda-downloads)\n- libzmq: `sudo apt install libzmq3-dev`\n\nTested on NVIDIA RTX 30xx series GPU. Any CUDA-capable GPU should work.\n\n## Input format\n\nInterleaved float32 IQ: `I0 Q0 I1 Q1 …`\n\nMost SDR tools output int16 or int8. Convert with Python or csdr before piping:\n\n```bash\n# From SDR++ WAV (int16, skip 44-byte header)\npython3 -c \"\nimport numpy as np, sys\nwith open('capture.wav','rb') as f:\n    f.seek(44)\n    data = np.frombuffer(f.read(), dtype=np.int16).astype(np.float32) \u002F 32768.0\nsys.stdout.buffer.write(data.tobytes())\n\" | .\u002Fcuda_spectrum [options]\n\n# From RTL-SDR (int8 via rtl_sdr)\nrtl_sdr -f 435e6 -s 10e6 - | csdr convert_u8_f | .\u002Fcuda_spectrum [options]\n```\n\n## Options\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `-n N` | 1024 | IQ pairs per frame (input samples) |\n| `-f N` | 4096 | FFT size, must be power of 2 |\n| `-w TYPE` | blackman-harris | Window: `none hann hamming blackman blackman-harris flat-top` |\n| `-o FORMAT` | csv | Output format: `csv binary json` |\n| `--db` | off | Output raw dBFS instead of normalized 0–1 |\n| `-l N` | 0 | Limit to N frames (0 = unlimited) |\n| `-q` | off | Quiet mode (suppress stderr) |\n| `--zmq ENDPOINT` | — | Stream via ZMQ (e.g. `tcp:\u002F\u002F*:5555`) |\n| `--no-stdout` | off | Disable stdout (ZMQ-only mode) |\n\nSet `-n` equal to `-f` for maximum coherent integration per frame. Use `-n` \u003C `-f` for zero-padded interpolation.\n\n## Output formats\n\n**CSV** (default): `FRAME_START,N` \u002F one value per line \u002F `FRAME_END,N`\n\n**Binary** (`-o binary`): 4-byte int32 frame number + N × float32 spectrum values. Recommended for multi-frame captures — dramatically faster than CSV at large FFT sizes.\n\n**ZMQ**: Binary float32 vector, one message per frame.\n\n## Examples\n\n```bash\n# Sanity check — Gaussian noise through a 4K FFT\npython3 -c \"\nimport numpy as np, sys\nsys.stdout.buffer.write(np.random.randn(8192).astype(np.float32).tobytes())\n\" | .\u002Fcuda_spectrum -n 4096 -f 4096 -l 1\n\n# RF survey — 16M-point single frame, 0.6 Hz bins at 10 Msps\n.\u002Fcuda_spectrum -f 16777216 -n 16777216 -w blackman-harris --db -l 1 \\\n    \u003C capture.cf32 > spectrum_16M.csv\n\n# Multi-frame waterfall — binary output for speed\n.\u002Fcuda_spectrum -f 4194304 -n 4194304 -w blackman-harris --db -o binary \\\n    \u003C capture.cf32 > frames.bin\n\n# GPS L1 — live via HackRF + ZMQ to plotter\nhackrf_transfer -f 1575420000 -s 20000000 -g 40 -l 32 -a 1 -r - \\\n    | csdr convert_s8_f \\\n    | .\u002Fcuda_spectrum -f 4194304 -n 4194304 --zmq tcp:\u002F\u002F*:5555 --no-stdout -q\n```\n\n## FFT size guide\n\n| FFT size | Bins at 10 Msps | Integration |\n|----------|-----------------|-------------|\n| 1M (1048576) | 9.5 Hz | 0.10 s |\n| 4M (4194304) | 2.38 Hz | 0.42 s |\n| 16M (16777216) | 0.60 Hz | 1.68 s |\n| 64M (67108864) | 0.15 Hz | 6.71 s |\n\nLarger FFT = finer frequency resolution = more processing gain for weak signals.\n\n## Plotting\n\n`rf_plot.py` reads both CSV and binary output, produces PSD + waterfall PNG:\n\n```bash\n# Single frame from CSV\npython3 rf_plot.py spectrum_16M.csv --fft 16777216 --rate 10e6 --center 435e6\n\n# Multi-frame waterfall from binary\npython3 rf_plot.py frames.bin --binary --fft 4194304 --rate 10e6 --center 435e6\n\n# Zoom (no re-processing — resolution is already there)\npython3 rf_plot.py frames.bin --binary --fft 4194304 --rate 10e6 --center 435e6 \\\n    --zoom 434.5 435.5\n    \n```\n\n## Analysis (no plotting)\n\n`analyze_spectrum.py` reads binary output and prints statistics — no matplotlib required:\n\n```bash\npython3 analyze_spectrum.py frames.bin \\\n    --fft-size 4194304 \\\n    --samp-rate 10e6 \\\n    --center-freq 435e6\n\n# Limit to first 50 frames\npython3 analyze_spectrum.py frames.bin \\\n    --fft-size 4194304 \\\n    --samp-rate 10e6 \\\n    --center-freq 435e6 \\\n    --max-frames 50\n```\n\nOutputs per-frame statistics (average power, peak count) and top signals with frequency offset from center. Useful for quick triage before plotting.\n\nRequires: `numpy scipy`\nRequires: `numpy matplotlib scipy`\n","CUDA_spectrum 是一个基于 CUDA 的 GPU 加速频谱分析工具。它通过 cuFFT 在 GPU 上计算大规模 FFT，从标准输入读取交错的 float32 IQ 样本，并将功率谱输出到标准输出或 ZMQ。该工具特别适用于需要处理大数据集和长时间积分的大规模 FFT 场景。支持多种窗口类型、输出格式（CSV、二进制、JSON）以及 ZMQ 流传输。此外，CUDA_spectrum 还提供了丰富的命令行选项，如设置每帧样本数、FFT 大小、窗口类型等，以满足不同应用场景的需求。适用于无线电通信信号处理、频谱监测等领域。",2,"2026-06-11 03:58:41","CREATED_QUERY"]