On Wed, Oct 3, 2012 at 5:27 PM, zhengqing <
zhengq...@gmail.com> wrote:
> It works, and need to add a spline fitting function next.
wx.DC has a nifty spline drawing function, though you may want
something specific. I"d expect there is some coce out there for bezier
splines in numpy.python, though I haven't seen it.
> I am not sure if this is a good way to write classes. Please let me know if
> there is any suggestion that can make the code clean and easy to read and
> follow.
some comments:
* don't use numpy.oldnumeric if you can help it (and you probably
can). And the standard way to import numpy these days is:
import numpy as np
"""data1 = 2.*_Numeric.pi*_Numeric.arange(200)/200.
data1.shape = (100, 2)
data1[:,1] = _Numeric.sin(data1[:,0])
"""
can (and probably should) be written something like:
t = np.linspace(0, np.pi, 100)
data1 = np.column_stack( (t, np.sin(t)) )
* I think I'd keep a PlotGraphics object around in your DrawData
class, and have the various methods modify it, rather than make a new
one each time. That way you can split out axis labeling, etc.
but it generally looks pretty good.
-Chris