export_waveform
Export full-fidelity waveform samples to a CSV file for your own FFT, custom metrics, or cross-correlation, without decimation, preserving all data points.
Instructions
Full-fidelity waveform egress: write every sample of one or more signals to a CSV file on disk and return its path — for when you want to compute on the raw data yourself (FFT, custom metrics, cross-correlation) rather than read a scalar or a decimated envelope.
Lossless within the chosen window (no decimation — that is get_waveform's job). Works on transient (.tran), DC sweep (.dc), AC (.ac), and noise (.noise). Complex AC traces are written as magnitude(dB)+phase(deg) by default (complex_format selects re/im or both); phase is the wrapped np.angle — run np.unwrap yourself for a continuous curve. A stepped (.step / Monte-Carlo) run is written tidy/long: one row per (step, sample) with leading step_index/step_value columns, because each transient step has its own time vector. The observations list surfaces FACTS (rows written, window coverage, non-finite samples KEPT, the complex format used) — not verdicts.
Returns the CSV path plus row/column counts; read the file with your own tools. Sibling egress, don't confuse: get_waveform returns a DECIMATED envelope as numbers in your context (no file); plot_waveform renders an interactive PICTURE for a human. For a single scalar use signal_stats/query_value.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| t_end | No | Window end in SPICE notation. | |
| format | No | Response format: 'json' for structured data, 'text' for human-readable | |
| job_id | No | Export a specific run of a completed sweep/MC (or single) job instead of a raw_file path; pair with ``run_index``. | |
| out_dir | No | Directory to write the CSV into (resolved under an allowed path; created if needed). Default: a '.ltspice-mcp/waveforms/' sidecar next to the circuit for a job_id, or next to the raw for a raw_file. | |
| signals | No | Trace names to export (e.g. ['V(out)', 'I(R1)']) or 'all' for every non-axis trace. Device operating-point params work too, by name or shorthand (e.g. ['m1.gm', 'm1.gds', 'm1.id']) — across a `.dc` sweep with `.save @m1[…]` this is the gm/ID-table read, one CSV. | all |
| t_start | No | Window start in SPICE notation (e.g. '1m', '100u', '1k'). Bounds the export by windowing, not decimation — full fidelity inside the window. | |
| raw_file | No | Path to .raw result file. Pass this OR ``job_id`` (a job run), not both. | |
| run_index | No | 0-based run to read when ``job_id`` is given (default 0). | |
| complex_format | No | How complex AC traces become columns: 'mag_phase' = magnitude(dB) + phase(deg) [default], 're_im' = real + imag, 'both' = all four. Ignored for real-valued (.tran/.dc/.noise) traces. | mag_phase |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | ||
| columns | No | ||
| n_steps | No | ||
| signals | No | ||
| row_count | No | ||
| window_used | No | ||
| column_count | No | ||
| observations | No | ||
| analysis_type | No | ||
| complex_format | No |