File: README

package info (click to toggle)
gnucap-python 0.0.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,672 kB
  • sloc: python: 7,873; sh: 4,384; cpp: 1,786; makefile: 252
file content (87 lines) | stat: -rw-r--r-- 2,220 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
This package contains a python plugin for the circuit simulator Gnucap which
allows the user to implement commands or components (or anything) in Python,
and run the simulator in a python environment, e.g. for postprocessing or
plotting purposes.

The package also provides a command for gnucap that loads python modules, such
as python modules implementing custom commands or components (or anything).
See examples.

 Requirements
-------------

requirements are:
  * gnucap >= oct '17
  * Python >= 2.4
  * Swig
  * Numpy (with development headers/libraries)
  * c++11 (pass -std=c++11 to your compiler,
           if 11 is supported but the default is <11)

 NOTE
-------------

if you have installed gnucap with a custom prefix, try passing
LDFLAGS=-L$prefix/lib to configure, and also export
LD_LIBRARY_PATH=$prefix/lib when you run it.

*** on some systems /usr/local is considered "custom", on others a dirty cache
interferes with the linker. YMMV, tell me your workarounds ***

 Installation
-------------

Build python plugin for gnucap

::

   $ ./bootstrap
   $ ./configure  # pass PYTHON=some_other_python, to select
   $ make
   $ make check   # runs tests
   $ make install # optional. may require root privileges

will install the python module "gnucap" and a gnucap plugin "python".

Examples
--------

From gnucap
~~~~~~~~~~~

This seems outdated. See examples/README

::

   $ gnucap -a python.so
   gnucap> python example/loadplot.py        <= this file is missing, but still.
   gnucap> get example/eq2-145.ckt
   gnucap> store ac vm(2)
   gnucap> ac oct 10 1k 100k
   gnucap> myplot vm(2)

First the gnucap plugin is loaded. The second line loads a new command called
"myplot" that plots a stored waveform using matplotlib. Line 3-5 loads a
circuit and runs an ac analysis. Finally the ac magnitude of node 2 is plotted
using the new plotting command.

From Python
~~~~~~~~~~~

Do the same directly from Python

::

   $ python
   >>> import gnucap
   [..]
   welcome to gnucap-python
   >>> gnucap.stuff

stuff is not documented yet, see examples for some applications

Caveats
~~~~~~~

python scatters the planet with .pyc files containing cached bytecode. these
may lead to weird error messages.