Skip to contents

spice_read_raw() reads a SPICE3 rawfile (ASCII or binary, as written by spice3 -r, ngspice -r or spice_write_raw()) into a spice_result. spice_write_raw() writes a result's plots, or a single plot, back to back as the SPICE3 raw_write does.

Usage

spice_read_raw(path)

spice_write_raw(x, path, format = c("binary", "ascii"))

Arguments

path

Path of the rawfile.

x

A spice_result or a spice_plot.

format

"binary" (the default, as spice3 -r writes) or "ascii".

Value

spice_read_raw(): a spice_result whose notes hold the reader's warnings and whose title is the first plot's title.

spice_write_raw(): path, invisibly.

Details

A rawfile does not record which vector is the scale: like the 3f5 reader, spice_read_raw() takes the first vector of each plot as its scale, so an operating-point plot read back has its first variable as scale while the one from spice_run() has none. All else (names, types, values, header fields) round-trips exactly through the binary format; the ASCII format keeps 15 significant digits, like SPICE3.

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")
f <- tempfile(fileext = ".raw")
spice_write_raw(res, f)
spice_read_raw(f)
#> <spice_result> rc
#> 1 plot:
#> • Transient Analysis: 4 variables x 63 points, real, scale time