Binds tibble::as_tibble() of every plot of a result. For a
spice_sweep from spice_sweep(), binds the tidy tibble of every
run, with the sweep's run index and swept parameters as the first
columns (one column per parameter, constant within a run): group by
run for one curve per run. When the
result mixes real and complex plots (e.g. a deck with .tran and
.ac), the tibble has value and the complex columns (re, im,
mag, db, phase), with NA where a column does not apply;
otherwise only the columns of its kind. See spice_plot for the
columns.
Selecting plots and variables
plots takes the labels of spice_plots(), their positions, or a
short name of the analysis, which selects every plot of that kind:
| short name | plot |
"op" | Operating Point |
"dc" | DC transfer characteristic |
"tran" | Transient Analysis |
"ac" | AC Analysis |
"noise" | Noise Spectral Density Curves |
"inoise" | Integrated Noise |
"tf" | Transfer Function |
"pz" | Pole-Zero Analysis |
"sens" | Sensitivity Analysis |
"sp" | SP Analysis |
"pss" | Time Domain Periodic Steady State Analysis |
"pss_spectrum" | Frequency Domain Periodic Steady State Analysis |
vars keeps the named variables, matched without regard to case; a
bare node name stands for its voltage ("out" is "v(out)").
See also
spice_wide() for one column per variable, spice_op()
for the operating point as a named vector.
Examples
res <- spice_run("rc\nvin 1 0 pulse(0 1)\nr1 1 2 1k\nc1 2 0 1u\n.tran 0.1m 5m\n.end")
spice_tidy(res)
#> # A tibble: 189 × 7
#> plot point scale_name scale variable type value
#> <chr> <int> <chr> <dbl> <chr> <chr> <dbl>
#> 1 Transient Analysis 1 time 0 v(1) voltage 0
#> 2 Transient Analysis 2 time 0.000001 v(1) voltage 0.01
#> 3 Transient Analysis 3 time 0.000002 v(1) voltage 0.02
#> 4 Transient Analysis 4 time 0.000004 v(1) voltage 0.04
#> 5 Transient Analysis 5 time 0.000008 v(1) voltage 0.08
#> 6 Transient Analysis 6 time 0.000016 v(1) voltage 0.16
#> 7 Transient Analysis 7 time 0.000032 v(1) voltage 0.32
#> 8 Transient Analysis 8 time 0.000064 v(1) voltage 0.64
#> 9 Transient Analysis 9 time 0.0001 v(1) voltage 1
#> 10 Transient Analysis 10 time 0.000106 v(1) voltage 1
#> # ℹ 179 more rows
res |> spice_tidy("tran", "v(2)")
#> # A tibble: 63 × 7
#> plot point scale_name scale variable type value
#> <chr> <int> <chr> <dbl> <chr> <chr> <dbl>
#> 1 Transient Analysis 1 time 0 v(2) voltage 0
#> 2 Transient Analysis 2 time 0.000001 v(2) voltage 0.00000999
#> 3 Transient Analysis 3 time 0.000002 v(2) voltage 0.0000250
#> 4 Transient Analysis 4 time 0.000004 v(2) voltage 0.0000849
#> 5 Transient Analysis 5 time 0.000008 v(2) voltage 0.000324
#> 6 Transient Analysis 6 time 0.000016 v(2) voltage 0.00128
#> 7 Transient Analysis 7 time 0.000032 v(2) voltage 0.00507
#> 8 Transient Analysis 8 time 0.000064 v(2) voltage 0.0200
#> 9 Transient Analysis 9 time 0.0001 v(2) voltage 0.0483
#> 10 Transient Analysis 10 time 0.000106 v(2) voltage 0.0544
#> # ℹ 53 more rows