File: contour.py

package info (click to toggle)
wxmplot 0.9.58-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,052 kB
  • sloc: python: 10,085; makefile: 88; sh: 2
file content (18 lines) | stat: -rw-r--r-- 536 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

from numpy import exp, random, arange, outer
import wxmplot.interactive as wi

def gauss2d(x, y, x0, y0, sx, sy):
    return outer( exp( -(((y-y0)/float(sy))**2)/2),
                  exp( -(((x-x0)/float(sx))**2)/2) )

ny, nx = 350, 400
x = arange(nx)
y = arange(ny)
ox =  x /200.0
oy = -1 + y / 200.0
dat  = 0.3 * random.random(size=nx*ny).reshape(ny, nx)
dat =  dat + (16.0*gauss2d(x, y, 190,   96,  15,  26) +
              27.0*gauss2d(x, y, 140,  210,  51,  42))

wi.imshow(dat, x=ox, y=oy, style='contour', contour_labels=True)