<s> from scipy import arange , array <EOL> from scipy . integrate import odeint <EOL> from traits . api import Adapter , Array , Float , HasTraits , Instance , Property , Str , Unicode , adapts , cached_property , provides <EOL> from traitsui . api import View , Item <EOL> from i_model_3d import IModel3d , IModel3dIPlottable2dMixin <EOL> from i_plottable_2d import IPlottable2d <EOL> @ provides ( IModel3d ) <EOL> class Lorenz ( HasTraits ) : <EOL> """<STR_LIT>""" <EOL> name = Unicode ( '<STR_LIT>' ) <EOL> points = Property ( Array , depends_on = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> prandtl = Float ( <NUM_LIT> , auto_set = False , enter_set = True ) <EOL> rayleigh = Float ( <NUM_LIT> , auto_set = False , enter_set = True ) <EOL> beta = Float ( <NUM_LIT> / <NUM_LIT> , auto_set = False , enter_set = True ) <EOL> initial_point = Array ( value = [ <NUM_LIT:0.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> ] ) <EOL> time_start = Float ( <NUM_LIT:0.0> ) <EOL> time_stop = Float ( <NUM_LIT> ) <EOL> time_step = Float ( <NUM_LIT> ) <EOL> times = Property ( Array , depends_on = '<STR_LIT>' ) <EOL> view = View ( Item ( '<STR_LIT>' ) , <EOL> Item ( '<STR_LIT>' ) , <EOL> Item ( '<STR_LIT>' ) , <EOL> Item ( '<STR_LIT>' ) , <EOL> Item ( '<STR_LIT>' ) , <EOL> Item ( '<STR_LIT>' ) , <EOL> Item ( '<STR_LIT>' ) , <EOL> resizable = True ) <EOL> def compute_step ( self , point , time ) : <EOL> x , y , z = point <EOL> return array ( [ self . prandtl * ( y - x ) , <EOL> x * ( self . rayleigh - z ) - y , <EOL> x * y - self . beta * z ] ) <EOL> @ cached_property <EOL> def _get_points ( self ) : <EOL> return odeint ( self . compute_step , self . initial_point , self . times ) <EOL> @ cached_property <EOL> def _get_times ( self ) : <EOL> return arange ( self . time_start , self . time_stop , self . time_step ) <EOL> @ provides ( IPlottable2d ) <EOL> class LorenzIPlottable2dAdapter ( Adapter , IModel3dIPlottable2dMixin ) : <EOL> adaptee = Instance ( Lorenz ) <EOL> plot_type = Str ( '<STR_LIT>' ) <EOL> adapts ( LorenzIPlottable2dAdapter , Lorenz , IPlottable2d ) </s>
