Re: gnucap and python

"a r" <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
On 3/24/07, al davis <[email protected]> wrote:
>
> Use only the CMD::command(string) interface.  Since your plugin
> will be a class derived from CMD, you can just do
> command("string").

This sounds like a good low-level API. But from a convenient python
wrapper I would expect a bit higher level of abstraction.

How about building class hierarchy? Let me know what do you thing
about following sketch.

from Gnucap import Tran, NetGnucap, Wave, AsciiTabular, Measure
(exception should be thrown if some commands are not available)

net = NetGnucap.get("aCircuitFile")
net.xsubckt1.setBlockName("block2")
net.xsubckt1.MMload.setParam("w", 10e-6)

out = Wave(step=1e-6)
out.save(net.xsubckt1.net1, net.xsubckt1.net2)
out.setFormat(AsciiTabular())

sim = Tran(netlist = net, start=0, end=1e-3, output=out)
(or)
sim = Tran(net, out)
sim.setStart(0)
sim.setEnd(1e-3)

results = sim.run()

meas = Measure(results)

(ttrig, vtrig) = meas.tcross(signal=net.subckt1.net2,
threshold=net.subckt1.net1, direction=meas.rising, count=1)
print meas.avg(net.xsubckt1.net1, from=ttrig, to=(ttrig+0.1e-3))

-R.
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.