forked from newville/wxmplot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
im1.py
34 lines (29 loc) · 963 Bytes
/
im1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sys
if not hasattr(sys, 'frozen'):
import wxversion
wxversion.ensureMinimal('2.8')
import wx
from numpy import exp, random, arange, outer
from lib import ImageFrame
# from wxmplot import ImageFrame
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 / 62.
oy = -2 + y / 97.0
dat = 0.2 + (0.3*random.random(size=nx*ny).reshape(ny, nx) +
6.0*gauss2d(x, y, 90, 76, 5, 6) +
1.0*gauss2d(x, y, 180, 100, 7, 3) +
1.0*gauss2d(x, y, 175, 98, 3, 7) +
0.5*gauss2d(x, y, 181, 93, 4, 11) +
1.8*gauss2d(x, y, 270, 230, 78, 63) +
0.9*gauss2d(x, y, 240, 265, 8, 3) +
7.0*gauss2d(x, y, 40, 310, 2, 3) )
app = wx.App()
frame = ImageFrame(mode='intensity')
frame.display(dat, x=ox, y=oy)
frame.Show()
app.MainLoop()