periodic_metrics
Extract period, frequency, duty cycle, pulse widths, and jitter from oscillating transient signals in LTspice simulations. Configure threshold and time window to skip startup transients.
Instructions
Use for an oscillating transient signal (clock, oscillator output, switching waveform) when you need period, frequency, duty cycle, pulse widths, and period-to-period jitter.
Returns: period (mean across measured periods), frequency (1/period), jitter_rms (std-dev of period lengths — timing jitter, NOT signal amplitude variance), duty_cycle_pct, mean high/low pulse widths, edge counts. duty_cycle_pct / pulse_widths are null if no full periods could be paired.
Uses threshold crossings; threshold defaults to the midpoint of window min/max. For a signal with DC drift, set an explicit threshold — the auto midpoint moves with the drift and the edge detection gets unstable. min_periods guards against accidentally running on 1-edge windows.
Skip the startup transient via t_start/t_end; the first cycle is often wider than steady state. Rejects AC analysis. For a single edge (not periodic), use edge_metrics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| raw_file | Yes | Path to .raw transient result file | |
| signal | Yes | Signal name (e.g. 'V(clk)') | |
| step | No | Step index for .step sweeps | |
| t_start | No | Window start — recommended to skip the startup transient. | |
| t_end | No | Window end in SPICE notation | |
| threshold | No | Absolute threshold level. Auto = midpoint of window min/max. For drifting signals, set explicitly. | |
| min_periods | No | Minimum complete periods required; error if window has fewer. | |
| format | No | 'json' or 'text' |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | Yes | ||
| frequency | Yes | ||
| jitter_rms | Yes | ||
| duty_cycle_pct | No | ||
| pulse_width_high | No | ||
| pulse_width_low | No | ||
| num_rising_edges | Yes | ||
| num_falling_edges | Yes | ||
| num_periods_measured | Yes | ||
| threshold_used | Yes | ||
| warnings | Yes | ||
| signal | Yes |