[SciPy-user] getting values from traits objects

Stéfan van der Walt stefan@sun.ac...
Wed Nov 26 13:42:35 CST 2008


You need to put the linspace line in the class __init__ function, i.e.

class InputData(HasTraits):
 xmin=Float(default_value=.5)
 xmax=Float(default_value=2.0)
 xres=Int(128)

 def __init__(self):
     x=linspace(self.xmin, self.xmax, self.xres)

Cheers
Stéfan

2008/11/26 gross <olof.gross@student.gu.se>:
>
> I'm obviously missing something very basic, can someone please explain to me
> what i've done wrong in this example:
>
> [code]
> from enthought.traits.api import HasTraits, Float, Int
> from scipy import linspace
>
> class InputData(HasTraits):
>  xmin=Float(default_value=.5)
>  xmax=Float(default_value=2.0)
>  xres=Int(default_value=128)
>  x=linspace(xmin, xmax, xres)


More information about the SciPy-user mailing list