File: store.py

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 (35 lines) | stat: -rw-r--r-- 642 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
# Copyright (C) 2018 Felix Salfelder
# Author: Felix Salfelder <felix@salfelder.org>

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]))


print("done")