コード例 #1
0
ファイル: env.py プロジェクト: mulderp/gnucap-jupyter
def fetch_results(nodes):
    w = gnucap.CKT_BASE_find_wave(nodes)

    xs = []
    ys = []
    for x, y in w:
        xs.append(x)
        ys.append(y)

    return (xs, ys)
コード例 #2
0
# Copyright (C) 2019 Felix Salfelder
# Author: Felix Salfelder <*****@*****.**>

import gnucap

print("testing key error")

gnucap.command("op")
try:
    gnucap.CKT_BASE_find_wave("doesntexist")
    print("FAIL")
except KeyError as e:
    print("OK, KeyError", e)

print("DONE")
コード例 #3
0
        g = coo_matrix((raw, zip(*coot)))
        print("shape2", f.get_shape())
        b = f.todense()
        print(b[0, 0])
        print(b[1, 1])

        print(b[:3, :3])

        acx.unallocate()
        # invalidates M
        self._sim.unalloc_vectors()

    def setup(self, cmd):
        pass

    def sweep(self):
        pass


myac = MyAC()
d0 = gnucap.install_command("myac", myac)

gnucap.command("op")
gnucap.command("myac")

w = gnucap.CKT_BASE_find_wave("vm(2)")

# d0=gnucap.install_command("myac", myac)

# vim:et
コード例 #4
0
# Author: Felix Salfelder <*****@*****.**>

from __future__ import print_function

import gnucap

gnucap.command("set lang spice")
gnucap.parse("V1 1 0 ac 1")
gnucap.command("set lang verilog")
gnucap.parse("capacitor #(.c(1u)) c(1 nout)")
gnucap.parse("resistor #(.r(1k)) s(nout 0)")

gnucap.command("store ac v(nout)")
gnucap.command("ac 1 1024 * 4")

w = gnucap.CKT_BASE_find_wave("v(nout)")

b = iter(w)

for i in range(6):
    n = next(b)
    print(n[0], ' {:.6e}'.format(n[1]))

try:
    next(b)
    assert (False)
except StopIteration:
    pass

for i in w:
    print(i[0], ' {:.6e}'.format(i[1]))
コード例 #5
0
ファイル: param.py プロジェクト: gnucap/gnucap-python
#!/usr/bin/env python

import gnucap

gnucap.command("print op hidden(0)")
gnucap.command("store op hidden(0)")
gnucap.command("op")
w = gnucap.CKT_BASE_find_wave("hidden(0)")

gnucap.command("param test=17")
gnucap.command("eval test")
gnucap.command("measure mm at(probe='hidden(0)')")

assert (17 == gnucap.eval("test"))
assert (0 == gnucap.eval("mm"))

for i in w:
    print(i)