YAML-driven piecewise-linear waveform generator for circuit simulators — outputs CSV, SPICE PWL, LTspice PWL FILE=, and PLECS 1D lookup tables.
Define a load current waveform in YAML — with slew rates, hold times, and percentage amplitudes — and generate ready-to-use stimulus files for your simulator. Supports both absolute-timestamp steps (t+value) and duration-relative steps (hold+for), with per-step slew-rate overrides and automatic conflict resolution when a slew constraint pushes a breakpoint forward.
pip install wavecraft # once published to PyPI
pip install -e ".[dev]" # development install from sourcewavecraft examples/nvidia_pulse.yaml --formats ltspice,pwlLoading: examples/nvidia_pulse.yaml
Name : nvidia_gpu_pulse
Steps : 10
Breakpoints : 10
Duration : 128.00 µs (0.128 ms)
Peak : ...
Saved PWL : examples/nvidia_gpu_pulse.pwl
Saved LTspice : examples/nvidia_gpu_pulse_ltspice.pwl
| Key | Type | Description |
|---|---|---|
name |
string | Output filename stem |
nominal_current |
quantity | 100% reference, e.g. "240A" |
slew_rate |
quantity | Global slew rate, e.g. "6A/us" |
resolution |
quantity | CSV sampling period + ramp slot fallback when no slew, e.g. "1us" |
steps |
list | Sequence of waveform steps (see below) |
| Keys | Meaning |
|---|---|
hold: VALUE, for: DURATION |
Ramp to VALUE (using slew), then hold for DURATION |
t: TIME, value: VALUE |
Reach VALUE at absolute timestamp TIME |
slew_rate: RATE |
Optional per-step slew override (either step kind) |
VALUE accepts: "240A", "175%" (of nominal_current), "24mA"
TIME / DURATION accept: "500us", "5ms", "1s", "100ns"
name: my_load_step
nominal_current: "240A"
slew_rate: "6A/us"
resolution: "1us"
steps:
- {t: "0us", value: "0A"}
- {hold: "175%", for: "500us"}
- {hold: "360A", for: "5ms"}
- {t: "1s", value: "0A"}| Format | Extension | Use |
|---|---|---|
| CSV | .csv |
Columns: time_s, time_ms, time_us, amplitude_A — resampled at resolution |
| SPICE PWL | .pwl |
Inline PWL(...) element for LTspice / ngspice |
| LTspice PWL FILE= | _ltspice.pwl |
Two-column time(s) current(A) data file |
| PLECS | _plecs.py |
x and f_x vectors for a 1D Lookup Table block |
wavecraft INPUT [--out-dir DIR] [--dt TIME] [--formats LIST] [--plot]
INPUT Path to .yaml waveform definition
--out-dir DIR Output directory (default: same dir as input)
--dt TIME CSV resampling period override, e.g. 100ns
--formats LIST Comma-separated: csv,pwl,plecs,ltspice (default: all four)
--plot Show matplotlib preview (requires matplotlib)
from wavecraft import parse_yaml, build_breakpoints, export_ltspice_pwl
spec = parse_yaml("examples/nvidia_pulse.yaml")
bps = build_breakpoints(spec)
export_ltspice_pwl(bps, "output.pwl", spec=spec)Full public API: WaveformStep, WaveformSpec, parse_quantity, parse_yaml,
build_breakpoints, resample, export_csv, export_pwl, export_ltspice_pwl, export_plecs.
MIT