Re: python bindings update

Patrick Mulder <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <CAEx2pddzdgntV0BeVmqCGnKOv2zDKY5jL1Uzb7mPgJRLoyy4ZQ@mail.gmail.com>
On Thu, Dec 27, 2018 at 5:58 PM Felix Salfelder <[email protected]> wrote:

> On Wed, Dec 26, 2018 at 05:08:09PM +0100, Patrick Mulder wrote:
>
> v1 1 0 pulse iv=0 pv=1
>
> perhaps you should also set rise to a positive value.
>
> thanks, I will use the param=... syntax. it's much better readable. also,
I found some user help in the docs on e.g. the transient command


> cmd("list") above. dumps the netlist to stdout.
>
>
yes, that works very nicely. Maybe for interactive sessions, it might be
nice to have:
gnucap.list()
wrapper, but very low prio, as the cmd("..") syntax works nicely already.

for now, it's probably most straightforward to access data through the
> wave store, as shown above. waves are iterable and yield pairs of
> double, perhaps you can pass it to a numpy array constructor or so.
>

yes, it works nicely, I use this:

w = gnucap.CKT_BASE_find_wave("v(1)")
xs=[]; ys = []
for (x,y) in w:
    xs.append(x)
    ys.append(y)



> ...
> (there are better and more immediate ways on the way, ETA unknown.)
>
yes, for my purposes, the current setup works fine already.


>
> > When I have this working, I can try to share the results in a Jupyter
> > notebook.
>
> sounds useful, please do. i'd like to add it to the examples.
>
I was able to run the gnucap python package in Python 2, for Python 3 (
which i use for Jupyter i get this, probably I am missing a build step to
build the module for Python3:

$ python3
Python 3.6.6 (default, Sep 12 2018, 18:26:19)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gnucap
POSIX ON
PYDDL'd
Traceback (most recent call last):
  File "/home/patrick/projects/gnucap/gnucap-python/gnucap/gnucap_swig.py",
line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in
import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
ImportError:
/home/patrick/projects/gnucap/gnucap-python/gnucap/_gnucap_swig.so:
undefined symbol: PyCObject_Type

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/patrick/projects/gnucap/gnucap-python/gnucap/__init__.py",
line 21, in <module>
    from .gnucap_swig import command, parse
  File "/home/patrick/projects/gnucap/gnucap-python/gnucap/gnucap_swig.py",
line 17, in <module>
    _gnucap_swig = swig_import_helper()
  File "/home/patrick/projects/gnucap/gnucap-python/gnucap/gnucap_swig.py",
line 16, in swig_import_helper
    return importlib.import_module('_gnucap_swig')
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in
import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_gnucap_swig'

PS I am taking some notes in a gitbook
https://mulder-patrick.gitbook.io/gnucap/ - will try to extend it "peu a
peu". Also, will try to play with diode, and DC sweeps for a transistor
next.
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.