foortex.codegen utility
PythonNeurotech 1120 9.8k

Python SciPy Welch Power Spectral Density (PSD) Band Power Extractor

EEG frequency domain analysis script. Applies Welch periodogram PSD estimation to compute spectral power ratios for cognitive state assessment.

SciPy welch periodogram estimation
Relative band power ratios
Interactive Prompt & Options
Fully Editable

Appended directly to the LLM system prompt for tailored code output.

✨ OpenRouter LLM Engine (Llama-3.3-70B) Active

Generated Code

⚡ Instant Boilerplate
python-scipy-eeg-power-spectral-density.py
1import numpy as np
2from scipy.signal import welch
3
4def compute_band_powers(data: np.ndarray, fs: float = 250.0):
5 freqs, psd = welch(data, fs=fs, nperseg=fs*2)
6 alpha = np.trapz(psd[(freqs >= 8) & (freqs <= 12)])
7 beta = np.trapz(psd[(freqs >= 13) & (freqs <= 30)])
8 return {"alpha": alpha, "beta": beta}
9
9 lines • 317 bytespython
Automated Sandbox

Deploy this boilerplate automatically in 1 click.

Deploy