5. Enthought Python Distribution (EPD)
Selections from our training courses including:
explanations, demonstrations, and tips
For subscribers to Enthought Python Distribution
(EPD)
Offered once a month for 60-90 minutes
depending on questions
Monday, February 22, 2010
6. Enthought Training Courses
Python Basics, NumPy,
SciPy, Matplotlib, Traits,
TraitsUI, Chaco…
Monday, February 22, 2010
7. Upcoming Training Classes
September 21 – 25, 2009
Introduction to Scientific Computing with Python
Austin, Texas
October 19 – 22, 2009
Python for Science, Eng., and Financial Analysis
Silicon Valley, California
November 9 – 12, 2009
Python for Science, Eng., and Financial Analysis
Chicago, Illinois
December 7 – 11, 2009
Introduction to Scientific Computing with Python
Austin, Texas
http://www.enthought.com/training/
Monday, February 22, 2010
12. Introduction
• Chaco is a plotting application toolkit
• You can build simple, static plots
Monday, February 22, 2010
13. Introduction
• Chaco is a plotting application toolkit
• You can build simple, static plots
• You can also build rich, interactive
visualizations:
Monday, February 22, 2010
14. “Script-oriented” Plotting
• from numpy import *
• from enthought.chaco.shell import *
• x = linspace(-2*pi, 2*pi, 100)
• y = sin(x)
• plot(x, y, 'r-')
• title('First plot')
• ytitle('sin(x)')
• show()
Monday, February 22, 2010
34. Tool Chooser
from enthought.traits.ui.api import CheckListEditor
class ToolsExample(HasTraits):
plot = Instance(Plot)
tools = List(editor=CheckListEditor(values = ["PanTool",
"SimpleZoom", "DragZoom"]))
Monday, February 22, 2010
35. Tool Chooser
from enthought.traits.ui.api import CheckListEditor
class ToolsExample(HasTraits):
plot = Instance(Plot)
tools = List(editor=CheckListEditor(values = ["PanTool",
"SimpleZoom", "DragZoom"]))
def __init__(self):
x = linspace(-14, 14, 500)
y = sin(x) * x**3
plotdata = ArrayPlotData(x = x, y = y)
plot = Plot(plotdata)
plot.plot(("x", "y"), type="line", color="blue")
plot.tools.append(PanTool(plot))
plot.tools.append(ZoomTool(plot))
plot.tools.append(DragZoom(plot, drag_button="right"))
self.plot = plot
Monday, February 22, 2010
36. Tool Chooser
def _tools_changed(self):
classes = [eval(class_name) for class_name in self.tools]
for tool in self.plot.tools:
if tool.__class__ not in classes:
self.plot.tools.remove(tool)
else:
classes.remove(tool.__class__)
for cls in classes:
self.plot.tools.append(cls(self.plot))
return
Monday, February 22, 2010
37. Tool Chooser
def _tools_changed(self):
classes = [eval(class_name) for class_name in self.tools]
for tool in self.plot.tools:
if tool.__class__ not in classes:
self.plot.tools.remove(tool)
else:
classes.remove(tool.__class__)
for cls in classes:
self.plot.tools.append(cls(self.plot))
return
Monday, February 22, 2010
38. Tool Chooser
def _tools_changed(self):
classes = [eval(class_name) for class_name in self.tools]
for tool in self.plot.tools:
if tool.__class__ not in classes:
self.plot.tools.remove(tool)
else:
classes.remove(tool.__class__)
for cls in classes:
self.plot.tools.append(cls(self.plot))
return
Monday, February 22, 2010
39. Tool Chooser
def _tools_changed(self):
classes = [eval(class_name) for class_name in self.tools]
for tool in self.plot.tools:
if tool.__class__ not in classes:
self.plot.tools.remove(tool)
else:
classes.remove(tool.__class__)
for cls in classes:
self.plot.tools.append(cls(self.plot))
return
Monday, February 22, 2010
40. Tool Chooser
def _tools_changed(self):
classes = [eval(class_name) for class_name in self.tools]
for tool in self.plot.tools:
if tool.__class__ not in classes:
self.plot.tools.remove(tool)
else:
classes.remove(tool.__class__)
for cls in classes:
self.plot.tools.append(cls(self.plot))
return
Monday, February 22, 2010
41. Tool Chooser
def _tools_changed(self):
classes = [eval(class_name) for class_name in self.tools]
for tool in self.plot.tools:
if tool.__class__ not in classes:
self.plot.tools.remove(tool)
else:
classes.remove(tool.__class__)
for cls in classes:
self.plot.tools.append(cls(self.plot))
return
Monday, February 22, 2010
42. Tool Chooser
def _tools_changed(self):
classes = [eval(class_name) for class_name in self.tools]
for tool in self.plot.tools:
if tool.__class__ not in classes:
self.plot.tools.remove(tool)
else:
classes.remove(tool.__class__)
for cls in classes:
self.plot.tools.append(cls(self.plot))
return
Monday, February 22, 2010
43. Tool Chooser
class ToolChooserExample(HasTraits):
plot = Instance(Plot)
tools = List(editor=CheckListEditor(values = ["PanTool", "ZoomTool",
"DragZoom"]))
traits_view = View(Item("tools", label="Tools", style="custom"),
Item('plot', editor=ComponentEditor(), show_label=False),
width=800, height=600, resizable=True,
title="Tool Chooser")
def __init__(self):
...
def _tools_changed(self):
classes = [eval(class_name) for class_name in self.tools]
# Remove all tools that are not in the enabled list in self.tools
for tool in self.plot.tools:
if tool.__class__ not in classes:
self.plot.tools.remove(tool)
else:
classes.remove(tool.__class__)
# Create new instances of tools for the remaining tool classes
for cls in classes:
self.plot.tools.append(cls(self.plot))
return
Monday, February 22, 2010