|
From: Rich S. <rsh...@ap...> - 2007-11-24 23:18:05
|
On Sun, 25 Nov 2007, Angus McMorland wrote:
> I'm not completely sure, but I suspect that this is an implementation bug,
> rather than a version bug, particularly because the line in question isn't
> involving matplotlib at all. If you post the relevant code
> (normal-curve.py, by the looks of things), it might be easy to spot the
> problem.
Angus,
I've seen the same error trying to plot other curves in the past couple of
days, but not those using the Boltzmann distribution. Here's the file:
import matplotlib.numerix as nx
import pylab as p
from math import *
center = 50.0
fwhm = 50.0
def fwhm2k(fwhm):
'''converts fwhm value to k (see above)'''
return fwhm/(2 * nx.sqrt(nx.log(2)))
def gauss1d(r, fwhm, center):
'''returns the 1d gaussian given by fwhm (full-width at half-max),
and c (centre) at positions given by r
'''
return exp(-(r-center)**2 / fwhm2k(fwhm)**2)
x = nx.arange(0, 100, 0.1)
G = gauss1d(x, fwhm, center)
p.plot(x, G, color='red', lw=2)
p.axis([0, 100, 0.0, 1.0])
p.xlabel('Universe of Discourse')
p.ylabel('Membership Grade')
p.show()
> I've found it easiest to solve these sorts of bugs by running the code in
> an ipython shell, with automatic pdb calling. That way you can inspect the
> values of the parameters in question - one of which is, I think, the
> problem here.
I've not run ipython with pdb; I'll look at the docs to learn how. I do
use winpdb on the application.
Thanks,
Rich
--
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
|