~ubuntu-branches/ubuntu/vivid/python-chaco/vivid-proposed

« back to all changes in this revision

Viewing changes to examples/advanced/scalar_image_function_inspector.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2010-06-03 01:43:27 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100603014327-lurshmszk4h96hr8
Tags: 3.3.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
        self.compute_model()
67
67
 
68
68
    def compute_model(self):
69
 
        # Create the values
70
 
        self.xs = linspace(self.min_x, self.max_x, self.npts_x)
71
 
        self.ys = linspace(self.min_y, self.max_y, self.npts_y)
72
 
        x, y = meshgrid(self.xs,self.ys)
 
69
        # The xs and ys used for the image plot range need to be the 
 
70
        # edges of the cells.
 
71
        self.xs = linspace(self.min_x, self.max_x, self.npts_x+1)
 
72
        self.ys = linspace(self.min_y, self.max_y, self.npts_y+1)
 
73
        
 
74
        # The grid of points at which we will evaluate the 2D function
 
75
        # is located at cell centers, so use halfsteps from the 
 
76
        # min/max values (which are edges)
 
77
        xstep = (self.max_x - self.min_x) / self.npts_x
 
78
        ystep = (self.max_y - self.min_y) / self.npts_y
 
79
        gridx = linspace(self.min_x+xstep/2, self.max_x-xstep/2, self.npts_x)
 
80
        gridy = linspace(self.min_y+xstep/2, self.max_y-xstep/2, self.npts_y)
 
81
        x, y = meshgrid(gridx, gridy)
73
82
        try:
74
83
            d = dict(x=x, y=y)
75
84
            exec "from scipy import *" in d