Comments (10)
I just checked with most recent ahkab and
numpy-1.7.1
scipy-0.13.0.dev-c31f167
sympy-0.7.3
matplotlib-1.3.0
and didn't get that error. I'll update my F19 system after exams and try and reproduce, but this may be an upstream problem. What version of matplotlib are you using?
It looks like numpy changed around a handful of things from 1.7 to 1.8, as per release notes, could be related.
from ahkab.
with
matplotlib-1.3.1-1
I think it relate to the problem of plot r['tran']['T'], the error occurs there.
from ahkab.
Thanks for the bug report!
Also good to know matplotlib 1.3.0 is unaffected.
I can reproduce this with this setup:
>>> import numpy, scipy, matplotlib
>>> for i in numpy, scipy, matplotlib:
... print i.__version__
...
1.7.1
0.12.0
1.3.1
I'll be looking into this and I'll try to come up with a patch shortly.
I'll be looking at the changes in numpy too while I'm at it.. :)
Cheers!
from ahkab.
It is indeed a bug upstream in matplotlib.
I can reproduce the same RuntimeError: maximum recursion depth exceeded
with just:
import pylab as plt
import numpy as np
a = np.mat([1, 2, 3])
plt.plot(a)
This merge is said to fix the issue: matplotlib/matplotlib#2290
It was merged yesterday to the git matplotlib repo, it will take a bit for package mantainers to add the patch to their code bases I'd expect.
A quick work-around is to pass all your data through np.array()
before plotting it. It requires modifying your files, sorry about that.
If need be, a temporary work-around targeted to matplotlib 1.3.1 can be introduced in the data interface. If you guys think it is a good idea, please let me know.
Best,
Giuseppe
from ahkab.
Kinda off topic but numpy 1.8 seems relatively safe to me. I see no worrisome changes. It was a nice read too!
from ahkab.
I tried np.array, how ever the data become multi-dimensional and the legend is a mess.
BTW: I am new to python maybe I need to learn more about the coding style to catch up.
from ahkab.
Here is what I was referring to:
import numpy as np
import ahkab
from ahkab import ahkab, circuit, printing, devices
mycircuit = circuit.circuit(title="Butterworth Example circuit", filename=None)
gnd = mycircuit.get_ground_node()
mycircuit.add_resistor(name="R1", ext_n1="n1", ext_n2="n2", R=600)
mycircuit.add_inductor(name="L1", ext_n1="n2", ext_n2="n3", L=15.24e-3)
mycircuit.add_capacitor(name="C1", ext_n1="n3", ext_n2=gnd, C=119.37e-9)
mycircuit.add_inductor(name="L2", ext_n1="n3", ext_n2="n4", L=61.86e-3)
mycircuit.add_capacitor(name="C2", ext_n1="n4", ext_n2=gnd, C=155.12e-9)
mycircuit.add_resistor(name="R2", ext_n1="n4", ext_n2=gnd, R=1.2e3)
voltage_step = devices.pulse(v1=0, v2=1, td=500e-9, tr=1e-12, pw=1, tf=1e-12, per=2)
mycircuit.add_vsource(name="V1", ext_n1="n1", ext_n2=gnd, vdc=5, vac=1, function=voltage_step)
printing.print_circuit(mycircuit)
op_analysis = ahkab.new_op()
ac_analysis = ahkab.new_ac(start=1e3, stop=1e5, points=100)
tran_analysis = ahkab.new_tran(tstart=0, tstop=1.2e-3, tstep=1e-6, x0=None)
r = ahkab.run(mycircuit, an_list=[op_analysis, ac_analysis, tran_analysis])
import pylab
fig = pylab.figure()
pylab.title(mycircuit.title + " - TRAN Simulation")
T = np.array(r['tran']['T'])
VN1 = np.array(r['tran']['VN1'])
VN4 = np.array(r['tran']['VN4'])
w = np.array(r['ac']['w'])
absVN4 = np.array(r['ac']['|Vn4|'])
argVN4 = np.array(r['ac']['arg(Vn4)'])
pylab.plot(T, VN1, label="Input voltage")
pylab.hold(True)
pylab.plot(T, VN4, label="output voltage")
pylab.legend()
pylab.hold(False)
pylab.grid(True)
pylab.ylim([0,1.2])
pylab.ylabel('Step response')
pylab.xlabel('Time [s]')
fig.savefig('tran_plot.png')
fig = pylab.figure()
pylab.subplot(211)
pylab.semilogx(w, absVN4, 'o-')
pylab.ylabel('abs(V(n4)) [V]')
pylab.title(mycircuit.title + " - AC Simulation")
pylab.subplot(212)
pylab.grid(True)
pylab.semilogx(w, argVN4, 'o-')
pylab.xlabel('Angular frequency [rad/s]')
pylab.ylabel('arg(V(n4)) [rad]')
fig.savefig('ac_plot.png')
pylab.show()
Hopefully that bug will be fixed downstream quickly enough. The above is a temporary solution (slightly more verbose...)
Best, GV
from ahkab.
It works! I for got to delete the transpose operator .T
from ahkab.
This should be fixed in 4c2dbe6, independently from whether your matplotlib version is affected by this regression or not.
from ahkab.
Also it should be transparent to you, whether you are passing your results through array()
or not makes no difference. And no need for the ugly transpose operator .T
anymore.
from ahkab.
Related Issues (20)
- Issue with ankab HOT 5
- Tran example : 'op_solution' object has no attribute 'asmatrix' HOT 5
- voltage pulse source for a MOS inverter + questions HOT 4
- Zener Diode HOT 2
- Subcircuit call problem HOT 1
- RL circuit vs. LR circuit: different output HOT 5
- Plot circuit HOT 1
- Voltage-Controlled Switch Issue HOT 1
- Issue with a switch
- Compute on GPU using TensorFlow
- Verification RC cutoff frequency HOT 1
- error in AC and TRAN tutorial
- AttributeError: module 'pylab' has no attribute 'hold' HOT 3
- ImportError: No module named matplotlib.pyplot HOT 1
- Help : Finding current through a resistor
- Cant define diode HOT 1
- Help : Modeling a circuit with parallel components HOT 2
- Locale appears not set HOT 2
- How to use User definement device with non-linear property
- print_symbolic_results / print_symbolic_transfer_functions: sort key bug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ahkab.