numpy-numerical-analysis-4-fft-and-frequency-analysis
Sub-skill of numpy-numerical-analysis: 4. FFT and Frequency Analysis.
Best use case
numpy-numerical-analysis-4-fft-and-frequency-analysis is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Sub-skill of numpy-numerical-analysis: 4. FFT and Frequency Analysis.
Teams using numpy-numerical-analysis-4-fft-and-frequency-analysis should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/4-fft-and-frequency-analysis/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How numpy-numerical-analysis-4-fft-and-frequency-analysis Compares
| Feature / Agent | numpy-numerical-analysis-4-fft-and-frequency-analysis | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Sub-skill of numpy-numerical-analysis: 4. FFT and Frequency Analysis.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 4. FFT and Frequency Analysis
## 4. FFT and Frequency Analysis
**FFT for Spectral Analysis:**
```python
def compute_fft_spectrum(
time_series: np.ndarray,
dt: float,
window: str = 'hann'
) -> tuple[np.ndarray, np.ndarray]:
"""
Compute FFT spectrum of time series.
Args:
time_series: Time series data
dt: Time step
window: Window function ('hann', 'hamming', 'blackman')
Returns:
(frequencies, amplitude_spectrum)
"""
n = len(time_series)
# Apply window
if window == 'hann':
windowed = time_series * np.hanning(n)
elif window == 'hamming':
windowed = time_series * np.hamming(n)
elif window == 'blackman':
windowed = time_series * np.blackman(n)
else:
windowed = time_series
# Compute FFT
fft_result = np.fft.fft(windowed)
# Compute frequencies
frequencies = np.fft.fftfreq(n, d=dt)
# Amplitude spectrum (single-sided)
amplitude = np.abs(fft_result)[:n//2] * 2 / n
frequencies_positive = frequencies[:n//2]
return frequencies_positive, amplitude
# Example: Analyze wave elevation time series
import numpy as np
# Generate sample wave elevation (3 components)
t = np.linspace(0, 100, 10000) # 100 seconds, 10000 points
dt = t[1] - t[0]
# Wave components: 6s, 8s, 10s periods
wave = (
2.0 * np.sin(2*np.pi*t / 6) +
1.5 * np.sin(2*np.pi*t / 8) +
1.0 * np.sin(2*np.pi*t / 10)
)
# Add noise
wave += 0.2 * np.random.randn(len(t))
# Compute spectrum
freq, amplitude = compute_fft_spectrum(wave, dt, window='hann')
# Find peaks
peak_indices = np.argsort(amplitude)[-3:] # Top 3 peaks
peak_frequencies = freq[peak_indices]
peak_periods = 1 / peak_frequencies
print("Detected wave periods:")
for period in sorted(peak_periods, reverse=True):
print(f" T = {period:.2f} s")
```
**Power Spectral Density:**
```python
def compute_power_spectral_density(
time_series: np.ndarray,
dt: float,
nfft: int = None
) -> tuple[np.ndarray, np.ndarray]:
"""
Compute power spectral density using Welch's method.
Args:
time_series: Time series data
dt: Time step
nfft: FFT length (None = length of time series)
Returns:
(frequencies, PSD)
"""
from scipy import signal
# Compute PSD using Welch's method
frequencies, psd = signal.welch(
time_series,
fs=1/dt,
nperseg=nfft or len(time_series)//8,
window='hann'
)
return frequencies, psd
# Example: Wave spectral analysis
t = np.linspace(0, 3600, 36000) # 1 hour, 10 Hz sampling
dt = t[1] - t[0]
# JONSWAP spectrum simulation (simplified)
wave_elevation = np.random.randn(len(t)) * 2.0 # Simplified
freq, psd = compute_power_spectral_density(wave_elevation, dt)
# Calculate Hs from PSD
m0 = np.trapz(psd, freq) # Zero-order moment
Hs = 4 * np.sqrt(m0)
print(f"Significant wave height: {Hs:.2f} m")
```Related Skills
mnt-analysis-cleanup
Survey, classify, and clean up `/mnt/local-analysis/` (or any sibling-to-workspace-hub directory holding orphan worktrees, codex-burn artifacts, agent log accumulations, and outer-clone duplicates) without losing useful code/work. Surfaces a tiered approval menu rather than baking decisions; defers all destructive ops until user confirms.
repo-architecture-analysis
Scan a Python repo's package structure, count classes/functions, classify module maturity (PRODUCTION/DEVELOPMENT/SKELETON/GAP), and generate architecture reports with Mermaid diagrams. Use when asked to analyze codebase structure, find untested packages, or assess module maturity.
viv-analysis
Assess vortex-induced vibration (VIV) for risers and tubular members with natural frequency and safety factor calculations. Use for VIV susceptibility analysis, natural frequency calculation, vortex shedding assessment, and tubular member fatigue from VIV.
structural-analysis
Structural analysis for marine and offshore structures per DNV/API/ISO codes. Use when performing ULS/ALS limit state checks, column buckling, beam deflection, tubular joint capacity (DNV-RP-C203), or stiffened panel analysis. Covers section properties, combined loading, and ALS dented pipe assessment.
signal-analysis
Perform signal processing, rainflow cycle counting, and spectral analysis for fatigue and time series data. Use for analyzing stress time histories, computing FFT/PSD, extracting fatigue cycles (ASTM E1049-85), and batch processing OrcaFlex signals.
orcawave-qtf-analysis
Second-order wave force QTF computation in OrcaWave. Use when computing mean drift forces, difference-frequency or sum-frequency QTFs, slow-drift response, or applying Newman approximation for offshore structures.
orcaflex-modal-analysis
Perform modal and frequency analysis on OrcaFlex models to extract natural frequencies, mode shapes, and identify dominant DOF responses. Use for VIV assessment, resonance identification, and structural dynamics characterization.
orcaflex-jumper-analysis
Rigid and flexible jumper modelling in OrcaFlex covering installation analysis, in-place analysis, VIV screening, and fatigue assessment.
orcaflex-installation-analysis
Create and analyze OrcaFlex models for offshore installation sequences including subsea structure lowering, pipeline installation, and crane operations. Generate models at multiple water depths and orientations for installation feasibility studies.
orcaflex-extreme-analysis
Extract extreme response values with linked statistics from OrcaFlex simulations. Use for design load identification, max/min extraction with associated values, and extreme event characterization.
diffraction-analysis
Master skill for hydrodynamic diffraction analysis - AQWA, OrcaWave, and BEMRosetta integration
aqwa-analysis
Integrate with AQWA hydrodynamic software for RAO computation, damping analysis, and coefficient extraction. Hub skill — delegates to aqwa-input, aqwa-output, aqwa-reference for details.