output commands (Re: gnucap sandbox)

Felix Salfelder <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
Hi Patrick

Thanks for your mail.

> 1) i want to save all data from a simulation session into a csv file. i
> thought it would be nice to have a command csv "data.csv" - from there it
> would be possible to do some plots (with e.g. xls or matplotlib). i got a
> basic command working, but not sure where to take the data from

when you run a command like
gnucap> transient 1 2 3 > data.out
the data that would otherwise be printed will end up in a file. it is
not csv, but a simpler format. a format that gnuplot and gwave
can read. you could use a small class as in [1] to read it from
within python.

you could write a small program that converts to some other format, and
run it as in
gnucap> transient 1 2 3 | anyprogram
i have not used this much -- passing arguments or redirecting further
seems not implemented, definitely something worth adding...

some day, the notorious output-pluggability will allow to do pretty much
exactly what you are suggesting. there is a demo hdf command [2] which
shows the intended use. the demo command syntax is something like
gnucap> hdfprobe tran v(nodes)
gnucap> tran 1 2 3.
a similar plugin could then implement csv.

cheers
felix

[1] https://codeberg.org/gnucap/gnucap-python/src/branch/develop/examples/dataparse.py
[2] https://git.savannah.gnu.org/cgit/gnucap.git/log/?h=hdf-14
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.