resonance
Detect resonance peaks in AC sweeps to estimate Q factor and -3 dB bandwidth for RLC circuits, crystals, and peaking amplifiers.
Instructions
Detect magnitude peaks in an AC sweep and estimate Q factor + -3 dB bandwidth for each. Useful for RLC resonators, crystal oscillators, peaking amps, or any response with distinct resonant modes.
Q = f_peak / Δf(-3 dB from peak). Q is returned as null for peaks without two flanking -3 dB crossings inside the swept range — widen the sweep if you need Q for a boundary peak.
min_prominence_db=3 rejects the gentle hump of a filter's passband (which isn't a resonance). Tight resonances (Q > 30) need dense sampling near f_peak — log sweeps with <50 pts/decade will under-sample the peak and give inflated Q/bandwidth.
For overall filter characterization use bode_metrics(mode='filter'); for stability margins use stability_metrics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| step | No | Step index for .step sweeps | |
| format | No | ||
| job_id | No | Analyze a completed job run by id instead of a raw_file path; pair with ``run_index``. Lets you read a sweep / Monte-Carlo run's peaks. | |
| signal | Yes | Signal name (e.g. 'V(out)') | |
| raw_file | No | Path to AC analysis .raw result file. Pass this OR ``job_id`` (a job run), not both. | |
| max_peaks | No | Maximum peaks returned (1..1000) | |
| run_index | No | 0-based run to analyze when ``job_id`` is given (default 0). | |
| min_prominence_db | No | Minimum peak prominence in dB. Smaller = more sensitive but also catches gentle humps. 3 dB rejects filter-passband shoulders. | |
| min_separation_decades | No | Merge peaks closer than this many decades (find_peaks can emit duplicates on shoulders). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| peaks | Yes | ||
| signal | Yes | ||
| warnings | Yes | ||
| num_peaks_detected | Yes |