#!/usr/bin/env python import math from numarray import * from gipsy import * from gipsyc import * import ggi def quit(cb): if userlog(cb.key): wkey(cb.key) finis() init() ROWS = 100 COLS = 100 NCI = 50 base = ggi.Base() plotter = base.PlotField('PLOT', 325, 325) plotter.mapColors((0,16), (16, NCI)) wedge = base.ColorEditor(16, NCI) wedge.limits(0.0, 1.0) bquit = base.Button('QUIT=', 'Stop program') plotter.setPosition(0, None, 0, None) wedge.setPosition(0, None, 0, plotter) bquit.setPosition(0, None, 0, wedge) KeyCallback(quit, 'QUIT=') base.realize() image = array(shape=(ROWS,COLS), type=Float32) w = 3.0*COLS for j in xrange(ROWS): y = j-ROWS/2.0 for i in xrange(COLS): x = i-COLS/2.0 image[j,i] = math.exp(-(x*x+y*y)/w) plotter.open() pgscir_c(16, 16+NCI-1) tr = [0.0, 1.0/COLS, 0.0, 0.0, 0.0, 1.0/ROWS] pgimag_c(image, COLS, ROWS, 1, COLS, 1, ROWS, 0.0, 1.0, tr) mainloop()